File tree 5 files changed +8
-8
lines changed
5 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,4 @@ supported_modulus = ["1157920892373161954235709850086879078532699846656405640394
7
7
[[app_vm_config .ecc .supported_curves ]]
8
8
modulus = " 115792089237316195423570985008687907853269984665640564039457584007908834671663"
9
9
scalar = " 115792089237316195423570985008687907852837564279074904382605163141518161494337"
10
- a = " 0"
11
- b = " 7"
10
+ coeffs = { SwCurve = { a = " 0" , b = " 7" } }
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ pub struct CurveConfig {
37
37
#[ serde_as( as = "DisplayFromStr" ) ]
38
38
pub scalar : BigUint ,
39
39
// curve-specific coefficients
40
+ #[ serde_as( as = "_" ) ]
40
41
pub coeffs : CurveCoeffs ,
41
42
}
42
43
Original file line number Diff line number Diff line change @@ -107,14 +107,16 @@ pub fn te_declare(input: TokenStream) -> TokenStream {
107
107
fn add_chip( p1: & #struct_name, p2: & #struct_name) -> #struct_name {
108
108
#[ cfg( not( target_os = "zkvm" ) ) ]
109
109
{
110
+ use openvm_algebra_guest:: DivUnsafe ;
111
+
110
112
let x1y2 = p1. x( ) * p2. y( ) ;
111
113
let y1x2 = p1. y( ) * p2. x( ) ;
112
114
let x1x2 = p1. x( ) * p2. x( ) ;
113
115
let y1y2 = p1. y( ) * p2. y( ) ;
114
- let dx1x2y1y2 = Self :: CURVE_D * x1x2 * y1y2;
116
+ let dx1x2y1y2 = Self :: CURVE_D * & x1x2 * & y1y2;
115
117
116
- let x3 = ( x1y2 + y1x2) . div_unsafe( & ( Self :: Coordinate :: ONE + dx1x2y1y2) ) ;
117
- let y3 = ( y1y2 - Self :: CURVE_A * x1x2) . div_unsafe( & ( Self :: Coordinate :: ONE - dx1x2y1y2) ) ;
118
+ let x3 = ( x1y2 + y1x2) . div_unsafe( & <#intmod_type as openvm_algebra_guest :: IntMod > :: ONE + & dx1x2y1y2) ;
119
+ let y3 = ( y1y2 - Self :: CURVE_A * x1x2) . div_unsafe( & <#intmod_type as openvm_algebra_guest :: IntMod > :: ONE - & dx1x2y1y2) ;
118
120
119
121
#struct_name { x: x3, y: y3 }
120
122
}
Original file line number Diff line number Diff line change @@ -268,9 +268,7 @@ fn test_plonk_zkvm() -> eyre::Result<()> {
268
268
BN254_MODULUS . clone( ) ,
269
269
BN254_ORDER . clone( ) ,
270
270
] ) )
271
- . ecc ( EccExtension :: new ( vec ! [
272
- PairingCurve :: Bn254 . curve_config( )
273
- ] ) )
271
+ . ecc ( EccExtension :: new ( vec ! [ PairingCurve :: Bn254 . curve_config( ) ] ) )
274
272
. fp2 ( Fp2Extension :: new ( vec ! [ BN254_MODULUS . clone( ) ] ) )
275
273
. pairing ( PairingExtension :: new ( vec ! [ PairingCurve :: Bn254 ] ) )
276
274
. build ( ) ;
You can’t perform that action at this time.
0 commit comments