1
1
use ark_ec:: mnt4:: {
2
2
g2:: { AteAdditionCoefficients , AteDoubleCoefficients } ,
3
- G1Prepared , G2Prepared , MNT4Parameters ,
3
+ G1Prepared , G2Prepared , MNT4Config ,
4
4
} ;
5
5
use ark_ff:: Field ;
6
6
use ark_relations:: r1cs:: { Namespace , SynthesisError } ;
@@ -15,17 +15,16 @@ use crate::{
15
15
use core:: borrow:: Borrow ;
16
16
17
17
/// 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 > > ;
20
19
21
20
/// 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 > > ;
23
22
24
23
/// Represents the cached precomputation that can be performed on a G1 element
25
24
/// which enables speeding up pairing computation.
26
25
#[ 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 > {
29
28
#[ doc( hidden) ]
30
29
pub x : FpVar < P :: Fp > ,
31
30
#[ doc( hidden) ]
@@ -36,7 +35,7 @@ pub struct G1PreparedVar<P: MNT4Parameters> {
36
35
pub y_twist : Fp2Var < P :: Fp2Config > ,
37
36
}
38
37
39
- impl < P : MNT4Parameters > AllocVar < G1Prepared < P > , P :: Fp > for G1PreparedVar < P > {
38
+ impl < P : MNT4Config > AllocVar < G1Prepared < P > , P :: Fp > for G1PreparedVar < P > {
40
39
#[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
41
40
fn new_variable < T : Borrow < G1Prepared < P > > > (
42
41
cs : impl Into < Namespace < P :: Fp > > ,
@@ -69,7 +68,7 @@ impl<P: MNT4Parameters> AllocVar<G1Prepared<P>, P::Fp> for G1PreparedVar<P> {
69
68
}
70
69
}
71
70
72
- impl < P : MNT4Parameters > G1PreparedVar < P > {
71
+ impl < P : MNT4Config > G1PreparedVar < P > {
73
72
/// Returns the value assigned to `self` in the underlying constraint
74
73
/// system.
75
74
pub fn value ( & self ) -> Result < G1Prepared < P > , SynthesisError > {
@@ -102,7 +101,7 @@ impl<P: MNT4Parameters> G1PreparedVar<P> {
102
101
}
103
102
}
104
103
105
- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for G1PreparedVar < P > {
104
+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for G1PreparedVar < P > {
106
105
#[ inline]
107
106
#[ tracing:: instrument( target = "r1cs" ) ]
108
107
fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -131,13 +130,13 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for G1PreparedVar<P> {
131
130
}
132
131
}
133
132
134
- type Fp2G < P > = Fp2Var < <P as MNT4Parameters >:: Fp2Config > ;
133
+ type Fp2G < P > = Fp2Var < <P as MNT4Config >:: Fp2Config > ;
135
134
136
135
/// Represents the cached precomputation that can be performed on a G2 element
137
136
/// which enables speeding up pairing computation.
138
137
#[ 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 > {
141
140
#[ doc( hidden) ]
142
141
pub x : Fp2Var < P :: Fp2Config > ,
143
142
#[ doc( hidden) ]
@@ -152,7 +151,7 @@ pub struct G2PreparedVar<P: MNT4Parameters> {
152
151
pub addition_coefficients : Vec < AteAdditionCoefficientsVar < P > > ,
153
152
}
154
153
155
- impl < P : MNT4Parameters > AllocVar < G2Prepared < P > , P :: Fp > for G2PreparedVar < P > {
154
+ impl < P : MNT4Config > AllocVar < G2Prepared < P > , P :: Fp > for G2PreparedVar < P > {
156
155
#[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
157
156
fn new_variable < T : Borrow < G2Prepared < P > > > (
158
157
cs : impl Into < Namespace < P :: Fp > > ,
@@ -198,7 +197,7 @@ impl<P: MNT4Parameters> AllocVar<G2Prepared<P>, P::Fp> for G2PreparedVar<P> {
198
197
}
199
198
}
200
199
201
- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for G2PreparedVar < P > {
200
+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for G2PreparedVar < P > {
202
201
#[ inline]
203
202
#[ tracing:: instrument( target = "r1cs" ) ]
204
203
fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -241,7 +240,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for G2PreparedVar<P> {
241
240
}
242
241
}
243
242
244
- impl < P : MNT4Parameters > G2PreparedVar < P > {
243
+ impl < P : MNT4Config > G2PreparedVar < P > {
245
244
/// Returns the value assigned to `self` in the underlying constraint
246
245
/// system.
247
246
pub fn value ( & self ) -> Result < G2Prepared < P > , SynthesisError > {
@@ -341,15 +340,15 @@ impl<P: MNT4Parameters> G2PreparedVar<P> {
341
340
342
341
#[ doc( hidden) ]
343
342
#[ 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 > {
346
345
pub c_h : Fp2Var < P :: Fp2Config > ,
347
346
pub c_4c : Fp2Var < P :: Fp2Config > ,
348
347
pub c_j : Fp2Var < P :: Fp2Config > ,
349
348
pub c_l : Fp2Var < P :: Fp2Config > ,
350
349
}
351
350
352
- impl < P : MNT4Parameters > AllocVar < AteDoubleCoefficients < P > , P :: Fp > for AteDoubleCoefficientsVar < P > {
351
+ impl < P : MNT4Config > AllocVar < AteDoubleCoefficients < P > , P :: Fp > for AteDoubleCoefficientsVar < P > {
353
352
#[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
354
353
fn new_variable < T : Borrow < AteDoubleCoefficients < P > > > (
355
354
cs : impl Into < Namespace < P :: Fp > > ,
@@ -376,7 +375,7 @@ impl<P: MNT4Parameters> AllocVar<AteDoubleCoefficients<P>, P::Fp> for AteDoubleC
376
375
}
377
376
}
378
377
379
- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for AteDoubleCoefficientsVar < P > {
378
+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for AteDoubleCoefficientsVar < P > {
380
379
#[ inline]
381
380
#[ tracing:: instrument( target = "r1cs" ) ]
382
381
fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -405,7 +404,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for AteDoubleCoefficientsVar<P> {
405
404
}
406
405
}
407
406
408
- impl < P : MNT4Parameters > AteDoubleCoefficientsVar < P > {
407
+ impl < P : MNT4Config > AteDoubleCoefficientsVar < P > {
409
408
/// Returns the value assigned to `self` in the underlying constraint
410
409
/// system.
411
410
pub fn value ( & self ) -> Result < AteDoubleCoefficients < P > , SynthesisError > {
@@ -426,15 +425,13 @@ impl<P: MNT4Parameters> AteDoubleCoefficientsVar<P> {
426
425
427
426
#[ doc( hidden) ]
428
427
#[ 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 > {
431
430
pub c_l1 : Fp2Var < P :: Fp2Config > ,
432
431
pub c_rz : Fp2Var < P :: Fp2Config > ,
433
432
}
434
433
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 > {
438
435
#[ tracing:: instrument( target = "r1cs" , skip( cs, f) ) ]
439
436
fn new_variable < T : Borrow < AteAdditionCoefficients < P > > > (
440
437
cs : impl Into < Namespace < P :: Fp > > ,
@@ -455,7 +452,7 @@ impl<P: MNT4Parameters> AllocVar<AteAdditionCoefficients<P>, P::Fp>
455
452
}
456
453
}
457
454
458
- impl < P : MNT4Parameters > ToBytesGadget < P :: Fp > for AteAdditionCoefficientsVar < P > {
455
+ impl < P : MNT4Config > ToBytesGadget < P :: Fp > for AteAdditionCoefficientsVar < P > {
459
456
#[ inline]
460
457
#[ tracing:: instrument( target = "r1cs" ) ]
461
458
fn to_bytes ( & self ) -> Result < Vec < UInt8 < P :: Fp > > , SynthesisError > {
@@ -476,7 +473,7 @@ impl<P: MNT4Parameters> ToBytesGadget<P::Fp> for AteAdditionCoefficientsVar<P> {
476
473
}
477
474
}
478
475
479
- impl < P : MNT4Parameters > AteAdditionCoefficientsVar < P > {
476
+ impl < P : MNT4Config > AteAdditionCoefficientsVar < P > {
480
477
/// Returns the value assigned to `self` in the underlying constraint
481
478
/// system.
482
479
pub fn value ( & self ) -> Result < AteAdditionCoefficients < P > , SynthesisError > {
@@ -486,7 +483,7 @@ impl<P: MNT4Parameters> AteAdditionCoefficientsVar<P> {
486
483
}
487
484
488
485
#[ doc( hidden) ]
489
- pub struct G2ProjectiveExtendedVar < P : MNT4Parameters > {
486
+ pub struct G2ProjectiveExtendedVar < P : MNT4Config > {
490
487
pub x : Fp2Var < P :: Fp2Config > ,
491
488
pub y : Fp2Var < P :: Fp2Config > ,
492
489
pub z : Fp2Var < P :: Fp2Config > ,
0 commit comments