Skip to content

Commit

Permalink
Add simple curve cycle trait for curve cycles (#190)
Browse files Browse the repository at this point in the history
Co-authored-by: Pratyush Mishra <[email protected]>
  • Loading branch information
drewstone and Pratyush committed Feb 4, 2021
1 parent 5ba15de commit 26707c3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The main features of this release are:
- Small speedups to MSMs
- Big speedups to radix-2 FFTs
- Fix in the assembly arithmetic backend
- Adding new traits for basic curve cycles and pairing based curve cycles

### Breaking changes
- #20 (ark-poly) Move univariate DensePolynomial and SparsePolynomial into a
Expand Down Expand Up @@ -80,6 +81,7 @@ The main features of this release are:
- #169 (ark-poly) Improve radix-2 FFTs by moving to a faster algorithm by Riad S. Wahby.
- #171, #173, #176 (ark-poly) Apply significant further speedups to the new radix-2 FFT.
- #188 (ark-ec) Make Short Weierstrass random sampling result in an element with unknown discrete log
- #190 (ark-ec) Add curve cycle trait and extended pairing cycle trait for all types of ec cycles.

### Bug fixes
- #36 (ark-ec) In Short-Weierstrass curves, include an infinity bit in `ToConstraintField`.
Expand Down
29 changes: 29 additions & 0 deletions ec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ pub fn prepare_g2<E: PairingEngine>(g: impl Into<E::G2Affine>) -> E::G2Prepared
}

/// A cycle of pairing-friendly elliptic curves.
#[deprecated(note = "Please use `PairingFriendlyCycle` instead")]
pub trait CycleEngine: Sized + 'static + Copy + Debug + Sync + Send
where
<Self::E2 as PairingEngine>::G1Projective: MulAssign<<Self::E1 as PairingEngine>::Fq>,
Expand All @@ -324,3 +325,31 @@ where
Fq = <Self::E1 as PairingEngine>::Fr,
>;
}

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>,
{
type E1: AffineCurve<
BaseField = <Self::E2 as AffineCurve>::ScalarField,
ScalarField = <Self::E2 as AffineCurve>::BaseField,
>;
type E2: AffineCurve;
}

pub trait PairingFriendlyCycle: CurveCycle {
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,
>;
}

0 comments on commit 26707c3

Please sign in to comment.