perf(guest): route all guest keccak through the chip via a vendored t… - #885
Open
diegokingston wants to merge 2 commits into
Open
perf(guest): route all guest keccak through the chip via a vendored t…#885diegokingston wants to merge 2 commits into
diegokingston wants to merge 2 commits into
Conversation
…iny-keccak patch ethrex's free-fn keccak_hash path (trie/RLP/tx hashing) bypasses the Crypto trait, so ~6% of a 20-tx block ran tiny_keccak's pure-Rust keccakf in the guest despite the keccak chip. Vendor tiny-keccak 2.0.2 under crypto/tiny-keccak with a one-hunk patch: on riscv64, keccakf calls the keccak_permute ecall; host keeps the software impl. Activated via [patch.crates-io] in the ethrex guest workspace (same pattern as sp1-patches/tiny-keccak). Measured vs origin/main (same fixtures, deterministic): transfers_20 8,732,213 -> 8,461,843 (-270,370, -3.1%) erc20_20 10,328,222 -> 9,929,487 (-398,735, -3.9%) mixed_20 9,817,444 -> 9,450,857 (-366,587, -3.7%) software tiny_keccak::keccakf in the guest flamegraph: 397k -> 0 (erc20_20). Verified: test_prove_ethrex_empty_block (prove+verify) passes.
Collaborator
Author
|
/bench |
Benchmark — real block (
|
| Metric | main | PR | Δ |
|---|---|---|---|
| Peak heap | 51856 MB | 52175 MB | +319 MB (+0.6%) ⚪ |
| Prove time | 159.217s | 153.339s | -5.878s (-3.7%) ⚪ |
❓ -3.7% — beyond what 3 runs resolve. Use
/bench-abbafor a paired test.Prove-time spread 0.7% (153.339s / 154.133s / 153.024s)
Commit: ce43d51 · Baseline: cached · Runner: self-hosted bench
diegokingston
marked this pull request as ready for review
July 31, 2026 21:24
Contributor
|
/bench |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…iny-keccak patch
ethrex's free-fn keccak_hash path (trie/RLP/tx hashing) bypasses the Crypto trait, so ~6% of a 20-tx block ran tiny_keccak's pure-Rust keccakf in the guest despite the keccak chip. Vendor tiny-keccak 2.0.2 under crypto/tiny-keccak with a one-hunk patch: on riscv64, keccakf calls the keccak_permute ecall; host keeps the software impl. Activated via [patch.crates-io] in the ethrex guest workspace.
Measured vs origin/main (same fixtures, deterministic):
transfers_20 8,732,213 -> 8,461,843 (-270,370, -3.1%)
erc20_20 10,328,222 -> 9,929,487 (-398,735, -3.9%)
mixed_20 9,817,444 -> 9,450,857 (-366,587, -3.7%)
software tiny_keccak::keccakf in the guest flamegraph: 397k -> 0 (erc20_20).
Verified: test_prove_ethrex_empty_block (prove+verify) passes.