diff --git a/bellman/src/groth16/mod.rs b/bellman/src/groth16/mod.rs index a5d8aa522..2e0d0a559 100644 --- a/bellman/src/groth16/mod.rs +++ b/bellman/src/groth16/mod.rs @@ -400,7 +400,7 @@ impl Parameters { pub struct PreparedVerifyingKey { /// Pairing result of alpha*beta - alpha_g1_beta_g2: E::Fqk, + alpha_g1_beta_g2: E::Gt, /// -gamma in G2 neg_gamma_g2: ::Prepared, /// -delta in G2 diff --git a/bellman/src/groth16/tests/dummy_engine.rs b/bellman/src/groth16/tests/dummy_engine.rs index 948dd0323..8bcb8aa20 100644 --- a/bellman/src/groth16/tests/dummy_engine.rs +++ b/bellman/src/groth16/tests/dummy_engine.rs @@ -335,9 +335,10 @@ impl Engine for DummyEngine { type G2Affine = Fr; // TODO: This should be F_645131 or something. Doesn't matter for now. - type Fqk = Fr; + type MillerLoopResult = Fr; + type Gt = Fr; - fn miller_loop<'a, I>(i: I) -> Self::Fqk + fn miller_loop<'a, I>(i: I) -> Self::MillerLoopResult where I: IntoIterator< Item = &'a ( @@ -358,7 +359,7 @@ impl Engine for DummyEngine { } /// Perform final exponentiation of the result of a miller loop. - fn final_exponentiation(this: &Self::Fqk) -> CtOption { + fn final_exponentiation(this: &Self::MillerLoopResult) -> CtOption { CtOption::new(*this, Choice::from(1)) } } diff --git a/pairing/src/bls12_381/mod.rs b/pairing/src/bls12_381/mod.rs index 20bcd3bd2..c47327062 100644 --- a/pairing/src/bls12_381/mod.rs +++ b/pairing/src/bls12_381/mod.rs @@ -44,9 +44,10 @@ impl Engine for Bls12 { type G1Affine = G1Affine; type G2 = G2; type G2Affine = G2Affine; - type Fqk = Fq12; + type MillerLoopResult = Fq12; + type Gt = Fq12; - fn miller_loop<'a, I>(i: I) -> Self::Fqk + fn miller_loop<'a, I>(i: I) -> Self::MillerLoopResult where I: IntoIterator< Item = &'a ( diff --git a/pairing/src/lib.rs b/pairing/src/lib.rs index d720736f4..4c3ce959b 100644 --- a/pairing/src/lib.rs +++ b/pairing/src/lib.rs @@ -42,7 +42,7 @@ pub trait Engine: ScalarEngine { Scalar = Self::Fr, Projective = Self::G1, Pair = Self::G2Affine, - PairingResult = Self::Fqk, + PairingResult = Self::Gt, > + From + Mul + for<'a> Mul<&'a Self::Fr, Output = Self::G1>; @@ -60,16 +60,19 @@ pub trait Engine: ScalarEngine { Scalar = Self::Fr, Projective = Self::G2, Pair = Self::G1Affine, - PairingResult = Self::Fqk, + PairingResult = Self::Gt, > + From + Mul + for<'a> Mul<&'a Self::Fr, Output = Self::G2>; + /// The type returned by `Engine::miller_loop`. + type MillerLoopResult; + /// The extension field that hosts the target group of the pairing. - type Fqk: Field; + type Gt: Field; /// Perform a miller loop with some number of (G1, G2) pairs. - fn miller_loop<'a, I>(i: I) -> Self::Fqk + fn miller_loop<'a, I>(i: I) -> Self::MillerLoopResult where I: IntoIterator< Item = &'a ( @@ -79,10 +82,10 @@ pub trait Engine: ScalarEngine { >; /// Perform final exponentiation of the result of a miller loop. - fn final_exponentiation(_: &Self::Fqk) -> CtOption; + fn final_exponentiation(_: &Self::MillerLoopResult) -> CtOption; /// Performs a complete pairing operation `(p, q)`. - fn pairing(p: G1, q: G2) -> Self::Fqk + fn pairing(p: G1, q: G2) -> Self::Gt where G1: Into, G2: Into, diff --git a/pairing/src/tests/engine.rs b/pairing/src/tests/engine.rs index 6af1b801c..44111c671 100644 --- a/pairing/src/tests/engine.rs +++ b/pairing/src/tests/engine.rs @@ -30,12 +30,12 @@ pub fn engine_tests() { let d = E::G2::random(&mut rng).to_affine().prepare(); assert_eq!( - E::Fqk::one(), + E::Gt::one(), E::final_exponentiation(&E::miller_loop(&[(&z1, &b)])).unwrap() ); assert_eq!( - E::Fqk::one(), + E::Gt::one(), E::final_exponentiation(&E::miller_loop(&[(&a, &z2)])).unwrap() );