Optimizations: Equihash & Feats: Assumevalid + SPV#4
Merged
b-j-roberts merged 49 commits intomainfrom Dec 17, 2025
Merged
Conversation
c66f95f to
641b1a8
Compare
m-kus
reviewed
Dec 9, 2025
| result = { | ||
| "chain_state": format_chain_state(initial_chain_state), | ||
| "blocks": formatted_blocks, | ||
| "expected": format_chain_state(chain_state), | ||
| "sorted_indices_hints": sorted_indices_hints, |
Member
There was a problem hiding this comment.
Would need to change that in the assumevalid crate as well (preparing args)
e49f1c9 to
314b66c
Compare
…pre parsed indices )
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
Optimizes the Equihash proof-of-work validation for ZK prover efficiency. Restructures validation to minimize Cairo steps while maintaining full security guarantees equivalent to the reference implementation.
Current savings estimate:
40,277,059 steps->859,899 steps( ~98% )Key Optimizations/Changes
blake2bfeature flag, so cairo1 impl is used by defaultArray<u32>instead ofArray<u8>, eliminatingexpand_arraybyte manipulationdistinct_indiceswith Schwartz-Zippel permutation verification using prover-provided sorted hintHow to Test
Using cairo1 blake2b
cd packages/client ../../scripts/data/integration_tests.shUsing blake2b opcode
git clone --recursive https://github.com/Ztarknet/zoro-proving-stack.git cd zoro-proving-stack ./setup.sh make scarb-buildcd packages/client SCARB=/path/to/scarb/target/debug/scarb ../../scripts/data/integration_tests.sh --features=blake2b