-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: implement missing codegen for
BlackBoxFunc::EcdsaSecp256r1
in …
…brillig (#3943) # Description ## Problem\* Resolves AztecProtocol/aztec-packages#3822 ## Summary\* This PR adds codegen for the `BlackBoxFunc::EcdsaSecp256r1` in brillig and removes the catch-all branch when codegening black box functions. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
1 parent
a99e1f7
commit 2c5eceb
Showing
7 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
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
...xecution_success/brillig_ecdsa/Nargo.toml → ...uccess/brillig_ecdsa_secp256k1/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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "brillig_ecdsa" | ||
name = "brillig_ecdsa_secp256k1" | ||
type = "bin" | ||
authors = [""] | ||
|
||
|
File renamed without changes.
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
test_programs/execution_success/brillig_ecdsa_secp256r1/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] | ||
name = "brillig_ecdsa_secp256r1" | ||
type = "bin" | ||
authors = [""] | ||
|
||
[dependencies] |
20 changes: 20 additions & 0 deletions
20
test_programs/execution_success/brillig_ecdsa_secp256r1/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,20 @@ | ||
hashed_message = [ | ||
84, 112, 91, 163, 186, 175, 219, 223, 186, 140, 95, 154, 112, 247, 168, 155, 238, 152, | ||
217, 6, 181, 62, 49, 7, 77, 167, 186, 236, 220, 13, 169, 173, | ||
] | ||
pub_key_x = [ | ||
85, 15, 71, 16, 3, 243, 223, 151, 195, 223, 80, 106, 199, 151, 246, 114, 31, 177, 161, | ||
251, 123, 143, 111, 131, 210, 36, 73, 138, 101, 200, 142, 36, | ||
] | ||
pub_key_y = [ | ||
19, 96, 147, 215, 1, 46, 80, 154, 115, 113, 92, 189, 11, 0, 163, 204, 15, 244, 181, | ||
192, 27, 63, 250, 25, 106, 177, 251, 50, 112, 54, 184, 230, | ||
] | ||
signature = [ | ||
44, 112, 168, 208, 132, 182, 43, 252, 92, 224, 54, 65, 202, 249, 247, 42, | ||
212, 218, 140, 129, 191, 230, 236, 148, 135, 187, 94, 27, 239, 98, 161, 50, | ||
24, 173, 158, 226, 158, 175, 53, 31, 220, 80, 241, 82, 12, 66, 94, 155, | ||
144, 138, 7, 39, 139, 67, 176, 236, 123, 135, 39, 120, 193, 78, 7, 132 | ||
] | ||
|
||
|
16 changes: 16 additions & 0 deletions
16
test_programs/execution_success/brillig_ecdsa_secp256r1/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,16 @@ | ||
use dep::std; | ||
// Tests a very simple program. | ||
// | ||
// The features being tested is ecdsa in brillig | ||
fn main(hashed_message: [u8; 32], pub_key_x: [u8; 32], pub_key_y: [u8; 32], signature: [u8; 64]) { | ||
assert(ecdsa(hashed_message, pub_key_x, pub_key_y, signature)); | ||
} | ||
|
||
unconstrained fn ecdsa( | ||
hashed_message: [u8; 32], | ||
pub_key_x: [u8; 32], | ||
pub_key_y: [u8; 32], | ||
signature: [u8; 64] | ||
) -> bool { | ||
std::ecdsa_secp256r1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message) | ||
} |