-
Notifications
You must be signed in to change notification settings - Fork 387
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
SIMD-0075: Precompile for Secp256r1 #3152
Conversation
0f4876e
to
8f18340
Compare
8f18340
to
4c753ff
Compare
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.
I think I looked at just about everything except the actual cryptography. I saw @samkim-crypto self-requested review.
I spotted a handful of small nits, mostly around naming and semantics. Let me know what you think. Other than that nice work!
Massive thank you @joncinque for the in depth review ❤️ Let me know if I missed anything 🫶 |
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.
Looks good to me! I asked @yihau to help out with the crate publishing. In the meanwhile, @buffalojoec, @kevinheavey, @0x0ece, @joncinque, if you have any last comments please let us know. Otherwise, I'll go ahead and merge it once the crate is published.
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
* feat: secp256r1 precompile * add: num_signatures == 0 check from SIMD-0152 * rm: unnecessary comment * fix: legacy numeric constant * CI/fix: compilation for wasm32 target * Extract secp256r1 crate * rm: unnecessary import * update: sbf/Cargo.lock * rm: unnecesary re-exports * add: secp256r1 precompile to docs * add: docs/description to sdk/program/src/lib.rs * fix: alpha sort deps * fixes * docs fixes * add: solana-instruction std feature to deps * fix: lockfile from rebase * fix: target architecture * fix: workflow for client_target android * add: sudo to workflow perl install * fix: Cargo toml workspace member * modify: ranlib path in client-targets.yaml * fix: secp256r1/Cargo.toml formatting * add: openssl feature * fixes * add: precompile signature range error * more adjustments * change: feature id * fix: cargo format * Revert "add: precompile signature range error" This reverts commit fdf7673. * fix: cargo sanity * fix: client target openssl dep * fix: 31 byte r,s support in new_secp256r1_instruction * update: Cargo.lock * fix: unchecked math in new_secp256r1_instruction * fixes & increased test coverage * add: solana-sdk/openssl to all release binaries * update: comment to make openssl feature more clear * add: solana-sdk/openssl feature to dependencies * add: solana-sdk/openssl feature to dependencies * merge: master into secp256r1-precompile * fix: test-validator formatting * Revert "add: solana-sdk/openssl to all release binaries" This reverts commit 5c66b50. * add: reserved key for secp256r1 program * modify: client-targets.yaml * modify: client/Cargo.toml solana-sdk dep * modify: ledger-tool/Cargo.toml solana-sdk * modify: test-validator/Cargo.toml solana-sdk dep * modify: validator/Cargo.toml solana-sdk dep * change: openssl feature to openssl-vendored * remove: solana-sdk dep from sdk/program * refactor: secp256r1 directory name * fmt * cargo.lock files * revert: rustc-demangle bump * cargo lock sanity * fix: faulty feature-set merge * fix: reserved keys pending feature id --------- Co-authored-by: Iceomatic <89707822+iceomatic@users.noreply.github.com> (cherry picked from commit da4f55e) # Conflicts: # Cargo.lock # Cargo.toml # ledger-tool/Cargo.toml # programs/sbf/Cargo.lock # sdk/Cargo.toml # sdk/feature-set/src/lib.rs # sdk/reserved-account-keys/Cargo.toml # sdk/src/reserved_account_keys.rs
8 hours wasn't really enough notice, this still needed changes |
@@ -20,6 +20,7 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ | |||
] } | |||
solana-pubkey = { workspace = true, default-features = false } | |||
solana-sdk-ids = { workspace = true } | |||
solana-secp256r1-program = { workspace = true } |
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.
I would have asked you to put the secp256r1 program ID in solana-sdk-ids so solana-reserved-account-keys wouldn't end up with a solana-secp256r1-program dependency
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.
Will coordinate with sam to make sure #3663 is backported together with this 👍
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.
Looks like we don't have to backport since the sdk-ids split isn't in 2.1. Will just get this merged into master 🫡
* SIMD-0075: Precompile for Secp256r1 (#3152) * feat: secp256r1 precompile * add: num_signatures == 0 check from SIMD-0152 * rm: unnecessary comment * fix: legacy numeric constant * CI/fix: compilation for wasm32 target * Extract secp256r1 crate * rm: unnecessary import * update: sbf/Cargo.lock * rm: unnecesary re-exports * add: secp256r1 precompile to docs * add: docs/description to sdk/program/src/lib.rs * fix: alpha sort deps * fixes * docs fixes * add: solana-instruction std feature to deps * fix: lockfile from rebase * fix: target architecture * fix: workflow for client_target android * add: sudo to workflow perl install * fix: Cargo toml workspace member * modify: ranlib path in client-targets.yaml * fix: secp256r1/Cargo.toml formatting * add: openssl feature * fixes * add: precompile signature range error * more adjustments * change: feature id * fix: cargo format * Revert "add: precompile signature range error" This reverts commit fdf7673. * fix: cargo sanity * fix: client target openssl dep * fix: 31 byte r,s support in new_secp256r1_instruction * update: Cargo.lock * fix: unchecked math in new_secp256r1_instruction * fixes & increased test coverage * add: solana-sdk/openssl to all release binaries * update: comment to make openssl feature more clear * add: solana-sdk/openssl feature to dependencies * add: solana-sdk/openssl feature to dependencies * merge: master into secp256r1-precompile * fix: test-validator formatting * Revert "add: solana-sdk/openssl to all release binaries" This reverts commit 5c66b50. * add: reserved key for secp256r1 program * modify: client-targets.yaml * modify: client/Cargo.toml solana-sdk dep * modify: ledger-tool/Cargo.toml solana-sdk * modify: test-validator/Cargo.toml solana-sdk dep * modify: validator/Cargo.toml solana-sdk dep * change: openssl feature to openssl-vendored * remove: solana-sdk dep from sdk/program * refactor: secp256r1 directory name * fmt * cargo.lock files * revert: rustc-demangle bump * cargo lock sanity * fix: faulty feature-set merge * fix: reserved keys pending feature id --------- Co-authored-by: Iceomatic <89707822+iceomatic@users.noreply.github.com> (cherry picked from commit da4f55e) # Conflicts: # Cargo.lock # Cargo.toml # ledger-tool/Cargo.toml # programs/sbf/Cargo.lock # sdk/Cargo.toml # sdk/feature-set/src/lib.rs # sdk/reserved-account-keys/Cargo.toml # sdk/src/reserved_account_keys.rs * Fix merge conflicts --------- Co-authored-by: Orion <89707822+0xRigel@users.noreply.github.com> Co-authored-by: Jon C <me@jonc.dev>
Problem
There currently isn't support for signature verification of signatures on the NIST-P256 curve (primary curve used by Passkeys). Motivation and details can be found in SIMD-0075
Summary of Changes
secp256r1
crate to avoid further bloat ofsolana_sdk