-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Update to ACVM 0.18.1 and implement missing brillig blackboxes (…
…#1914) * feat: update to ACVM 0.18.1 * chore: point manually to the backend * Update crates/nargo_cli/tests/test_data_ssa_refactor/brillig_pedersen/Nargo.toml * chore: fix wasm * chore: update backend version * Update crates/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs Co-authored-by: Maxim Vezenov <mvezenov@gmail.com> --------- Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
- Loading branch information
1 parent
3ba1e72
commit 2bc7d25
Showing
29 changed files
with
271 additions
and
67 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,9 +1,10 @@ | ||
use acvm::SmartContract; | ||
use acvm::{acir::circuit::Circuit, SmartContract}; | ||
|
||
pub fn codegen_verifier<B: SmartContract>( | ||
backend: &B, | ||
common_reference_string: &[u8], | ||
circuit: &Circuit, | ||
verification_key: &[u8], | ||
) -> Result<String, B::Error> { | ||
backend.eth_contract_from_vk(common_reference_string, verification_key) | ||
backend.eth_contract_from_vk(common_reference_string, circuit, verification_key) | ||
} |
This file contains 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 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 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 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
6 changes: 6 additions & 0 deletions
6
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_pedersen/Nargo.toml
This file contains 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 @@ | ||
[package] | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] | ||
|
6 changes: 6 additions & 0 deletions
6
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_pedersen/Prover.toml
This file contains 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 @@ | ||
x = "0" | ||
y = "1" | ||
salt = "42" | ||
|
||
out_x = "0x0c5e1ddecd49de44ed5e5798d3f6fb7c71fe3d37f5bee8664cf88a445b5ba0af" | ||
out_y = "0x230294a041e26fe80b827c2ef5cb8784642bbaa83842da2714d62b1f3c4f9752" |
17 changes: 17 additions & 0 deletions
17
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_pedersen/src/main.nr
This file contains 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; | ||
|
||
unconstrained fn main(x: Field, y: Field, salt: Field, out_x: Field, out_y: Field ) { | ||
let res = std::hash::pedersen_with_separator([x, y], 0); | ||
assert(res[0] == out_x); | ||
assert(res[1] == out_y); | ||
|
||
let raw_data = [x,y]; | ||
let mut state = 0; | ||
for i in 0..(2 as u32) { | ||
state = state * 8 + raw_data[i]; | ||
} | ||
state += salt; | ||
let hash = std::hash::pedersen_with_separator([state], 0); | ||
assert(std::hash::pedersen_with_separator([43], 0)[0] == hash[0]); | ||
} | ||
|
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_scalar_mul/Nargo.toml
This file contains 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 @@ | ||
[package] | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
7 changes: 7 additions & 0 deletions
7
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_scalar_mul/Prover.toml
This file contains 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 @@ | ||
a = "1" | ||
a_pub_x = "0x0000000000000000000000000000000000000000000000000000000000000001" | ||
a_pub_y = "0x0000000000000002cf135e7506a45d632d270d45f1181294833fc48d823f272c" | ||
|
||
b = "2" | ||
b_pub_x = "0x06ce1b0827aafa85ddeb49cdaa36306d19a74caa311e13d46d8bc688cdbffffe" | ||
b_pub_y = "0x1c122f81a3a14964909ede0ba2a6855fc93faf6fa1a788bf467be7e7a43f80ac" |
22 changes: 22 additions & 0 deletions
22
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_scalar_mul/src/main.nr
This file contains 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,22 @@ | ||
use dep::std; | ||
|
||
unconstrained fn main( | ||
a: Field, | ||
a_pub_x: pub Field, | ||
a_pub_y: pub Field, | ||
b: Field, | ||
b_pub_x: pub Field, | ||
b_pub_y: pub Field | ||
) { | ||
let mut priv_key = a; | ||
let mut pub_x: Field = a_pub_x; | ||
let mut pub_y: Field = a_pub_y; | ||
if a != 1 { // Change `a` in Prover.toml to test input `b` | ||
priv_key = b; | ||
pub_x = b_pub_x; | ||
pub_y = b_pub_y; | ||
} | ||
let res = std::scalar_mul::fixed_base(priv_key); | ||
assert(res[0] == pub_x); | ||
assert(res[1] == pub_y); | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_schnorr/Nargo.toml
This file contains 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 @@ | ||
[package] | ||
authors = [""] | ||
compiler_version = "0.1" | ||
|
||
[dependencies] |
9 changes: 9 additions & 0 deletions
9
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_schnorr/Prover.toml
This file contains 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,9 @@ | ||
message = [0,1,2,3,4,5,6,7,8,9] | ||
pub_key_x = "0x17cbd3ed3151ccfd170efe1d54280a6a4822640bf5c369908ad74ea21518a9c5" | ||
pub_key_y = "0x0e0456e3795c1a31f20035b741cd6158929eeccd320d299cfcac962865a6bc74" | ||
signature = [ | ||
5, 202, 31, 146, 81, 242, 246, 69, 43, 107, 249, 153, 198, 44, 14, 111, 191, 121, 137, 166, | ||
160, 103, 18, 181, 243, 233, 226, 95, 67, 16, 37, 128, 85, 76, 19, 253, 30, 77, 192, 53, 138, | ||
205, 69, 33, 236, 163, 83, 194, 84, 137, 184, 221, 176, 121, 179, 27, 63, 70, 54, 16, 176, | ||
250, 39, 239, | ||
] |
10 changes: 10 additions & 0 deletions
10
crates/nargo_cli/tests/test_data_ssa_refactor/brillig_schnorr/src/main.nr
This file contains 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,10 @@ | ||
use dep::std; | ||
|
||
// Note: If main has any unsized types, then the verifier will never be able | ||
// to figure out the circuit instance | ||
unconstrained fn main(message: [u8; 10], pub_key_x: Field, pub_key_y: Field, signature: [u8; 64]) { | ||
// Is there ever a situation where someone would want | ||
// to ensure that a signature was invalid? | ||
let valid_signature = std::schnorr::verify_signature(pub_key_x,pub_key_y,signature, message); | ||
assert(valid_signature); | ||
} |
This file contains 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 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
2 changes: 1 addition & 1 deletion
2
crates/noirc_evaluator/src/brillig/brillig_gen/brillig_directive.rs
This file contains 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
Oops, something went wrong.