-
Notifications
You must be signed in to change notification settings - Fork 598
feat: Remove 4 byte metadata from bb-produced proof #13231
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
lucasxia01
merged 11 commits into
master
from
lx/remove-4-byte-serialization-metadata-from-proof
Apr 3, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aa08e4d
get rid of 4 byte metadata
lucasxia01 e4d95dc
update bbjs related scripts that do some metadata parsing
lucasxia01 c02f060
fix browser test
lucasxia01 c5d7d2c
update c_bind
lucasxia01 7ac45db
update tube functions
lucasxia01 e1276aa
add TODOs wrt tube since tube is annoying edge case
lucasxia01 8b02cb5
update honk_recursion_2 to ipa_accumulation
lucasxia01 9ac62a0
add TODO
lucasxia01 8597881
remove metadata parsing from bb_prover
lucasxia01 ef142ff
fix bbjs cli verify to actually exit based on verified
lucasxia01 7ad2e37
update bbjs related testing scripts to be simpler
lucasxia01 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,7 @@ PubInputsProofAndKey<VK> _prove(const bool compute_vk, | |
| } | ||
|
|
||
| template <typename Flavor> | ||
| bool _verify(const bool honk_recursion_2, | ||
| bool _verify(const bool ipa_accumulation, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wow |
||
| const std::filesystem::path& public_inputs_path, | ||
| const std::filesystem::path& proof_path, | ||
| const std::filesystem::path& vk_path) | ||
|
|
@@ -108,25 +108,25 @@ bool _verify(const bool honk_recursion_2, | |
|
|
||
| auto g2_data = get_bn254_g2_data(CRS_PATH); | ||
| srs::init_crs_factory({}, g2_data); | ||
| auto public_inputs = from_buffer<std::vector<bb::fr>>(read_file(public_inputs_path)); | ||
| auto proof = from_buffer<std::vector<bb::fr>>(read_file(proof_path)); | ||
| // concatenate public inputs and proof | ||
| std::vector<fr> complete_proof = public_inputs; | ||
| complete_proof.insert(complete_proof.end(), proof.begin(), proof.end()); | ||
|
|
||
| auto vk = std::make_shared<VerificationKey>(from_buffer<VerificationKey>(read_file(vk_path))); | ||
| vk->pcs_verification_key = std::make_shared<VerifierCommitmentKey<curve::BN254>>(); | ||
| auto public_inputs = many_from_buffer<bb::fr>(read_file(public_inputs_path)); | ||
| auto proof = many_from_buffer<bb::fr>(read_file(proof_path)); | ||
| // concatenate public inputs and proof | ||
| std::vector<fr> complete_proof = public_inputs; | ||
| complete_proof.insert(complete_proof.end(), proof.begin(), proof.end()); | ||
|
|
||
| std::shared_ptr<VerifierCommitmentKey<curve::Grumpkin>> ipa_verification_key; | ||
| if (honk_recursion_2) { | ||
| if (ipa_accumulation) { | ||
| init_grumpkin_crs(1 << CONST_ECCVM_LOG_N); | ||
| ipa_verification_key = std::make_shared<VerifierCommitmentKey<curve::Grumpkin>>(1 << CONST_ECCVM_LOG_N); | ||
| } | ||
|
|
||
| Verifier verifier{ vk, ipa_verification_key }; | ||
|
|
||
| bool verified; | ||
| if (honk_recursion_2) { | ||
| if (ipa_accumulation) { | ||
| const size_t HONK_PROOF_LENGTH = Flavor::PROOF_LENGTH_WITHOUT_PUB_INPUTS - IPA_PROOF_LENGTH; | ||
| const size_t num_public_inputs = static_cast<size_t>(vk->num_public_inputs); | ||
| // The extra calculation is for the IPA proof length. | ||
|
|
||
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
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.
had to fix this as it wasn't exiting with the right exit code based on verified. It was just always exiting with 0, so tests would pass even if verified was false.