-
Notifications
You must be signed in to change notification settings - Fork 399
feat: Add ECDSA secp256k1 builtin test #1294
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 all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f3d1afe
Copy ECDSA from commit 92ef9b4
kevaundray fad1854
rework for new syntax
kevaundray b7903ad
commit since github was down
kevaundray 9d2b338
[NOT MERGEABLE] - Skip all tests except ecdsa
kevaundray 1bb191c
change parameter order
kevaundray 6c55cc0
Merge remote-tracking branch 'origin/master' into kw/add-bck-ecdsa
kevaundray 19dff3f
update flake.lock
kevaundray cf189bc
update test
kevaundray 6935f5a
update flake.lock
kevaundray eed5e70
update flake.lock
kevaundray a693d74
modify test
kevaundray 315a057
add message + hashed_message to program
kevaundray 21e3b87
remove underscore
kevaundray 66e6633
modify input to use low-S
kevaundray 37dc0e9
commit s variant 1
kevaundray 0a4e0eb
commit variant S2
kevaundray 73c3e08
modify s value in signature to value that passes in acvm/pwg
kevaundray 23d48eb
update flake.lock
kevaundray a43aea3
remove if statement to make tests go faster
kevaundray 5a3fe3e
cleanup test
kevaundray 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 |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [package] | ||
| name = "ECDSA secp256k1 verification" | ||
| authors = [""] | ||
| compiler_version = "0.1" | ||
|
|
||
| [dependencies] |
209 changes: 209 additions & 0 deletions
209
crates/nargo_cli/tests/test_data/ecdsa_secp256k1/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,209 @@ | ||
|
|
||
| hashed_message = [ | ||
| 0x3a, | ||
| 0x73, | ||
| 0xf4, | ||
| 0x12, | ||
| 0x3a, | ||
| 0x5c, | ||
| 0xd2, | ||
| 0x12, | ||
| 0x1f, | ||
| 0x21, | ||
| 0xcd, | ||
| 0x7e, | ||
| 0x8d, | ||
| 0x35, | ||
| 0x88, | ||
| 0x35, | ||
| 0x47, | ||
| 0x69, | ||
| 0x49, | ||
| 0xd0, | ||
| 0x35, | ||
| 0xd9, | ||
| 0xc2, | ||
| 0xda, | ||
| 0x68, | ||
| 0x06, | ||
| 0xb4, | ||
| 0x63, | ||
| 0x3a, | ||
| 0xc8, | ||
| 0xc1, | ||
| 0xe2, | ||
| ] | ||
| message = [ | ||
| 0x49, | ||
| 0x6e, | ||
| 0x73, | ||
| 0x74, | ||
| 0x72, | ||
| 0x75, | ||
| 0x63, | ||
| 0x74, | ||
| 0x69, | ||
| 0x6f, | ||
| 0x6e, | ||
| 0x73, | ||
| 0x20, | ||
| 0x75, | ||
| 0x6e, | ||
| 0x63, | ||
| 0x6c, | ||
| 0x65, | ||
| 0x61, | ||
| 0x72, | ||
| 0x2c, | ||
| 0x20, | ||
| 0x61, | ||
| 0x73, | ||
| 0x6b, | ||
| 0x20, | ||
| 0x61, | ||
| 0x67, | ||
| 0x61, | ||
| 0x69, | ||
| 0x6e, | ||
| 0x20, | ||
| 0x6c, | ||
| 0x61, | ||
| 0x74, | ||
| 0x65, | ||
| 0x72, | ||
| 0x2e, | ||
| ] | ||
| pub_key_x = [ | ||
| 0xa0, | ||
| 0x43, | ||
| 0x4d, | ||
| 0x9e, | ||
| 0x47, | ||
| 0xf3, | ||
| 0xc8, | ||
| 0x62, | ||
| 0x35, | ||
| 0x47, | ||
| 0x7c, | ||
| 0x7b, | ||
| 0x1a, | ||
| 0xe6, | ||
| 0xae, | ||
| 0x5d, | ||
| 0x34, | ||
| 0x42, | ||
| 0xd4, | ||
| 0x9b, | ||
| 0x19, | ||
| 0x43, | ||
| 0xc2, | ||
| 0xb7, | ||
| 0x52, | ||
| 0xa6, | ||
| 0x8e, | ||
| 0x2a, | ||
| 0x47, | ||
| 0xe2, | ||
| 0x47, | ||
| 0xc7, | ||
| ] | ||
| pub_key_y = [ | ||
| 0x89, | ||
| 0x3a, | ||
| 0xba, | ||
| 0x42, | ||
| 0x54, | ||
| 0x19, | ||
| 0xbc, | ||
| 0x27, | ||
| 0xa3, | ||
| 0xb6, | ||
| 0xc7, | ||
| 0xe6, | ||
| 0x93, | ||
| 0xa2, | ||
| 0x4c, | ||
| 0x69, | ||
| 0x6f, | ||
| 0x79, | ||
| 0x4c, | ||
| 0x2e, | ||
| 0xd8, | ||
| 0x77, | ||
| 0xa1, | ||
| 0x59, | ||
| 0x3c, | ||
| 0xbe, | ||
| 0xe5, | ||
| 0x3b, | ||
| 0x03, | ||
| 0x73, | ||
| 0x68, | ||
| 0xd7, | ||
| ] | ||
| signature = [ | ||
| 0xe5, | ||
| 0x08, | ||
| 0x1c, | ||
| 0x80, | ||
| 0xab, | ||
| 0x42, | ||
| 0x7d, | ||
| 0xc3, | ||
| 0x70, | ||
| 0x34, | ||
| 0x6f, | ||
| 0x4a, | ||
| 0x0e, | ||
| 0x31, | ||
| 0xaa, | ||
| 0x2b, | ||
| 0xad, | ||
| 0x8d, | ||
| 0x97, | ||
| 0x98, | ||
| 0xc3, | ||
| 0x80, | ||
| 0x61, | ||
| 0xdb, | ||
| 0x9a, | ||
| 0xe5, | ||
| 0x5a, | ||
| 0x4e, | ||
| 0x8d, | ||
| 0xf4, | ||
| 0x54, | ||
| 0xfd, | ||
| 0x28, | ||
| 0x11, | ||
| 0x98, | ||
| 0x94, | ||
| 0x34, | ||
| 0x4e, | ||
| 0x71, | ||
| 0xb7, | ||
| 0x87, | ||
| 0x70, | ||
| 0xcc, | ||
| 0x93, | ||
| 0x1d, | ||
| 0x61, | ||
| 0xf4, | ||
| 0x80, | ||
| 0xec, | ||
| 0xbb, | ||
| 0x0b, | ||
| 0x89, | ||
| 0xd6, | ||
| 0xeb, | ||
| 0x69, | ||
| 0x69, | ||
| 0x01, | ||
| 0x61, | ||
| 0xe4, | ||
| 0x9a, | ||
| 0x71, | ||
| 0x5f, | ||
| 0xcd, | ||
| 0x55, | ||
| ] |
11 changes: 11 additions & 0 deletions
11
crates/nargo_cli/tests/test_data/ecdsa_secp256k1/src/main.nr
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,11 @@ | ||
| use dep::std; | ||
|
|
||
|
|
||
| fn main(message : [u8;38],hashed_message : [u8;32], pub_key_x : [u8;32], pub_key_y : [u8;32], signature : [u8;64]) { | ||
| // Hash the message, since secp256k1 expects a hashed_message | ||
| let expected= std::hash::sha256(message); | ||
| assert(hashed_message == expected); | ||
|
|
||
| let x = std::ecdsa_secp256k1::verify_signature(pub_key_x, pub_key_y, signature, hashed_message); | ||
|
kevaundray marked this conversation as resolved.
|
||
| assert(x == 1); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.