Skip to content

feat: twisted edwards curves #633

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 15 commits into from
Jul 17, 2025

Conversation

qalisander
Copy link
Member

@qalisander qalisander commented Apr 22, 2025

Follows #589

PR Checklist

  • Tests
  • Documentation
  • Changelog

Copy link

netlify bot commented Apr 22, 2025

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit f6a05f7
🔍 Latest deploy log https://app.netlify.com/projects/contracts-stylus/deploys/6877688407dad10008bd1944

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 52.92553% with 177 lines in your changes missing coverage. Please review.

Project coverage is 85.1%. Comparing base (5f66d61) to head (f6a05f7).
Report is 2 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
lib/crypto/src/curve/te/projective.rs 52.1% 78 Missing ⚠️
lib/crypto/src/curve/te/affine.rs 31.6% 69 Missing ⚠️
lib/crypto/src/curve/te/mod.rs 81.6% 18 Missing ⚠️
lib/crypto/src/field/fp.rs 22.2% 7 Missing ⚠️
lib/crypto/src/curve/sw/affine.rs 0.0% 3 Missing ⚠️
lib/crypto/src/curve/sw/mod.rs 0.0% 1 Missing ⚠️
lib/crypto/src/curve/sw/projective.rs 0.0% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
lib/crypto/src/curve/mod.rs 16.3% <ø> (ø)
lib/crypto/src/curve/sw/mod.rs 91.7% <0.0%> (ø)
lib/crypto/src/curve/sw/projective.rs 72.7% <0.0%> (ø)
lib/crypto/src/curve/sw/affine.rs 35.5% <0.0%> (ø)
lib/crypto/src/field/fp.rs 73.2% <22.2%> (-1.1%) ⬇️
lib/crypto/src/curve/te/mod.rs 81.6% <81.6%> (ø)
lib/crypto/src/curve/te/affine.rs 31.6% <31.6%> (ø)
lib/crypto/src/curve/te/projective.rs 52.1% <52.1%> (ø)

... and 1 file with indirect coverage changes

@bidzyyys bidzyyys linked an issue May 27, 2025 that may be closed by this pull request
1 task
@qalisander qalisander marked this pull request as ready for review June 11, 2025 12:23

impl_additive_ops_from_ref!(Projective, TECurveConfig);

impl<'a, P: TECurveConfig> Add<&'a Self> for Projective<P> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to implement ref + ref?

///
/// * If point is not on curve.
/// * If point is not in the prime-order subgroup.
pub fn new(x: P::BaseField, y: P::BaseField) -> Self {
Copy link
Collaborator

@0xNeshi 0xNeshi Jun 19, 2025

Choose a reason for hiding this comment

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

Some general comments:

  • could any of the new functions be marked with inline(always) or must_use?
  • some flows are not covered with unit tests
  • could we implement any proptests for this?
  • missing CHANGELOG

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree with @0xNeshi 💯

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually sw also missing some flows and proptests. Currently tests are enough just to validate implementation. But we will add much more proptests in future.
Added notion in the CHANGELOG

Copy link
Collaborator

@bidzyyys bidzyyys left a comment

Choose a reason for hiding this comment

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

Almost looks good, take care of @0xNeshi comments please.

///
/// * If point is not on curve.
/// * If point is not in the prime-order subgroup.
pub fn new(x: P::BaseField, y: P::BaseField) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agree with @0xNeshi 💯

@qalisander qalisander merged commit 115d4fc into main Jul 17, 2025
25 checks passed
@bidzyyys bidzyyys deleted the openzeppelin-crypto/twisted-edwards-curves branch July 17, 2025 15:42
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.

[Feature]: Twisted Edwards Curves
3 participants