Skip to content
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

feat: new precompile secp256r1 #1612

Merged
merged 326 commits into from
Nov 5, 2024
Merged

feat: new precompile secp256r1 #1612

merged 326 commits into from
Nov 5, 2024

Conversation

umadayal
Copy link
Contributor

@umadayal umadayal commented Oct 7, 2024

Overview

Includes precompile for secp256r1 along with a test in examples/patch-testing calling this precompile.

Details

  • Added curve Secp256r1 to enum CurveType in crates/curves/src/lib.rs
  • Defined parameters such as curve modulus, a, b, and generator in crates/curves/src/weierstrass/secp256r1.rs
  • Include new curve type to syscalls/precompiles/weierstrass/add, double and decompress
  • Updated the decompress air so it can now be used for curves with non-zero a

With this new precompile, the p256 signature verification takes 55,581 cycles.

Copy link
Member

@ratankaliani ratankaliani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if you could add a PR description that specifies what your SP1 PR is doing.

Also, there's many places where there are outdated comments, and incorrect documentation (secp256r1 vs. secp256k1). Can you please meticulously go through and confirm that these are all correct. Especially given the scope of the PR, when there are small issues it makes it difficult to review.

Copy link
Contributor

@kevjue kevjue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking really good! I'll approve, but please address a few related style and commenting related notes.

Also, please confirm with @tamirhemo about possibly merging the fields in the decompress table.

@umadayal umadayal merged commit e443fc9 into dev Nov 5, 2024
12 checks passed
@umadayal umadayal deleted the secp256r1 branch November 5, 2024 21:52
@umadayal umadayal restored the secp256r1 branch November 6, 2024 19:34
yuwen01 added a commit that referenced this pull request Nov 8, 2024
Co-authored-by: John Guibas <[email protected]>
Co-authored-by: Tamir Hemo <[email protected]>
Co-authored-by: Bhargav Annem <[email protected]>
Co-authored-by: Eugene Rabinovich <[email protected]>
Co-authored-by: Shaked Regev <[email protected]>
Co-authored-by: Yuwen Zhang <[email protected]>
Co-authored-by: Matt Stam <[email protected]>
Co-authored-by: shakedregev <[email protected]>
Co-authored-by: Chris T. <[email protected]>
Co-authored-by: mattstam <[email protected]>
Co-authored-by: Kevin Jue <[email protected]>
Co-authored-by: Conner Swann <[email protected]>
Co-authored-by: Jonathan LEI <[email protected]>
Co-authored-by: Tamir Hemo <[email protected]>
Co-authored-by: rkm0959 <[email protected]>
Co-authored-by: Ratan Kaliani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.