-
Notifications
You must be signed in to change notification settings - Fork 381
feat: Sync from aztec-packages #5222
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 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1e32b2d
chore: parallelise compilation of contracts and protocol circuits (ht…
1fb418b
Merge branch 'master' into aztec-packages
TomAFrench 1840d44
chore: fixes
TomAFrench 800d7c5
Apply suggestions from code review
TomAFrench f57168b
Update acvm-repo/acvm_js/build.sh
TomAFrench fd949eb
chore: delete `verify_honk_proof` test
TomAFrench c5acd08
Update compiler/noirc_frontend/src/elaborator/mod.rs
TomAFrench 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| 1d785fd1087d7387fc29213ca3be50b2fc9c4725 | ||
| 86a33140f9a65e518003b3f4c60f97d132f85b89 |
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 |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| recurse_leaf/Prover.toml | ||
| recurse_node/Prover.toml |
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,2 @@ | ||
| [workspace] | ||
| members = ["recurse_leaf", "recurse_node", "sum"] |
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,61 @@ | ||
| #!/bin/bash | ||
| set -eu | ||
|
|
||
| BACKEND=${BACKEND:-bb} | ||
|
|
||
| nargo execute sum_witness --package sum | ||
| $BACKEND prove -b ./target/sum.json -w ./target/sum_witness.gz -o ./target/sum_proof | ||
|
|
||
| # Once we have generated our inner proof, we must use this to generate inputs to `recurse_leaf`` | ||
|
|
||
| $BACKEND write_vk -b ./target/sum.json -o ./target/sum_key | ||
| $BACKEND vk_as_fields -k ./target/sum_key -o ./target/sum_vk_as_fields | ||
| VK_HASH=$(jq -r '.[0]' ./target/sum_vk_as_fields) | ||
| VK_AS_FIELDS=$(jq -r '.[1:]' ./target/sum_vk_as_fields) | ||
|
|
||
| FULL_PROOF_AS_FIELDS="$($BACKEND proof_as_fields -p ./target/sum_proof -k ./target/sum_key -o -)" | ||
| # sum has 3 public inputs | ||
| PUBLIC_INPUTS=$(echo $FULL_PROOF_AS_FIELDS | jq -r '.[:3]') | ||
| PROOF_AS_FIELDS=$(echo $FULL_PROOF_AS_FIELDS | jq -r '.[3:]') | ||
|
|
||
| RECURSE_LEAF_PROVER_TOML=./recurse_leaf/Prover.toml | ||
| echo "num = 2" > $RECURSE_LEAF_PROVER_TOML | ||
| echo "key_hash = \"$VK_HASH\"" >> $RECURSE_LEAF_PROVER_TOML | ||
| echo "verification_key = $VK_AS_FIELDS" >> $RECURSE_LEAF_PROVER_TOML | ||
| echo "proof = $PROOF_AS_FIELDS" >> $RECURSE_LEAF_PROVER_TOML | ||
| echo "public_inputs = $PUBLIC_INPUTS" >> $RECURSE_LEAF_PROVER_TOML | ||
|
|
||
| # We can now execute and prove `recurse_leaf` | ||
|
|
||
| nargo execute recurse_leaf_witness --package recurse_leaf | ||
| $BACKEND prove -b ./target/recurse_leaf.json -w ./target/recurse_leaf_witness.gz -o ./target/recurse_leaf_proof | ||
|
|
||
| # Let's do a sanity check that the proof we've generated so far is valid. | ||
| $BACKEND write_vk -b ./target/recurse_leaf.json -o ./target/recurse_leaf_key | ||
| $BACKEND verify -p ./target/recurse_leaf_proof -k ./target/recurse_leaf_key | ||
|
|
||
| # Now we generate the final `recurse_node` proof similarly to how we did for `recurse_leaf`. | ||
|
|
||
| $BACKEND vk_as_fields -k ./target/recurse_leaf_key -o ./target/recurse_leaf_vk_as_fields | ||
| VK_HASH=$(jq -r '.[0]' ./target/recurse_leaf_vk_as_fields) | ||
| VK_AS_FIELDS=$(jq -r '.[1:]' ./target/recurse_leaf_vk_as_fields) | ||
|
|
||
| FULL_PROOF_AS_FIELDS="$($BACKEND proof_as_fields -p ./target/recurse_leaf_proof -k ./target/recurse_leaf_key -o -)" | ||
| # recurse_leaf has 4 public inputs (excluding aggregation object) | ||
| PUBLIC_INPUTS=$(echo $FULL_PROOF_AS_FIELDS | jq -r '.[:4]') | ||
| PROOF_AS_FIELDS=$(echo $FULL_PROOF_AS_FIELDS | jq -r '.[4:]') | ||
|
|
||
| RECURSE_NODE_PROVER_TOML=./recurse_node/Prover.toml | ||
| echo "key_hash = \"$VK_HASH\"" > $RECURSE_NODE_PROVER_TOML | ||
| echo "verification_key = $VK_AS_FIELDS" >> $RECURSE_NODE_PROVER_TOML | ||
| echo "proof = $PROOF_AS_FIELDS" >> $RECURSE_NODE_PROVER_TOML | ||
| echo "public_inputs = $PUBLIC_INPUTS" >> $RECURSE_NODE_PROVER_TOML | ||
|
|
||
| # We can now execute and prove `recurse_node` | ||
|
|
||
| nargo execute recurse_node_witness --package recurse_node | ||
| $BACKEND prove -b ./target/recurse_node.json -w ./target/recurse_node_witness.gz -o ./target/recurse_node_proof | ||
|
|
||
| # We finally verify that the generated recursive proof is valid. | ||
| $BACKEND write_vk -b ./target/recurse_node.json -o ./target/recurse_node_key | ||
| $BACKEND verify -p ./target/recurse_node_proof -k ./target/recurse_node_key |
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,7 @@ | ||
| [package] | ||
| name = "recurse_leaf" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.26.0" | ||
|
|
||
| [dependencies] |
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,20 @@ | ||
| use dep::std; | ||
|
|
||
| #[recursive] | ||
| fn main( | ||
| verification_key: [Field; 114], | ||
| public_inputs: pub [Field; 3], | ||
| key_hash: Field, | ||
| proof: [Field; 93], | ||
| num: u64 | ||
| ) -> pub u64 { | ||
| // verify sum so far was computed correctly | ||
| std::verify_proof( | ||
| verification_key.as_slice(), | ||
| proof.as_slice(), | ||
| public_inputs.as_slice(), | ||
| key_hash | ||
| ); | ||
| // Take output of previous proof and add another number to it. | ||
| public_inputs[2] as u64 + num | ||
| } |
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,7 @@ | ||
| [package] | ||
| name = "recurse_node" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.26.0" | ||
|
|
||
| [dependencies] |
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,17 @@ | ||
| use dep::std; | ||
|
|
||
| fn main( | ||
| verification_key: [Field; 114], | ||
| public_inputs: pub [Field; 4], | ||
| key_hash: Field, | ||
| proof: [Field; 109] | ||
| ) -> pub u64 { | ||
| // verify sum was computed correctly | ||
| std::verify_proof( | ||
| verification_key.as_slice(), | ||
| proof.as_slice(), | ||
| public_inputs.as_slice(), | ||
| key_hash | ||
| ); | ||
| public_inputs[3] as u64 | ||
| } |
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,7 @@ | ||
| [package] | ||
| name = "sum" | ||
| type = "bin" | ||
| authors = [""] | ||
| compiler_version = ">=0.26.0" | ||
|
|
||
| [dependencies] |
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,2 @@ | ||
| a = 1 | ||
| b = 2 |
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,4 @@ | ||
| #[recursive] | ||
| fn main(a: pub u64, b: pub u64) -> pub u64 { | ||
| a + b | ||
| } |
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,8 @@ | ||
| #!/bin/bash | ||
| set -eu | ||
|
|
||
| # This file is used for Noir CI and is not required. | ||
|
|
||
| BACKEND=${BACKEND:-bb} | ||
|
|
||
| ./generate_recursive_proof.sh |
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,7 @@ | ||
| [package] | ||
| name = "bench_eddsa_poseidon" | ||
| version = "0.1.0" | ||
| type = "bin" | ||
| authors = [""] | ||
|
|
||
| [dependencies] |
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,6 @@ | ||
| msg = 789 | ||
| pub_key_x = "0x16b051f37589e0dcf4ad3c415c090798c10d3095bedeedabfcc709ad787f3507" | ||
| pub_key_y = "0x062800ac9e60839fab9218e5ed9d541f4586e41275f4071816a975895d349a5e" | ||
| r8_x = "0x163814666f04c4d2969059a6b63ee26a0f9f0f81bd5957b0796e2e8f4a8a2f06" | ||
| r8_y = "0x1255b17d9e4bfb81831625b788f8a1665128079ac4b6c8c3cd1b857666a05a54" | ||
| s = "1230930278088778318663840827871215383007447616379808164955640681455510074924" |
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,12 @@ | ||
| use dep::std::eddsa::{eddsa_poseidon_verify}; | ||
|
|
||
| fn main( | ||
| msg: pub Field, | ||
| pub_key_x: Field, | ||
| pub_key_y: Field, | ||
| r8_x: Field, | ||
| r8_y: Field, | ||
| s: Field | ||
| ) -> pub bool { | ||
| eddsa_poseidon_verify(pub_key_x, pub_key_y, s, r8_x, r8_y, msg) | ||
| } |
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,7 @@ | ||
| [package] | ||
| name = "bench_poseidon_hash" | ||
| version = "0.1.0" | ||
| type = "bin" | ||
| authors = [""] | ||
|
|
||
| [dependencies] |
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 @@ | ||
| input = [1,2] |
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,5 @@ | ||
| use dep::std::hash::poseidon; | ||
|
|
||
| fn main(input: [Field; 2]) -> pub Field { | ||
| poseidon::bn254::hash_2(input) | ||
| } |
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,7 @@ | ||
| [package] | ||
| name = "bench_poseidon_hash_100" | ||
| version = "0.1.0" | ||
| type = "bin" | ||
| authors = [""] | ||
|
|
||
| [dependencies] |
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.
Uh oh!
There was an error while loading. Please reload this page.