Skip to content

Add affine_xy, affine_x, affine_y functions to CurveVar#190

Merged
Pratyush merged 7 commits intoarkworks-rs:masterfrom
dongwook1214:master
Mar 2, 2026
Merged

Add affine_xy, affine_x, affine_y functions to CurveVar#190
Pratyush merged 7 commits intoarkworks-rs:masterfrom
dongwook1214:master

Conversation

@dongwook1214
Copy link
Contributor

@dongwook1214 dongwook1214 commented Oct 1, 2025

Description

I've added affine_x, affine_y, and affine_xy methods to the CurveVar trait. To support this, the CurveVar trait was modified to take a generic type F: FieldVar<C::BaseField, ConstraintF>. Consequently, pairing-related Var have been updated.

In the implementation, AffineVar simply returns self.x and self.y. For ProjectiveVar, it first calls to_affine() and then returns the x and y coordinates.

closes: #189


  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@dongwook1214 dongwook1214 requested a review from a team as a code owner October 1, 2025 10:05
@dongwook1214 dongwook1214 requested review from Pratyush, weikengchen and z-tech and removed request for a team October 1, 2025 10:05
/// A variable that represents a curve point for
/// the curve `C`.
pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField>:
pub trait CurveVar<C: CurveGroup, ConstraintF: PrimeField, F: FieldVar<C::BaseField, ConstraintF>>:
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to add this as an associated type, as it would avoid updating every usage of CurveVar.

@dongwook1214 dongwook1214 requested a review from Pratyush October 2, 2025 14:21
+ for<'a> Mul<&'a EmulatedFpVar<C::ScalarField, ConstraintF>, Output = Self>
+ MulAssign<EmulatedFpVar<C::ScalarField, ConstraintF>>
{
type F: FieldVar<C::BaseField, ConstraintF>;
Copy link
Member

Choose a reason for hiding this comment

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

Can you please rename this to BaseFieldVar?

@dongwook1214 dongwook1214 requested a review from Pratyush October 3, 2025 00:12
@dongwook1214
Copy link
Contributor Author

Hi @Pratyush , I'm just checking in on this PR as it's been a while since the last update. I'm still very interested in getting this merged. Please let me know if there's anything else you'd like me to address. Thanks!

@Pratyush Pratyush enabled auto-merge December 30, 2025 13:37
@Pratyush Pratyush added this pull request to the merge queue Mar 2, 2026
Merged via the queue into arkworks-rs:master with commit 45e4e26 Mar 2, 2026
11 checks passed
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.

Add affine_xy, affine_x, affine_y functions to CurveVar

3 participants