-
Notifications
You must be signed in to change notification settings - Fork 615
fix: verify_honk_proof inputs generation in bootstrap #12457
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
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aa3d06f
fix?
lucasxia01 621d751
add TODO
lucasxia01 1ca573f
add new functionality for regenerating inputs
lucasxia01 59b42a3
Merge remote-tracking branch 'origin/master' into lx/fix-acir-tests-i…
lucasxia01 7846a54
add new functions to make bootstrap more readable and to deduplicate
lucasxia01 5a4b560
Merge remote-tracking branch 'origin/master' into lx/fix-acir-tests-i…
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,24 +21,89 @@ function build { | |
| echo_header "acir_tests build" | ||
|
|
||
| if ! cache_download $tests_tar; then | ||
| rm -rf acir_tests | ||
| denoise "cd ../../noir/noir-repo/test_programs/execution_success && git clean -fdx" | ||
| cp -R ../../noir/noir-repo/test_programs/execution_success acir_tests | ||
| # Running these requires extra gluecode so they're skipped. | ||
| rm -rf acir_tests/{diamond_deps_0,workspace,workspace_default_member} | ||
| # TODO(https://github.com/AztecProtocol/barretenberg/issues/1108): problem regardless the proof system used | ||
| # TODO: Check if resolved. Move to .test_skip_patterns if not. | ||
| rm -rf acir_tests/regression_5045 | ||
|
|
||
| # COMPILE=2 only compiles the test. | ||
| denoise "parallel --joblog joblog.txt --line-buffered 'COMPILE=2 ./run_test.sh \$(basename {})' ::: ./acir_tests/*" | ||
|
|
||
| echo "Regenerating verify_honk_proof and verify_rollup_honk_proof recursive inputs." | ||
| # rm -rf acir_tests | ||
| # denoise "cd ../../noir/noir-repo/test_programs/execution_success && git clean -fdx" | ||
| # cp -R ../../noir/noir-repo/test_programs/execution_success acir_tests | ||
| # # Running these requires extra gluecode so they're skipped. | ||
| # rm -rf acir_tests/{diamond_deps_0,workspace,workspace_default_member} | ||
| # # TODO(https://github.com/AztecProtocol/barretenberg/issues/1108): problem regardless the proof system used | ||
| # # TODO: Check if resolved. Move to .test_skip_patterns if not. | ||
| # rm -rf acir_tests/regression_5045 | ||
| # # Don't compile these until we generate their inputs | ||
| # rm -rf acir_tests/{verify_honk_proof,double_verify_honk_proof,verify_rollup_honk_proof} | ||
|
|
||
| # # COMPILE=2 only compiles the test. | ||
| # denoise "parallel --joblog joblog.txt --line-buffered 'COMPILE=2 ./run_test.sh \$(basename {})' ::: ./acir_tests/*" | ||
|
|
||
| cp -R ../../noir/noir-repo/test_programs/execution_success/{verify_honk_proof,double_verify_honk_proof,verify_rollup_honk_proof} acir_tests | ||
| echo "Regenerating verify_honk_proof, double_verify_honk_proof, verify_rollup_honk_proof recursive inputs." | ||
| local bb=$(realpath ../cpp/build/bin/bb) | ||
| (cd ./acir_tests/assert_statement && \ | ||
| # TODO(https://github.com/AztecProtocol/barretenberg/issues/1253) Deprecate command and construct TOML (e.g., via yq or via conversion from a JSON) | ||
| $bb OLD_API write_recursion_inputs_ultra_honk -b ./target/program.json -o ../verify_honk_proof --recursive && \ | ||
| $bb OLD_API write_recursion_inputs_ultra_honk --ipa_accumulation -b ./target/program.json -o ../verify_rollup_honk_proof --recursive) | ||
| cd ./acir_tests/assert_statement | ||
|
|
||
| outdir=$(mktemp -d) | ||
| trap "rm -rf $outdir" EXIT | ||
| local key_hash="0x0000000000000000000000000000000000000000000000000000000000000000" | ||
|
|
||
| local prove_uh_cmd="$bb prove --scheme ultra_honk --init_kzg_accumulator --output_format fields --write_vk -o $outdir -b ./target/program.json -w ./target/witness.gz" | ||
| echo_stderr $prove_uh_cmd | ||
| dump_fail "$prove_uh_cmd" | ||
| vk_fields=$(cat $outdir/vk_fields.json) | ||
| proof_fields=$(cat $outdir/proof_fields.json) | ||
| num_inner_public_inputs=$(( 16#$(echo $vk_fields | jq -r '.[1] | ltrimstr("0x")') - 16 )) | ||
| echo "num_inner_public_inputs = $num_inner_public_inputs" | ||
|
|
||
| jq -nr \ | ||
| --arg key_hash "$key_hash" \ | ||
| --argjson vkf "$vk_fields" \ | ||
| --argjson prooff "$proof_fields" \ | ||
| --argjson num_inner_public_inputs "$num_inner_public_inputs" \ | ||
| '[ | ||
| "key_hash = \($key_hash)", | ||
| "proof = [\($prooff | .[$num_inner_public_inputs:] | map("\"" + . + "\"") | join(", "))]", | ||
| "public_inputs = [\($prooff | .[:$num_inner_public_inputs] | map("\"" + . + "\"") | join(", "))]", | ||
| "verification_key = [\($vkf | map("\"" + . + "\"") | join(", "))]" | ||
| ] | join("\n")' > ../verify_honk_proof/Prover.toml | ||
|
|
||
| jq -nr \ | ||
| --arg key_hash "$key_hash" \ | ||
| --argjson vkf "$vk_fields" \ | ||
| --argjson prooff "$proof_fields" \ | ||
| --argjson num_inner_public_inputs "$num_inner_public_inputs" \ | ||
| '[ | ||
| "key_hash = \($key_hash)", | ||
| "proof = [\($prooff | .[$num_inner_public_inputs:] | map("\"" + . + "\"") | join(", "))]", | ||
| "public_inputs = [\($prooff | .[:$num_inner_public_inputs] | map("\"" + . + "\"") | join(", "))]", | ||
| "verification_key = [\($vkf | map("\"" + . + "\"") | join(", "))]", | ||
| "proof_b = [\($prooff | .[$num_inner_public_inputs:] | map("\"" + . + "\"") | join(", "))]" | ||
| ] | join("\n")' > ../double_verify_honk_proof/Prover.toml | ||
|
|
||
|
|
||
| local prove_rollup_honk_cmd="$bb prove --scheme ultra_honk --init_kzg_accumulator --ipa_accumulation --output_format fields --write_vk -o $outdir -b ./target/program.json -w ./target/witness.gz" | ||
| echo_stderr $prove_rollup_honk_cmd | ||
| dump_fail "$prove_rollup_honk_cmd" | ||
| vk_fields=$(cat $outdir/vk_fields.json) | ||
| proof_fields=$(cat $outdir/proof_fields.json) | ||
| num_inner_public_inputs=$(( 16#$(echo $vk_fields | jq -r '.[1] | ltrimstr("0x")') - 26 )) | ||
| echo "num_inner_public_inputs = $num_inner_public_inputs" | ||
|
|
||
| jq -nr \ | ||
| --arg key_hash "$key_hash" \ | ||
| --argjson vkf "$vk_fields" \ | ||
| --argjson prooff "$proof_fields" \ | ||
| --argjson num_inner_public_inputs "$num_inner_public_inputs" \ | ||
| '[ | ||
| "key_hash = \($key_hash)", | ||
| "proof = [\($prooff | .[$num_inner_public_inputs:] | map("\"" + . + "\"") | join(", "))]", | ||
| "public_inputs = [\($prooff | .[:$num_inner_public_inputs] | map("\"" + . + "\"") | join(", "))]", | ||
| "verification_key = [\($vkf | map("\"" + . + "\"") | join(", "))]" | ||
| ] | join("\n")' > ../verify_rollup_honk_proof/Prover.toml | ||
| cd ../.. | ||
|
|
||
|
|
||
| # $bb OLD_API write_recursion_inputs_ultra_honk -b ./target/program.json -o ../verify_honk_proof --recursive | ||
|
Contributor
Author
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. can delete these flows |
||
| # $bb OLD_API write_recursion_inputs_ultra_honk --ipa_accumulation -b ./target/program.json -o ../verify_rollup_honk_proof --recursive | ||
|
|
||
| denoise "parallel --joblog joblog.txt --line-buffered 'COMPILE=2 ./run_test.sh \$(basename {})' ::: ./acir_tests/{verify_honk_proof,double_verify_honk_proof,verify_rollup_honk_proof}" | ||
|
|
||
| cache_upload $tests_tar acir_tests | ||
| fi | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
this as a whole is honestly a little more complicated than I would've liked... unclear if this that much better than the write_recursion_inputs_ultra_honk flows
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.
its probably easier to have all the logic here though instead of having to modify both bootstrap and cpp files, even if this is quite annoying logic to handle in bash/jq