11use ark_ec:: mnt4:: {
22 g2:: { AteAdditionCoefficients , AteDoubleCoefficients } ,
3- G1Prepared , G2Prepared , MNT4Parameters ,
3+ G1Prepared , G2Prepared , MNT4Config ,
44} ;
55use ark_ff:: Field ;
66use ark_relations:: r1cs:: { Namespace , SynthesisError } ;
@@ -15,17 +15,16 @@ use crate::{
1515use core:: borrow:: Borrow ;
1616
1717/// Represents a projective point in G1.
18- pub type G1Var < P > =
19- ProjectiveVar < <P as MNT4Parameters >:: G1Parameters , FpVar < <P as MNT4Parameters >:: Fp > > ;
18+ pub type G1Var < P > = ProjectiveVar < <P as MNT4Config >:: G1Config , FpVar < <P as MNT4Config >:: Fp > > ;
2019
2120/// Represents a projective point in G2.
22- pub type G2Var < P > = ProjectiveVar < <P as MNT4Parameters >:: G2Parameters , Fp2G < P > > ;
21+ pub type G2Var < P > = ProjectiveVar < <P as MNT4Config >:: G2Config , Fp2G < P > > ;
2322
2423/// Represents the cached precomputation that can be performed on a G1 element
2524/// which enables speeding up pairing computation.
2625#[ derive( Derivative ) ]
27- #[ derivative( Clone ( bound = "P: MNT4Parameters " ) , Debug ( bound = "P: MNT4Parameters " ) ) ]
28- pub struct G1PreparedVar < P : MNT4Parameters > {
26+ #[ derivative( Clone ( bound = "P: MNT4Config " ) , Debug ( bound = "P: MNT4Config " ) ) ]
27+ pub struct G1PreparedVar < P : MNT4Config > {
2928 #[ doc( hidden) ]
3029 pub x : FpVar < P :: Fp > ,
3130 #[ doc( hidden) ]
@@ -36,7 +35,7 @@ pub struct G1PreparedVar<P: MNT4Parameters> {
3635 pub y_twist : Fp2Var < P :: Fp2Config > ,
3736}
3837
39- impl < P : MNT4Parameters > AllocVar < G1Prepared < P > , P :: Fp > for G1PreparedVar < P > {
38+ impl < P : MNT4Config > AllocVar < G1Prepared < P > , P :: Fp > for G1PreparedVar < P > {
4039 #[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
4140 fn new_variable < T : Borrow < G1Prepared < P > > > (
4241 cs : impl Into < Namespace < P :: Fp > > ,
@@ -69,7 +68,7 @@ impl<P: MNT4Parameters> AllocVar<G1Prepared<P>, P::Fp> for G1PreparedVar<P> {
6968 }
7069}
7170
72- impl < P : MNT4Parameters > G1PreparedVar < P > {
71+ impl < P : MNT4Config > G1PreparedVar < P > {
7372 /// Returns the value assigned to `self` in the underlying constraint
7473 /// system.
7574 pub fn value ( & self ) -> Result < G1Prepared < P > , SynthesisError > {
@@ -102,7 +101,7 @@ impl<P: MNT4Parameters> G1PreparedVar<P> {
102101 }
103102}
104103
105- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for G1PreparedVar < P > {
104+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for G1PreparedVar < P > {
106105 #[ inline]
107106 #[ tracing:: instrument( target = "r1cs" ) ]
108107 fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -131,13 +130,13 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for G1PreparedVar<P> {
131130 }
132131}
133132
134- type Fp2G < P > = Fp2Var < <P as MNT4Parameters >:: Fp2Config > ;
133+ type Fp2G < P > = Fp2Var < <P as MNT4Config >:: Fp2Config > ;
135134
136135/// Represents the cached precomputation that can be performed on a G2 element
137136/// which enables speeding up pairing computation.
138137#[ derive( Derivative ) ]
139- #[ derivative( Clone ( bound = "P: MNT4Parameters " ) , Debug ( bound = "P: MNT4Parameters " ) ) ]
140- pub struct G2PreparedVar < P : MNT4Parameters > {
138+ #[ derivative( Clone ( bound = "P: MNT4Config " ) , Debug ( bound = "P: MNT4Config " ) ) ]
139+ pub struct G2PreparedVar < P : MNT4Config > {
141140 #[ doc( hidden) ]
142141 pub x : Fp2Var < P :: Fp2Config > ,
143142 #[ doc( hidden) ]
@@ -152,7 +151,7 @@ pub struct G2PreparedVar<P: MNT4Parameters> {
152151 pub addition_coefficients : Vec < AteAdditionCoefficientsVar < P > > ,
153152}
154153
155- impl < P : MNT4Parameters > AllocVar < G2Prepared < P > , P :: Fp > for G2PreparedVar < P > {
154+ impl < P : MNT4Config > AllocVar < G2Prepared < P > , P :: Fp > for G2PreparedVar < P > {
156155 #[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
157156 fn new_variable < T : Borrow < G2Prepared < P > > > (
158157 cs : impl Into < Namespace < P :: Fp > > ,
@@ -198,7 +197,7 @@ impl<P: MNT4Parameters> AllocVar<G2Prepared<P>, P::Fp> for G2PreparedVar<P> {
198197 }
199198}
200199
201- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for G2PreparedVar < P > {
200+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for G2PreparedVar < P > {
202201 #[ inline]
203202 #[ tracing:: instrument( target = "r1cs" ) ]
204203 fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -241,7 +240,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for G2PreparedVar<P> {
241240 }
242241}
243242
244- impl < P : MNT4Parameters > G2PreparedVar < P > {
243+ impl < P : MNT4Config > G2PreparedVar < P > {
245244 /// Returns the value assigned to `self` in the underlying constraint
246245 /// system.
247246 pub fn value ( & self ) -> Result < G2Prepared < P > , SynthesisError > {
@@ -341,15 +340,15 @@ impl<P: MNT4Parameters> G2PreparedVar<P> {
341340
342341#[ doc( hidden) ]
343342#[ derive( Derivative ) ]
344- #[ derivative( Clone ( bound = "P: MNT4Parameters " ) , Debug ( bound = "P: MNT4Parameters " ) ) ]
345- pub struct AteDoubleCoefficientsVar < P : MNT4Parameters > {
343+ #[ derivative( Clone ( bound = "P: MNT4Config " ) , Debug ( bound = "P: MNT4Config " ) ) ]
344+ pub struct AteDoubleCoefficientsVar < P : MNT4Config > {
346345 pub c_h : Fp2Var < P :: Fp2Config > ,
347346 pub c_4c : Fp2Var < P :: Fp2Config > ,
348347 pub c_j : Fp2Var < P :: Fp2Config > ,
349348 pub c_l : Fp2Var < P :: Fp2Config > ,
350349}
351350
352- impl < P : MNT4Parameters > AllocVar < AteDoubleCoefficients < P > , P :: Fp > for AteDoubleCoefficientsVar < P > {
351+ impl < P : MNT4Config > AllocVar < AteDoubleCoefficients < P > , P :: Fp > for AteDoubleCoefficientsVar < P > {
353352 #[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
354353 fn new_variable < T : Borrow < AteDoubleCoefficients < P > > > (
355354 cs : impl Into < Namespace < P :: Fp > > ,
@@ -376,7 +375,7 @@ impl<P: MNT4Parameters> AllocVar<AteDoubleCoefficients<P>, P::Fp> for AteDoubleC
376375 }
377376}
378377
379- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for AteDoubleCoefficientsVar < P > {
378+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for AteDoubleCoefficientsVar < P > {
380379 #[ inline]
381380 #[ tracing:: instrument( target = "r1cs" ) ]
382381 fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -405,7 +404,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for AteDoubleCoefficientsVar<P> {
405404 }
406405}
407406
408- impl < P : MNT4Parameters > AteDoubleCoefficientsVar < P > {
407+ impl < P : MNT4Config > AteDoubleCoefficientsVar < P > {
409408 /// Returns the value assigned to `self` in the underlying constraint
410409 /// system.
411410 pub fn value ( & self ) -> Result < AteDoubleCoefficients < P > , SynthesisError > {
@@ -426,15 +425,13 @@ impl<P: MNT4Parameters> AteDoubleCoefficientsVar<P> {
426425
427426#[ doc( hidden) ]
428427#[ derive( Derivative ) ]
429- #[ derivative( Clone ( bound = "P: MNT4Parameters " ) , Debug ( bound = "P: MNT4Parameters " ) ) ]
430- pub struct AteAdditionCoefficientsVar < P : MNT4Parameters > {
428+ #[ derivative( Clone ( bound = "P: MNT4Config " ) , Debug ( bound = "P: MNT4Config " ) ) ]
429+ pub struct AteAdditionCoefficientsVar < P : MNT4Config > {
431430 pub c_l1 : Fp2Var < P :: Fp2Config > ,
432431 pub c_rz : Fp2Var < P :: Fp2Config > ,
433432}
434433
435- impl < P : MNT4Parameters > AllocVar < AteAdditionCoefficients < P > , P :: Fp >
436- for AteAdditionCoefficientsVar < P >
437- {
434+ impl < P : MNT4Config > AllocVar < AteAdditionCoefficients < P > , P :: Fp > for AteAdditionCoefficientsVar < P > {
438435 #[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
439436 fn new_variable < T : Borrow < AteAdditionCoefficients < P > > > (
440437 cs : impl Into < Namespace < P :: Fp > > ,
@@ -455,7 +452,7 @@ impl<P: MNT4Parameters> AllocVar<AteAdditionCoefficients<P>, P::Fp>
455452 }
456453}
457454
458- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for AteAdditionCoefficientsVar < P > {
455+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for AteAdditionCoefficientsVar < P > {
459456 #[ inline]
460457 #[ tracing:: instrument( target = "r1cs" ) ]
461458 fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -476,7 +473,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for AteAdditionCoefficientsVar<P> {
476473 }
477474}
478475
479- impl < P : MNT4Parameters > AteAdditionCoefficientsVar < P > {
476+ impl < P : MNT4Config > AteAdditionCoefficientsVar < P > {
480477 /// Returns the value assigned to `self` in the underlying constraint
481478 /// system.
482479 pub fn value ( & self ) -> Result < AteAdditionCoefficients < P > , SynthesisError > {
@@ -486,7 +483,7 @@ impl<P: MNT4Parameters> AteAdditionCoefficientsVar<P> {
486483}
487484
488485#[ doc( hidden) ]
489- pub struct G2ProjectiveExtendedVar < P : MNT4Parameters > {
486+ pub struct G2ProjectiveExtendedVar < P : MNT4Config > {
490487 pub x : Fp2Var < P :: Fp2Config > ,
491488 pub y : Fp2Var < P :: Fp2Config > ,
492489 pub z : Fp2Var < P :: Fp2Config > ,
0 commit comments