-
Notifications
You must be signed in to change notification settings - Fork 599
feat: batched chonk verification #21083
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
Merged
ledwards2225
merged 14 commits into
merge-train/barretenberg
from
lde/batch-chonk-verification
Mar 5, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
47f28c8
PoC batch chonk verifier (only batching ipa portion for now)
ledwards2225 9e5e52d
benchmarks
ledwards2225 ade3631
integrate batch verification in API as minimally as possible
ledwards2225 eefed9c
instrument Chonk verification for benchmark detailing
ledwards2225 c34e8e6
round trip test for good measure
ledwards2225 e1ed6df
comment cleanup
ledwards2225 b0caed9
extend chonk verificaiton bench
ledwards2225 19c18e5
comment cleamup
ledwards2225 c8ed1f1
failure test updates
ledwards2225 708ca64
dedupe ipa transcript extraction
ledwards2225 5a5bb21
tidy + batched ipa test updates
ledwards2225 584d3d9
add TODO re batching/threading non-IPA portions
ledwards2225 403327e
no need to hash inputs to generate batching challenge
ledwards2225 156ed8e
remove over-zealous move
ledwards2225 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
38 changes: 38 additions & 0 deletions
38
barretenberg/cpp/src/barretenberg/chonk/chonk_batch_verifier.cpp
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| #include "chonk_batch_verifier.hpp" | ||
| #include "barretenberg/commitment_schemes/ipa/ipa.hpp" | ||
| #include "barretenberg/commitment_schemes/verification_key.hpp" | ||
| #include "barretenberg/eccvm/eccvm_flavor.hpp" | ||
|
|
||
| namespace bb { | ||
|
|
||
| bool ChonkBatchVerifier::verify(std::span<const Input> inputs) | ||
| { | ||
| const size_t num_proofs = inputs.size(); | ||
| if (num_proofs == 0) { | ||
| return true; | ||
| } | ||
|
|
||
| // Phase 1: Run all non-IPA verification for each proof, collecting IPA claims | ||
| // TODO(https://github.com/AztecProtocol/barretenberg/issues/1651): Consider batching and/or multithreading the | ||
| // non-IPA portion of verification as well. Becomes significant for moderate batch sizes. | ||
| std::vector<OpeningClaim<curve::Grumpkin>> ipa_claims; | ||
| std::vector<std::shared_ptr<NativeTranscript>> ipa_transcripts; | ||
| ipa_claims.reserve(num_proofs); | ||
| ipa_transcripts.reserve(num_proofs); | ||
|
|
||
| for (const auto& input : inputs) { | ||
| ChonkNativeVerifier verifier(input.vk_and_hash); | ||
| auto result = verifier.reduce_to_ipa_claim(input.proof); | ||
| if (!result.all_checks_passed) { | ||
| return false; | ||
| } | ||
| ipa_claims.push_back(result.ipa_claim); | ||
| ipa_transcripts.push_back(std::make_shared<NativeTranscript>(result.ipa_proof)); | ||
| } | ||
|
|
||
| // Phase 2: Batch IPA verification with single SRS MSM | ||
| auto ipa_vk = VerifierCommitmentKey<curve::Grumpkin>{ ECCVMFlavor::ECCVM_FIXED_SIZE }; | ||
| return IPA<curve::Grumpkin>::batch_reduce_verify(ipa_vk, ipa_claims, ipa_transcripts); | ||
| } | ||
|
|
||
| } // namespace bb |
Oops, something went wrong.
Oops, something went wrong.
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.
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.
For the use-case, I guess it is better that the batch size is not one of the arguments?