Browse Source

Reduce generics

reduce-generics
Pratyush Mishra 3 years ago
parent
commit
ac58f8f92d
22 changed files with 83 additions and 115 deletions
  1. +3
    -0
      Cargo.toml
  2. +1
    -1
      bls12_377/Cargo.toml
  3. +0
    -2
      bls12_377/src/constraints/curves.rs
  4. +2
    -4
      bls12_377/src/constraints/pairing.rs
  5. +51
    -48
      curve-constraint-tests/src/lib.rs
  6. +2
    -4
      ed_on_bls12_377/src/constraints/curves.rs
  7. +2
    -4
      ed_on_bls12_381/src/constraints/curves.rs
  8. +2
    -4
      ed_on_bls12_381_bandersnatch/src/constraints/curves.rs
  9. +2
    -4
      ed_on_bn254/src/constraints/curves.rs
  10. +2
    -4
      ed_on_cp6_782/src/constraints/curves.rs
  11. +2
    -4
      ed_on_mnt4_298/src/constraints/curves.rs
  12. +2
    -4
      ed_on_mnt4_753/src/constraints/curves.rs
  13. +0
    -2
      mnt4_298/src/constraints/curves.rs
  14. +2
    -4
      mnt4_298/src/constraints/pairing.rs
  15. +0
    -2
      mnt4_753/src/constraints/curves.rs
  16. +2
    -4
      mnt4_753/src/constraints/pairing.rs
  17. +0
    -2
      mnt6_298/src/constraints/curves.rs
  18. +2
    -4
      mnt6_298/src/constraints/pairing.rs
  19. +0
    -2
      mnt6_753/src/constraints/curves.rs
  20. +2
    -4
      mnt6_753/src/constraints/pairing.rs
  21. +2
    -4
      pallas/src/constraints/curves.rs
  22. +2
    -4
      vesta/src/constraints/curves.rs

+ 3
- 0
Cargo.toml

@ -56,3 +56,6 @@ lto = "thin"
incremental = true incremental = true
debug-assertions = true debug-assertions = true
debug = true debug = true
[patch.crates-io]
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std", branch = "reduce-generics", optional = true, default-features = false }

+ 1
- 1
bls12_377/Cargo.toml

@ -31,4 +31,4 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ]
curve = [ "scalar_field", "base_field" ] curve = [ "scalar_field", "base_field" ]
scalar_field = [] scalar_field = []
base_field = [] base_field = []
r1cs = [ "base_field", "ark-r1cs-std" ]
r1cs = [ "base_field", "ark-r1cs-std" ]

+ 0
- 2
bls12_377/src/constraints/curves.rs

@ -18,12 +18,10 @@ fn test() {
use ark_ec::models::bls12::Bls12Parameters; use ark_ec::models::bls12::Bls12Parameters;
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as Bls12Parameters>::G1Parameters, <Parameters as Bls12Parameters>::G1Parameters,
G1Var,
>() >()
.unwrap(); .unwrap();
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as Bls12Parameters>::G2Parameters, <Parameters as Bls12Parameters>::G2Parameters,
G2Var,
>() >()
.unwrap(); .unwrap();
} }

+ 2
- 4
bls12_377/src/constraints/pairing.rs

@ -1,10 +1,8 @@
use crate::Parameters;
/// Specifies the constraints for computing a pairing in the BLS12-377 bilinear group. /// Specifies the constraints for computing a pairing in the BLS12-377 bilinear group.
pub type PairingVar = ark_r1cs_std::pairing::bls12::PairingVar<Parameters>;
pub use crate::Bls12_377;
#[test] #[test]
fn test() { fn test() {
use crate::Bls12_377; use crate::Bls12_377;
ark_curve_constraint_tests::pairing::bilinearity_test::<Bls12_377, PairingVar>().unwrap()
ark_curve_constraint_tests::pairing::bilinearity_test::<Bls12_377>().unwrap()
} }

+ 51
- 48
curve-constraint-tests/src/lib.rs

@ -231,22 +231,20 @@ pub mod fields {
} }
pub mod curves { pub mod curves {
use ark_ec::{
short_weierstrass_jacobian::GroupProjective as SWProjective,
twisted_edwards_extended::GroupProjective as TEProjective, ProjectiveCurve,
};
use ark_ec::{ModelParameters, ProjectiveCurve, short_weierstrass_jacobian::GroupProjective as SWProjective, twisted_edwards_extended::GroupProjective as TEProjective};
use ark_ff::{BitIteratorLE, Field, FpParameters, One, PrimeField}; use ark_ff::{BitIteratorLE, Field, FpParameters, One, PrimeField};
use ark_relations::r1cs::{ConstraintSystem, SynthesisError}; use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
use ark_std::{test_rng, vec::Vec, UniformRand}; use ark_std::{test_rng, vec::Vec, UniformRand};
use ark_r1cs_std::prelude::*; use ark_r1cs_std::prelude::*;
pub fn group_test<C, ConstraintF, GG>() -> Result<(), SynthesisError>
type ConstraintF<P> = <<P as ModelParameters>::BaseField as Field>::BasePrimeField;
pub fn group_test<C, ConstraintF>() -> Result<(), SynthesisError>
where where
C: ProjectiveCurve,
C: CurveWithVar<ConstraintF>,
ConstraintF: Field, ConstraintF: Field,
GG: CurveVar<C, ConstraintF>,
for<'a> &'a GG: GroupOpsBounds<'a, C, GG>,
for<'a> &'a C::Var: GroupOpsBounds<'a, C, C::Var>,
{ {
let modes = [ let modes = [
AllocationMode::Input, AllocationMode::Input,
@ -259,12 +257,12 @@ pub mod curves {
let mut rng = test_rng(); let mut rng = test_rng();
let a_native = C::rand(&mut rng); let a_native = C::rand(&mut rng);
let b_native = C::rand(&mut rng); let b_native = C::rand(&mut rng);
let a = GG::new_variable(ark_relations::ns!(cs, "generate_a"), || Ok(a_native), mode)
let a = C::Var::new_variable(ark_relations::ns!(cs, "generate_a"), || Ok(a_native), mode)
.unwrap(); .unwrap();
let b = GG::new_variable(ark_relations::ns!(cs, "generate_b"), || Ok(b_native), mode)
let b = C::Var::new_variable(ark_relations::ns!(cs, "generate_b"), || Ok(b_native), mode)
.unwrap(); .unwrap();
let zero = GG::zero();
let zero = C::Var::zero();
assert_eq!(zero.value()?, zero.value()?); assert_eq!(zero.value()?, zero.value()?);
// a == a // a == a
@ -380,13 +378,15 @@ pub mod curves {
Ok(()) Ok(())
} }
pub fn sw_test<P, GG>() -> Result<(), SynthesisError>
type SWVar<P> = <SWProjective<P> as CurveWithVar<ConstraintF<P>>>::Var;
pub fn sw_test<P>() -> Result<(), SynthesisError>
where where
P: ark_ec::SWModelParameters, P: ark_ec::SWModelParameters,
GG: CurveVar<SWProjective<P>, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a GG: GroupOpsBounds<'a, SWProjective<P>, GG>,
SWProjective<P>: CurveWithVar<ConstraintF<P>> + ProjectiveCurve,
for<'a> &'a SWVar<P>: GroupOpsBounds<'a, SWProjective<P>, SWVar<P>>,
{ {
group_test::<SWProjective<P>, _, GG>()?;
group_test::<SWProjective<P>, _>()?;
let modes = [ let modes = [
AllocationMode::Input, AllocationMode::Input,
AllocationMode::Witness, AllocationMode::Witness,
@ -405,14 +405,12 @@ pub mod curves {
let b_affine = b.into_affine(); let b_affine = b.into_affine();
let ns = ark_relations::ns!(cs, "allocating variables"); let ns = ark_relations::ns!(cs, "allocating variables");
let mut gadget_a = GG::new_variable(cs.clone(), || Ok(a), mode)?;
let gadget_b = GG::new_variable(cs.clone(), || Ok(b), mode)?;
let zero = GG::zero();
let mut gadget_a = SWVar::<P>::new_variable(cs.clone(), || Ok(a), mode)?;
let gadget_b = SWVar::<P>::new_variable(cs.clone(), || Ok(b), mode)?;
let zero = SWVar::<P>::zero();
drop(ns); drop(ns);
assert_eq!(gadget_a.value()?.into_affine().x, a_affine.x);
assert_eq!(gadget_a.value()?.into_affine().y, a_affine.y);
assert_eq!(gadget_b.value()?.into_affine().x, b_affine.x);
assert_eq!(gadget_b.value()?.into_affine().y, b_affine.y);
assert_eq!(gadget_a.value()?.into_affine(), a_affine);
assert_eq!(gadget_b.value()?.into_affine(), b_affine);
assert_eq!(cs.which_is_unsatisfied().unwrap(), None); assert_eq!(cs.which_is_unsatisfied().unwrap(), None);
// Check addition // Check addition
@ -453,13 +451,15 @@ pub mod curves {
Ok(()) Ok(())
} }
pub fn te_test<P, GG>() -> Result<(), SynthesisError>
type TEVar<P> = <TEProjective<P> as CurveWithVar<ConstraintF<P>>>::Var;
pub fn te_test<P>() -> Result<(), SynthesisError>
where where
P: ark_ec::TEModelParameters, P: ark_ec::TEModelParameters,
GG: CurveVar<TEProjective<P>, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a GG: GroupOpsBounds<'a, TEProjective<P>, GG>,
TEProjective<P>: CurveWithVar<ConstraintF<P>> + ProjectiveCurve,
for<'a> &'a TEVar<P>: GroupOpsBounds<'a, TEProjective<P>, TEVar<P>>,
{ {
group_test::<TEProjective<P>, _, GG>()?;
group_test::<TEProjective<P>, _>()?;
let modes = [ let modes = [
AllocationMode::Input, AllocationMode::Input,
AllocationMode::Witness, AllocationMode::Witness,
@ -478,14 +478,12 @@ pub mod curves {
let b_affine = b.into_affine(); let b_affine = b.into_affine();
let ns = ark_relations::ns!(cs, "allocating variables"); let ns = ark_relations::ns!(cs, "allocating variables");
let mut gadget_a = GG::new_variable(cs.clone(), || Ok(a), mode)?;
let gadget_b = GG::new_variable(cs.clone(), || Ok(b), mode)?;
let mut gadget_a = TEVar::<P>::new_variable(cs.clone(), || Ok(a), mode)?;
let gadget_b = TEVar::<P>::new_variable(cs.clone(), || Ok(b), mode)?;
drop(ns); drop(ns);
assert_eq!(gadget_a.value()?.into_affine().x, a_affine.x);
assert_eq!(gadget_a.value()?.into_affine().y, a_affine.y);
assert_eq!(gadget_b.value()?.into_affine().x, b_affine.x);
assert_eq!(gadget_b.value()?.into_affine().y, b_affine.y);
assert_eq!(gadget_a.value()?.into_affine(), a_affine);
assert_eq!(gadget_b.value()?.into_affine(), b_affine);
assert_eq!(cs.which_is_unsatisfied()?, None); assert_eq!(cs.which_is_unsatisfied()?, None);
// Check addition // Check addition
@ -527,16 +525,21 @@ pub mod curves {
pub mod pairing { pub mod pairing {
use ark_ec::{PairingEngine, ProjectiveCurve}; use ark_ec::{PairingEngine, ProjectiveCurve};
use ark_ff::{BitIteratorLE, Field, PrimeField}; use ark_ff::{BitIteratorLE, Field, PrimeField};
use ark_r1cs_std::prelude::*;
use ark_r1cs_std::{fields::fp::FpVar, prelude::*};
use ark_relations::r1cs::{ConstraintSystem, SynthesisError}; use ark_relations::r1cs::{ConstraintSystem, SynthesisError};
use ark_std::{test_rng, vec::Vec, UniformRand}; use ark_std::{test_rng, vec::Vec, UniformRand};
#[allow(dead_code)] #[allow(dead_code)]
pub fn bilinearity_test<E: PairingEngine, P: PairingVar<E>>() -> Result<(), SynthesisError>
pub fn bilinearity_test<P: PairingGadget>() -> Result<(), SynthesisError>
where where
for<'a> &'a P::G1Var: GroupOpsBounds<'a, E::G1Projective, P::G1Var>,
for<'a> &'a P::G2Var: GroupOpsBounds<'a, E::G2Projective, P::G2Var>,
for<'a> &'a P::GTVar: FieldOpsBounds<'a, E::Fqk, P::GTVar>,
for<'a> &'a P::G1Var: GroupOpsBounds<'a, P::G1Projective, P::G1Var>,
for<'a> &'a P::G2Var: GroupOpsBounds<'a, P::G2Projective, P::G2Var>,
for<'a> &'a P::GTVar: FieldOpsBounds<'a, P::Fqk, P::GTVar>,
P::Fq: FieldWithVar<Var = FpVar<P::Fq>>,
P::Fqe: FieldWithVar,
P::Fqk: FieldWithVar<Var = P::GTVar>,
P::G1Projective: CurveWithVar<P::Fq, Var = P::G1Var>,
P::G2Projective: CurveWithVar<P::Fq, Var = P::G2Var>,
{ {
let modes = [ let modes = [
AllocationMode::Input, AllocationMode::Input,
@ -544,12 +547,12 @@ pub mod pairing {
AllocationMode::Constant, AllocationMode::Constant,
]; ];
for &mode in &modes { for &mode in &modes {
let cs = ConstraintSystem::<E::Fq>::new_ref();
let cs = ConstraintSystem::<P::Fq>::new_ref();
let mut rng = test_rng(); let mut rng = test_rng();
let a = E::G1Projective::rand(&mut rng);
let b = E::G2Projective::rand(&mut rng);
let s = E::Fr::rand(&mut rng);
let a = P::G1Projective::rand(&mut rng);
let b = P::G2Projective::rand(&mut rng);
let s = P::Fr::rand(&mut rng);
let mut sa = a; let mut sa = a;
sa *= s; sa *= s;
@ -571,16 +574,16 @@ pub mod pairing {
let (ans1_g, ans1_n) = { let (ans1_g, ans1_n) = {
let _ml_constraints = cs.num_constraints(); let _ml_constraints = cs.num_constraints();
let ml_g = P::miller_loop(&[sa_prep_g], &[b_prep_g.clone()])?;
let ml_g = <P as PairingGadget>::miller_loop(&[sa_prep_g], &[b_prep_g.clone()])?;
let _fe_constraints = cs.num_constraints(); let _fe_constraints = cs.num_constraints();
let ans_g = P::final_exponentiation(&ml_g)?;
let ans_n = E::pairing(sa, b);
let ans_g = <P as PairingGadget>::final_exponentiation(&ml_g)?;
let ans_n = <P as PairingEngine>::pairing(sa, b);
(ans_g, ans_n) (ans_g, ans_n)
}; };
let (ans2_g, ans2_n) = { let (ans2_g, ans2_n) = {
let ans_g = P::pairing(a_prep_g.clone(), sb_prep_g)?;
let ans_n = E::pairing(a, sb);
let ans_g = <P as PairingGadget>::pairing(a_prep_g.clone(), sb_prep_g)?;
let ans_n = <P as PairingEngine>::pairing(a, sb);
(ans_g, ans_n) (ans_g, ans_n)
}; };
@ -589,8 +592,8 @@ pub mod pairing {
.map(Boolean::constant) .map(Boolean::constant)
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let mut ans_g = P::pairing(a_prep_g, b_prep_g)?;
let mut ans_n = E::pairing(a, b);
let mut ans_g = <P as PairingGadget>::pairing(a_prep_g, b_prep_g)?;
let mut ans_n = <P as PairingEngine>::pairing(a, b);
ans_n = ans_n.pow(s.into_repr()); ans_n = ans_n.pow(s.into_repr());
ans_g = ans_g.pow_le(&s_iter)?; ans_g = ans_g.pow_le(&s_iter)?;

+ 2
- 4
ed_on_bls12_377/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_bls12_381/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<_, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_bls12_381_bandersnatch/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<_, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_bn254/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<_, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_cp6_782/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_mnt4_298/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::fields::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 2
- 4
ed_on_mnt4_753/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar; use ark_r1cs_std::groups::curves::twisted_edwards::AffineVar;
use crate::constraints::fields::FqVar;
/// A variable that is the R1CS equivalent of `crate::EdwardsAffine`. /// A variable that is the R1CS equivalent of `crate::EdwardsAffine`.
pub type EdwardsVar = AffineVar<EdwardsParameters, FqVar>;
pub type EdwardsVar = AffineVar<EdwardsParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters, EdwardsVar>().unwrap();
ark_curve_constraint_tests::curves::te_test::<EdwardsParameters>().unwrap();
} }

+ 0
- 2
mnt4_298/src/constraints/curves.rs

@ -18,12 +18,10 @@ fn test() {
use ark_ec::models::mnt4::MNT4Parameters; use ark_ec::models::mnt4::MNT4Parameters;
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT4Parameters>::G1Parameters, <Parameters as MNT4Parameters>::G1Parameters,
G1Var,
>() >()
.unwrap(); .unwrap();
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT4Parameters>::G2Parameters, <Parameters as MNT4Parameters>::G2Parameters,
G2Var,
>() >()
.unwrap(); .unwrap();
} }

+ 2
- 4
mnt4_298/src/constraints/pairing.rs

@ -1,10 +1,8 @@
use crate::Parameters;
/// Specifies the constraints for computing a pairing in the MNT4-298 bilinear group. /// Specifies the constraints for computing a pairing in the MNT4-298 bilinear group.
pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar<Parameters>;
pub use crate::MNT4_298;
#[test] #[test]
fn test() { fn test() {
use crate::MNT4_298; use crate::MNT4_298;
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT4_298, PairingVar>().unwrap()
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT4_298>().unwrap()
} }

+ 0
- 2
mnt4_753/src/constraints/curves.rs

@ -18,12 +18,10 @@ fn test() {
use ark_ec::models::mnt4::MNT4Parameters; use ark_ec::models::mnt4::MNT4Parameters;
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT4Parameters>::G1Parameters, <Parameters as MNT4Parameters>::G1Parameters,
G1Var,
>() >()
.unwrap(); .unwrap();
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT4Parameters>::G2Parameters, <Parameters as MNT4Parameters>::G2Parameters,
G2Var,
>() >()
.unwrap(); .unwrap();
} }

+ 2
- 4
mnt4_753/src/constraints/pairing.rs

@ -1,10 +1,8 @@
use crate::Parameters;
/// Specifies the constraints for computing a pairing in the MNT4-753 bilinear group. /// Specifies the constraints for computing a pairing in the MNT4-753 bilinear group.
pub type PairingVar = ark_r1cs_std::pairing::mnt4::PairingVar<Parameters>;
pub use crate::MNT4_753;
#[test] #[test]
fn test() { fn test() {
use crate::MNT4_753; use crate::MNT4_753;
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT4_753, PairingVar>().unwrap()
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT4_753>().unwrap()
} }

+ 0
- 2
mnt6_298/src/constraints/curves.rs

@ -18,12 +18,10 @@ fn test() {
use ark_ec::models::mnt6::MNT6Parameters; use ark_ec::models::mnt6::MNT6Parameters;
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT6Parameters>::G1Parameters, <Parameters as MNT6Parameters>::G1Parameters,
G1Var,
>() >()
.unwrap(); .unwrap();
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT6Parameters>::G2Parameters, <Parameters as MNT6Parameters>::G2Parameters,
G2Var,
>() >()
.unwrap(); .unwrap();
} }

+ 2
- 4
mnt6_298/src/constraints/pairing.rs

@ -1,10 +1,8 @@
use crate::Parameters;
/// Specifies the constraints for computing a pairing in the MNT6-298 bilinear group. /// Specifies the constraints for computing a pairing in the MNT6-298 bilinear group.
pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar<Parameters>;
pub use crate::MNT6_298;
#[test] #[test]
fn test() { fn test() {
use crate::MNT6_298; use crate::MNT6_298;
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT6_298, PairingVar>().unwrap()
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT6_298>().unwrap()
} }

+ 0
- 2
mnt6_753/src/constraints/curves.rs

@ -18,12 +18,10 @@ fn test() {
use ark_ec::models::mnt6::MNT6Parameters; use ark_ec::models::mnt6::MNT6Parameters;
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT6Parameters>::G1Parameters, <Parameters as MNT6Parameters>::G1Parameters,
G1Var,
>() >()
.unwrap(); .unwrap();
ark_curve_constraint_tests::curves::sw_test::< ark_curve_constraint_tests::curves::sw_test::<
<Parameters as MNT6Parameters>::G2Parameters, <Parameters as MNT6Parameters>::G2Parameters,
G2Var,
>() >()
.unwrap(); .unwrap();
} }

+ 2
- 4
mnt6_753/src/constraints/pairing.rs

@ -1,10 +1,8 @@
use crate::Parameters;
/// Specifies the constraints for computing a pairing in the MNT6-753 bilinear group. /// Specifies the constraints for computing a pairing in the MNT6-753 bilinear group.
pub type PairingVar = ark_r1cs_std::pairing::mnt6::PairingVar<Parameters>;
pub use crate::MNT6_753;
#[test] #[test]
fn test() { fn test() {
use crate::MNT6_753; use crate::MNT6_753;
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT6_753, PairingVar>().unwrap()
ark_curve_constraint_tests::pairing::bilinearity_test::<MNT6_753>().unwrap()
} }

+ 2
- 4
pallas/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar;
use crate::constraints::FBaseVar;
/// A group element in the Pallas prime-order group. /// A group element in the Pallas prime-order group.
pub type GVar = ProjectiveVar<PallasParameters, FBaseVar>;
pub type GVar = ProjectiveVar<PallasParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::sw_test::<PallasParameters, GVar>().unwrap();
ark_curve_constraint_tests::curves::sw_test::<PallasParameters>().unwrap();
} }

+ 2
- 4
vesta/src/constraints/curves.rs

@ -1,12 +1,10 @@
use crate::*; use crate::*;
use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar; use ark_r1cs_std::groups::curves::short_weierstrass::ProjectiveVar;
use crate::constraints::FBaseVar;
/// A group element in the Vesta prime-order group. /// A group element in the Vesta prime-order group.
pub type GVar = ProjectiveVar<VestaParameters, FBaseVar>;
pub type GVar = ProjectiveVar<VestaParameters>;
#[test] #[test]
fn test() { fn test() {
ark_curve_constraint_tests::curves::sw_test::<VestaParameters, GVar>().unwrap();
ark_curve_constraint_tests::curves::sw_test::<VestaParameters>().unwrap();
} }

Loading…
Cancel
Save