diff --git a/Cargo.toml b/Cargo.toml index 770f5ab6..b8de6c0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,3 +58,7 @@ harness = false [badges] maintenance = { status = "actively-developed" } + +[patch.crates-io] +bls12_381 = { git = "https://github.com/zkcrypto/bls12_381.git", rev = "3d96155c306f6e3febfcb06c9b7754433458f7b5" } +group = { git = "https://github.com/zkcrypto/group.git", rev = "85c484fff517135cedfe265ef893bd4b8d745300" } diff --git a/src/groth16/generator.rs b/src/groth16/generator.rs index dc9ab42d..727febc0 100644 --- a/src/groth16/generator.rs +++ b/src/groth16/generator.rs @@ -3,7 +3,7 @@ use std::ops::{AddAssign, MulAssign}; use std::sync::Arc; use ff::{Field, PrimeField}; -use group::{prime::PrimeCurveAffine, Curve, Group, Wnaf, WnafGroup}; +use group::{Curve, CurveAffine, Group, Wnaf, WnafGroup}; use pairing::Engine; use super::{Parameters, VerifyingKey}; diff --git a/src/groth16/mod.rs b/src/groth16/mod.rs index b0e20887..82d1ef1d 100644 --- a/src/groth16/mod.rs +++ b/src/groth16/mod.rs @@ -2,7 +2,7 @@ //! //! [Groth16]: https://eprint.iacr.org/2016/260 -use group::{prime::PrimeCurveAffine, GroupEncoding, UncompressedEncoding}; +use group::{CurveAffine, GroupEncoding, UncompressedEncoding}; use pairing::{Engine, MultiMillerLoop}; use crate::SynthesisError; diff --git a/src/groth16/prover.rs b/src/groth16/prover.rs index 78061387..2c91050f 100644 --- a/src/groth16/prover.rs +++ b/src/groth16/prover.rs @@ -3,7 +3,7 @@ use std::ops::{AddAssign, MulAssign}; use std::sync::Arc; use ff::{Field, PrimeField, PrimeFieldBits}; -use group::{prime::PrimeCurveAffine, Curve}; +use group::{Curve, CurveAffine}; use pairing::Engine; use super::{ParameterSource, Proof}; diff --git a/src/groth16/tests/dummy_engine.rs b/src/groth16/tests/dummy_engine.rs index e266c2e2..3161312e 100644 --- a/src/groth16/tests/dummy_engine.rs +++ b/src/groth16/tests/dummy_engine.rs @@ -1,7 +1,7 @@ use ff::{Field, FieldBits, PrimeField, PrimeFieldBits}; use group::{ - prime::{PrimeCurve, PrimeCurveAffine, PrimeGroup}, - Curve, Group, GroupEncoding, UncompressedEncoding, WnafGroup, + prime::{PrimeCurve, PrimeGroup}, + Curve, CurveAffine, Group, GroupEncoding, UncompressedEncoding, WnafGroup, }; use pairing::{Engine, MillerLoopResult, MultiMillerLoop, PairingCurveAffine}; @@ -404,7 +404,7 @@ impl Group for Fr { impl PrimeGroup for Fr {} impl Curve for Fr { - type AffineRepr = Fr; + type Affine = Fr; fn to_affine(&self) -> Fr { *self @@ -417,9 +417,7 @@ impl WnafGroup for Fr { } } -impl PrimeCurve for Fr { - type Affine = Fr; -} +impl PrimeCurve for Fr {} #[derive(Copy, Clone, Default)] pub struct FakePoint; @@ -436,7 +434,7 @@ impl AsRef<[u8]> for FakePoint { } } -impl PrimeCurveAffine for Fr { +impl CurveAffine for Fr { type Curve = Fr; type Scalar = Fr; diff --git a/src/groth16/verifier.rs b/src/groth16/verifier.rs index 607eb70f..df1d5311 100644 --- a/src/groth16/verifier.rs +++ b/src/groth16/verifier.rs @@ -1,4 +1,4 @@ -use group::{prime::PrimeCurveAffine, Curve}; +use group::{Curve, CurveAffine}; use pairing::{MillerLoopResult, MultiMillerLoop}; use std::ops::{AddAssign, Neg}; diff --git a/src/multiexp.rs b/src/multiexp.rs index dca0fc10..dbc331dd 100644 --- a/src/multiexp.rs +++ b/src/multiexp.rs @@ -32,11 +32,11 @@ pub trait Source { pub trait AddAssignFromSource: PrimeCurve { /// Parses the element from the source. Fails if the point is at infinity. - fn add_assign_from_source::Affine>>( + fn add_assign_from_source>( &mut self, source: &mut S, ) -> Result<(), SynthesisError> { - AddAssign::<&::Affine>::add_assign(self, source.next()?); + AddAssign::<&Self::Affine>::add_assign(self, source.next()?); Ok(()) } } @@ -218,7 +218,7 @@ where D: Send + Sync + 'static + Clone + AsRef, G: PrimeCurve, G::Scalar: PrimeFieldBits, - S: SourceBuilder<::Affine>, + S: SourceBuilder, { // Perform this region of the multiexp let this = move |bases: S, @@ -313,7 +313,7 @@ where D: Send + Sync + 'static + Clone + AsRef, G: PrimeCurve, G::Scalar: PrimeFieldBits, - S: SourceBuilder<::Affine>, + S: SourceBuilder, { let c = if exponents.len() < 32 { 3u32 @@ -335,7 +335,7 @@ where #[test] fn test_with_bls12() { fn naive_multiexp( - bases: Arc::Affine>>, + bases: Arc>, exponents: Arc>, ) -> G { assert_eq!(bases.len(), exponents.len());