-
Notifications
You must be signed in to change notification settings - Fork 99
Add affine_xy, affine_x, affine_y functions to CurveVar #190
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
base: master
Are you sure you want to change the base?
Conversation
src/groups/mod.rs
Outdated
| /// 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>>: |
There was a problem hiding this comment.
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.
src/groups/mod.rs
Outdated
| + for<'a> Mul<&'a EmulatedFpVar<C::ScalarField, ConstraintF>, Output = Self> | ||
| + MulAssign<EmulatedFpVar<C::ScalarField, ConstraintF>> | ||
| { | ||
| type F: FieldVar<C::BaseField, ConstraintF>; |
There was a problem hiding this comment.
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?
|
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! |
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
Pendingsection inCHANGELOG.mdFiles changedin the Github PR explorer