Skip to content

Conversation

dongwook1214
Copy link

@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 z-tech, Pratyush and weikengchen 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
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
2 participants