feat(sp1-verifier): feature-gate heavy dependencies for WASM-compatible PLONK & GROTH16 verification#2698
Open
dharjeezy wants to merge 5 commits intosuccinctlabs:mainfrom
Conversation
Contributor
|
That would be great! |
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.
The sp1-verifier crate currently pulls in sp1-hypercube, sp1-recursion-, slop-, and other heavy dependencies unconditionally. These transitively depend on getrandom, which doesn't compile for wasm32-unknown-unknown.
The PLONK verifier itself doesn't use any of them, they're only needed for Groth16, compressed proofs, and recursion VK computation.
This PR moves those dependencies behind a full feature flag so the PLONK and GROTH16 verifier works out of the box in WASM targets (e.g., Substrate on-chain runtimes, browser environments).
Motivation
We're building an on-chain BEEFY consensus proof verifier for https://github.com/polytope-labs/hyperbridge that runs inside a Substrate runtime (wasm32-unknown-unknown). The verifier needs to check SP1 PLONK and GROTH16 proofs on-chain. The PLONK verification math (BN254 pairing checks) is fully no_std-compatible, but the crate fails to compile for WASM because of transitive getrandom usage from deps that PLONK doesn't need.
What changed
Breaking changes
None for users who enable full. Without full, only the PLONK verifier is available, Groth16, compressed proofs, and recursion VK types are gated.
If you'd prefer existing behavior to be preserved without opt-in, default = ["full"] can be added so users must explicitly opt out with default-features = false.