Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion src/groth16/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/groth16/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/groth16/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
12 changes: 5 additions & 7 deletions src/groth16/tests/dummy_engine.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -436,7 +434,7 @@ impl AsRef<[u8]> for FakePoint {
}
}

impl PrimeCurveAffine for Fr {
impl CurveAffine for Fr {
type Curve = Fr;
type Scalar = Fr;

Expand Down
2 changes: 1 addition & 1 deletion src/groth16/verifier.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use group::{prime::PrimeCurveAffine, Curve};
use group::{Curve, CurveAffine};
use pairing::{MillerLoopResult, MultiMillerLoop};
use std::ops::{AddAssign, Neg};

Expand Down
10 changes: 5 additions & 5 deletions src/multiexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ pub trait Source<G: PrimeCurveAffine> {

pub trait AddAssignFromSource: PrimeCurve {
/// Parses the element from the source. Fails if the point is at infinity.
fn add_assign_from_source<S: Source<<Self as PrimeCurve>::Affine>>(
fn add_assign_from_source<S: Source<Self::Affine>>(
&mut self,
source: &mut S,
) -> Result<(), SynthesisError> {
AddAssign::<&<Self as PrimeCurve>::Affine>::add_assign(self, source.next()?);
AddAssign::<&Self::Affine>::add_assign(self, source.next()?);
Ok(())
}
}
Expand Down Expand Up @@ -218,7 +218,7 @@ where
D: Send + Sync + 'static + Clone + AsRef<Q>,
G: PrimeCurve,
G::Scalar: PrimeFieldBits,
S: SourceBuilder<<G as PrimeCurve>::Affine>,
S: SourceBuilder<G::Affine>,
{
// Perform this region of the multiexp
let this = move |bases: S,
Expand Down Expand Up @@ -313,7 +313,7 @@ where
D: Send + Sync + 'static + Clone + AsRef<Q>,
G: PrimeCurve,
G::Scalar: PrimeFieldBits,
S: SourceBuilder<<G as PrimeCurve>::Affine>,
S: SourceBuilder<G::Affine>,
{
let c = if exponents.len() < 32 {
3u32
Expand All @@ -335,7 +335,7 @@ where
#[test]
fn test_with_bls12() {
fn naive_multiexp<G: PrimeCurve>(
bases: Arc<Vec<<G as PrimeCurve>::Affine>>,
bases: Arc<Vec<G::Affine>>,
exponents: Arc<Vec<G::Scalar>>,
) -> G {
assert_eq!(bases.len(), exponents.len());
Expand Down