-
Notifications
You must be signed in to change notification settings - Fork 17
BatchVerifier #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: batch-ring-proof
Are you sure you want to change the base?
BatchVerifier #66
Conversation
| // Pick some entropy from plonk verifier for later usage | ||
| let mut entropy = [0_u8; 32]; | ||
| rng.fill_bytes(&mut entropy); | ||
|
|
||
| PreparedBatchItem { | ||
| piop, | ||
| proof, | ||
| challenges, | ||
| entropy, | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swasilyev @burdges @drskalman Need some extra attention here.
In practice, instead of immediately using the returned rng, we pick some randomness from it to be used later in the push_prepared
| pub fn push_prepared(&mut self, item: PreparedBatchItem<E, J>) { | ||
| let mut ts = self.verifier.plonk_verifier.transcript_prelude.clone(); | ||
| ts._add_serializable(b"batch-entropy", &item.entropy); | ||
| self.acc | ||
| .accumulate(item.piop, item.proof, item.challenges, &mut ts.to_rng()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swasilyev @burdges @drskalman here I pick the randomness back to:
- extend verifier transcript
- and use the derived rng in accumulate
This PR targets batching branch
Introduce a batching structure for ring proofs that bundles the
KzgAccumulatorand theRingVerifier, providing greater flexibility for downstream users.This would be further improved if
KzgAccumulatorimplementedCanonicalSerializeandCanonicalDeserialize, enabling batching across blocks.Proofs can be prepared for batch verification in parallel. Prepared proofs can be accumulated.
Performance boost ~2x
Some benches
Batch vs sequential verification times (ms):
Sequential prepare+accumulate
Sequential verification scales linearly with proof count.
Batch verification scales sub-linearly.
Parallel prepare + final sequential accumulate
NOTE: Parallel preparation can roughly yield an extra 2x speedup.
The
parallelcrate feature does not enable this.Downstream users can perform parallel preparation themselves. Each Prepared proof consumes ~3K, which may introduce significant hidden overhead when preparing big batches, so it may be preferable to accumulate every X proofs rather than the entire batch at once to save memory.