Repository navigation
Conversation
Adds crates/test-artifacts/programs/poseidon2, a guest that drives both Poseidon2 surfaces sp1-lib exposes: the raw rate-8 sponge on Poseidon2State and the length-prefixed byte hasher Poseidon2ByteHash. It reads field blocks and byte messages from stdin and commits every digest so a host can compare them. Registers the crate in the programs workspace and exports POSEIDON2_ELF. No program in the tree previously issued the POSEIDON2 syscall, so nothing could reach the precompile.
Proves RiscvAir::Poseidon2 on a real execution, which no test did before. Checks in-guest digests against inner_perm on the host over messages that straddle the 24-byte block boundary and messages differing only by trailing zeros. Covers the AIR operation directly: both hand-rolled linear layers against Plonky3's matrices, the generated witness against the reference permutation, and that witness against the constraints that consume it, perturbing every column in turn so the constraint test cannot pass vacuously. Adds a #[cfg(test)] single-row constructor to DebugConstraintBuilder to make that possible. Corrects a comment in sp1-lib: the length-prefix bound is usize, not 2^192.
This branch has not been deployed
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.
just a side on the plate for #2942, which covers the Poseidon2 permutation itself in
slop-koala-bear.. this one pins the chip and the guest APIwhat i added:
A guest program driving both hashing surfaces with three suites over it:
sp1-core-machinesp1-core-executorinner_perm; the byte packing and length prefix as wire formatsp1-hypercubePlus a
#[cfg(test)]single-row constructor onDebugConstraintBuilder(mirroring the one already inlined indebug_constraints).. also a lil comment correction incrates/zkvm/lib/src/poseidon2.rs: the length-prefix bound isusizenot2^192!Cost
The proving test adds one small proof to the workspace suite on x86 and ARM, 15.3s locally in
--release. Inputs are two field blocks and two short messages, roughly five permutation calls, in line with the existing precompile tests. The other 9 tests need no proof.