perf(crypto): wire keccak_permute ecall into merkle/transcript/grinding#802
Open
Oppen wants to merge 1 commit into
Open
perf(crypto): wire keccak_permute ecall into merkle/transcript/grinding#802Oppen wants to merge 1 commit into
Oppen wants to merge 1 commit into
Conversation
Route the STARK verifier's Keccak-256 usage (Merkle tree backends, Fiat-Shamir transcript, FRI grinding) through the keccak_permute precompile on the riscv64 guest via a new PlatformKeccak256 digest wrapper, falling back to software sha3 on host. The guest previously used sha3's software permutation exclusively, making it the dominant verifier cost. Recursion guest cycles (blowup8 preset): - single query: 5,234,002,718 -> 1,722,846,582 (3.04x) - multi query: 22,494,934,472 -> 7,687,016,693 (2.93x) Also excludes the riscv-only `syscalls` crate from the root workspace: making it reachable from crypto/crypto (a workspace member) via a target-gated path dependency caused Cargo to auto-adopt it as an implicit member, so `cargo test` tried to run its bare-metal unit tests on host and aborted. Adds an end-to-end guest test (keccak_precompile) exercising the ecall-backed sponge against known Keccak-256 vectors, covering the padding edge cases (empty, rate-1, exactly-rate, multi-block input).
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.
Summary
keccak_permuteprecompile on the riscv64 guest, via aPlatformKeccak256digest wrapper aroundlambda_vm_syscalls::keccak::Keccak256; falls back to softwaresha3on host.syscallscrate from the root workspace (exclude = ["syscalls"]): making it reachable fromcrypto/cryptovia a target-gated path dependency caused Cargo to auto-adopt it as an implicit workspace member, socargo testtried to run its bare-metal unit tests on host and aborted.keccak_precompile) exercising the ecall-backed sponge against known Keccak-256 vectors (empty, rate-1, exactly-rate, multi-block), covering the padding edge cases.Cycle comparison (recursion guest, blowup8 preset)
Test plan
make test-profile-recursion-single/-multibefore and after (cycles above)test_recursion_execute_1query— in-VM verify accepts with the ecall-backed hashertest_keccak_precompileguest test — known-answer vectors incl. padding edge casesmake lintmake test— all pass exceptmath-cudaCUDA tests (expected: no GPU on this machine)