-
Notifications
You must be signed in to change notification settings - Fork 245
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
Add simple curve cycle trait for curve cycles #190
Conversation
Ngl I just wanna contribute to this awesome project. I am still wearing my training wheels when looking around. Let me know if this isn't the right place or implementation for something like this. I have yet to see a PCD or cycle engine defined for non-pairing based curves so I figured there ought to be one. |
Looks good. Can you impl this for Pallas and Vesta? |
This makes me think we need to have a pub trait CurveCycle
where
<Self::E1 as AffineCurve>::Projective: MulAssign<<Self::E2 as AffineCurve>::BaseField>,
<Self::E2 as AffineCurve>::Projective: MulAssign<<Self::E1 as AffineCurve>::BaseField>,
{
// Maybe these constraints are too tight and could cause rust's constraint solver
// error out due to cycles (heh); we remove the
// bounds on the associated types if that's the case.
type E1: AffineCurve<
BaseField = <Self::E2 as AffineCurve>::ScalarField,
ScalarField = <Self::E2 as AffineCurve>::BaseField,
>;
type E2: AffineCurve<
BaseField = <Self::E1 as AffineCurve>::ScalarField,
ScalarField = <Self::E1 as AffineCurve>::BaseField,
>;
}
pub trait PairingFriendlyCycle: CurveCycle {
// add whatever extra bounds are necessary.
type Engine1: PairingEngine<
G1Affine = Self::E1,
G1Projective = <Self::E1 as AffineCurve>::Projective,
Fq = <Self::E1 as AffineCurve>::BaseField,
Fr = <Self::E1 as AffineCurve>::ScalarField,
>;
type Engine2: PairingEngine<
G2Affine = Self::E2,
G2Projective = <Self::E2 as AffineCurve>::Projective,
Fq = <Self::E2 as AffineCurve>::BaseField,
Fr = <Self::E2 as AffineCurve>::ScalarField,
>;
} |
@daira where's the right place to implement that.. should be as simple as this right?
And that seems more robust @Pratyush, happy to add that. Ideally any change is backwards compatible but otherwise would require updating the downstream dependencies. |
I've updated the trait with your feedback @Pratyush. Getting rid of the strict def on |
Co-authored-by: Pratyush Mishra <[email protected]>
Thanks for the PR! could you add a relevant entry in CHANGELOG.md under |
All set @Pratyush |
Description
The purpose of this PR is to define a trait for standard (potentially non-pairing based) and pairing based curve cycles.
Pending
section inCHANGELOG.md
No unit tests as this is just new trait def.