Implement secp256r1/P256 signature verification (EIP-7951)#1321
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1321 +/- ##
==========================================
+ Coverage 87.04% 87.06% +0.01%
==========================================
Files 167 168 +1
Lines 24728 24788 +60
Branches 4064 4070 +6
==========================================
+ Hits 21525 21582 +57
Misses 547 547
- Partials 2656 2659 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Closed
12 tasks
Add implementation of the "dbl-2001-b" doubling formula from https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b.
There was a problem hiding this comment.
Pull Request Overview
This PR implements the secp256r1/P256 signature verification precompile according to EIP-7951, which adds cryptographic support for the P256 elliptic curve commonly used in modern cryptographic applications.
- Adds a new secp256r1 module with curve parameters and signature verification logic
- Implements the p256verify_execute function to handle signature verification requests
- Extends the ECC library to support curves with A ≠ 0 (specifically A = P-3 for secp256r1)
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/state/precompiles.cpp | Implements the p256verify_execute precompile function with input validation and signature verification |
| lib/evmone_precompiles/secp256r1.hpp | Defines secp256r1 curve parameters and verification function interface |
| lib/evmone_precompiles/secp256r1.cpp | Implements ECDSA signature verification algorithm for secp256r1 curve |
| lib/evmone_precompiles/ecc.hpp | Extends ECC library to support curves with A = P-3 by adding conditional doubling formulas |
| lib/evmone_precompiles/CMakeLists.txt | Adds secp256r1 source files to build configuration |
| circle.yml | Removes test filters that were excluding p256verify precompile tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This implements the `p256_verify` precompile which verifies an ECDSA signature from the P256 / secp256r1 curve. See EIP-7951: https://eips.ethereum.org/EIPS/eip-7951.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This implements the
p256_verifyprecompile which verifiesan ECDSA signature from the P256 / secp256r1 curve.
See EIP-7951: https://eips.ethereum.org/EIPS/eip-7951.