File tree 14 files changed +5
-53
lines changed
extensions/pairing/tests/programs
14 files changed +5
-53
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,6 @@ openvm_ecc_guest::sw_macros::sw_init! {
24
24
}
25
25
26
26
pub fn main ( ) {
27
- setup_all_moduli ( ) ;
28
- setup_all_curves ( ) ;
29
-
30
27
let expected_address = read_vec ( ) ;
31
28
for _ in 0 ..5 {
32
29
let input = read_vec ( ) ;
Original file line number Diff line number Diff line change @@ -48,10 +48,8 @@ openvm_algebra_guest::complex_macros::complex_init! {
48
48
}
49
49
50
50
pub fn main ( ) {
51
- // Setup will materialize every chip
52
- setup_all_moduli ( ) ;
53
- setup_all_complex_extensions ( ) ;
54
- setup_all_curves ( ) ;
51
+ // TODO: Since we don't explicitly call setup functions anymore, we should rewrite this test
52
+ // to use every declared modulus and curve to ensure that every chip is materialized.
55
53
56
54
let [ one, six] = [ 1 , 6 ] . map ( Seven :: from_u32) ;
57
55
assert_eq ! ( one + six, Seven :: ZERO ) ;
Original file line number Diff line number Diff line change @@ -22,11 +22,6 @@ openvm_algebra_guest::complex_macros::complex_init! {
22
22
const PAIR_ELEMENT_LEN : usize = 32 * ( 2 + 4 ) ; // 1 G1Affine (2 Fp), 1 G2Affine (4 Fp)
23
23
24
24
pub fn main ( ) {
25
- setup_all_moduli ( ) ;
26
- setup_all_complex_extensions ( ) ;
27
- // Pairing doesn't need G1Affine intrinsics, but we trigger it anyways to test the chips
28
- setup_all_curves ( ) ;
29
-
30
25
// copied from https://github.com/bluealloy/revm/blob/9e39df5dbc5fdc98779c644629b28b8bee75794a/crates/precompile/src/bn128.rs#L395
31
26
let input = hex:: decode (
32
27
"\
Original file line number Diff line number Diff line change @@ -31,10 +31,6 @@ openvm_algebra_complex_macros::complex_init! {
31
31
*/
32
32
33
33
pub fn main ( ) {
34
- // Since we only use an arithmetic operation with `Mod1` and not `Mod2`,
35
- // we only need to call `setup_0()` here.
36
- setup_0 ( ) ;
37
- setup_all_complex_extensions ( ) ;
38
34
let a = Complex1 :: new ( Mod1 :: ZERO , Mod1 :: from_u32 ( 0x3b8 ) * Mod1 :: from_u32 ( 0x100000 ) ) ; // a = -i in the corresponding field
39
35
let b = Complex2 :: new ( Mod2 :: ZERO , Mod2 :: from_u32 ( 1000000006 ) ) ; // b = -i in the corresponding field
40
36
assert_eq ! ( a. clone( ) * & a * & a * & a * & a, a) ; // a^5 = a
Original file line number Diff line number Diff line change @@ -23,8 +23,6 @@ openvm_ecc_guest::sw_macros::sw_init! {
23
23
24
24
// ANCHOR: main
25
25
pub fn main ( ) {
26
- setup_all_moduli ( ) ;
27
- setup_all_curves ( ) ;
28
26
let x1 = Secp256k1Coord :: from_u32 ( 1 ) ;
29
27
let y1 = Secp256k1Coord :: from_le_bytes ( & hex ! (
30
28
"EEA7767E580D75BC6FDD7F58D2A84C2614FB22586068DB63B346C6E60AF21842"
Original file line number Diff line number Diff line change @@ -26,11 +26,6 @@ openvm_algebra_complex_macros::complex_init! {
26
26
27
27
// ANCHOR: main
28
28
pub fn main ( ) {
29
- // ANCHOR: setup
30
- setup_0 ( ) ;
31
- setup_all_complex_extensions ( ) ;
32
- // ANCHOR_END: setup
33
-
34
29
let p0 = AffinePoint :: new (
35
30
Fp :: from_be_bytes ( & hex ! ( "17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb" ) ) ,
36
31
Fp :: from_be_bytes ( & hex ! ( "08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1" ) )
Original file line number Diff line number Diff line change @@ -15,7 +15,4 @@ openvm_ecc_sw_macros::sw_init! {
15
15
16
16
openvm:: entry!( main) ;
17
17
18
- pub fn main ( ) {
19
- setup_all_moduli ( ) ;
20
- setup_all_curves ( ) ;
21
- }
18
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change @@ -23,8 +23,6 @@ mod bn254 {
23
23
}
24
24
25
25
pub fn test_fp12_mul ( io : & [ u8 ] ) {
26
- setup_0 ( ) ;
27
- setup_all_complex_extensions ( ) ;
28
26
assert_eq ! ( io. len( ) , 32 * 36 ) ;
29
27
30
28
let f0 = & io[ 0 ..32 * 12 ] ;
@@ -62,8 +60,6 @@ mod bls12_381 {
62
60
}
63
61
64
62
pub fn test_fp12_mul ( io : & [ u8 ] ) {
65
- setup_0 ( ) ;
66
- setup_all_complex_extensions ( ) ;
67
63
assert_eq ! ( io. len( ) , 48 * 36 ) ;
68
64
69
65
let f0 = & io[ 0 ..48 * 12 ] ;
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ mod bn254 {
29
29
}
30
30
31
31
pub fn test_pairing_check ( io : & [ u8 ] ) {
32
- setup_0 ( ) ;
33
- setup_all_complex_extensions ( ) ;
34
32
let s0 = & io[ 0 ..32 * 2 ] ;
35
33
let s1 = & io[ 32 * 2 ..32 * 4 ] ;
36
34
let q0 = & io[ 32 * 4 ..32 * 8 ] ;
@@ -71,8 +69,6 @@ mod bls12_381 {
71
69
}
72
70
73
71
pub fn test_pairing_check ( io : & [ u8 ] ) {
74
- setup_0 ( ) ;
75
- setup_all_complex_extensions ( ) ;
76
72
let s0 = & io[ 0 ..48 * 2 ] ;
77
73
let s1 = & io[ 48 * 2 ..48 * 4 ] ;
78
74
let q0 = & io[ 48 * 4 ..48 * 8 ] ;
Original file line number Diff line number Diff line change @@ -101,8 +101,6 @@ mod bn254 {
101
101
}
102
102
103
103
pub fn test_pairing_check ( io : & [ u8 ] ) {
104
- setup_0 ( ) ;
105
- setup_all_complex_extensions ( ) ;
106
104
let s0 = & io[ 0 ..32 * 2 ] ;
107
105
let s1 = & io[ 32 * 2 ..32 * 4 ] ;
108
106
let q0 = & io[ 32 * 4 ..32 * 8 ] ;
@@ -216,8 +214,6 @@ mod bls12_381 {
216
214
}
217
215
218
216
pub fn test_pairing_check ( io : & [ u8 ] ) {
219
- setup_0 ( ) ;
220
- setup_all_complex_extensions ( ) ;
221
217
let s0 = & io[ 0 ..48 * 2 ] ;
222
218
let s1 = & io[ 48 * 2 ..48 * 4 ] ;
223
219
let q0 = & io[ 48 * 4 ..48 * 8 ] ;
Original file line number Diff line number Diff line change @@ -150,15 +150,11 @@ pub fn main() {
150
150
151
151
#[ cfg( feature = "bn254" ) ]
152
152
{
153
- bn254:: setup_0 ( ) ;
154
- bn254:: setup_all_complex_extensions ( ) ;
155
153
bn254:: test_mul_013_by_013 ( & io[ ..32 * 18 ] ) ;
156
154
bn254:: test_mul_by_01234 ( & io[ 32 * 18 ..32 * 52 ] ) ;
157
155
}
158
156
#[ cfg( feature = "bls12_381" ) ]
159
157
{
160
- bls12_381:: setup_0 ( ) ;
161
- bls12_381:: setup_all_complex_extensions ( ) ;
162
158
bls12_381:: test_mul_023_by_023 ( & io[ ..48 * 18 ] ) ;
163
159
bls12_381:: test_mul_by_02345 ( & io[ 48 * 18 ..48 * 52 ] ) ;
164
160
}
Original file line number Diff line number Diff line change @@ -27,8 +27,6 @@ mod bn254 {
27
27
}
28
28
29
29
pub fn test_miller_loop ( io : & [ u8 ] ) {
30
- setup_0 ( ) ;
31
- setup_all_complex_extensions ( ) ;
32
30
let s0 = & io[ 0 ..32 * 2 ] ;
33
31
let s1 = & io[ 32 * 2 ..32 * 4 ] ;
34
32
let q0 = & io[ 32 * 4 ..32 * 8 ] ;
@@ -70,8 +68,6 @@ mod bls12_381 {
70
68
}
71
69
72
70
pub fn test_miller_loop ( io : & [ u8 ] ) {
73
- setup_0 ( ) ;
74
- setup_all_complex_extensions ( ) ;
75
71
let s0 = & io[ 0 ..48 * 2 ] ;
76
72
let s1 = & io[ 48 * 2 ..48 * 4 ] ;
77
73
let q0 = & io[ 48 * 4 ..48 * 8 ] ;
Original file line number Diff line number Diff line change @@ -169,15 +169,11 @@ pub fn main() {
169
169
170
170
#[ cfg( feature = "bn254" ) ]
171
171
{
172
- bn254:: setup_0 ( ) ;
173
- bn254:: setup_all_complex_extensions ( ) ;
174
172
bn254:: test_miller_step ( & io[ ..32 * 12 ] ) ;
175
173
bn254:: test_miller_double_and_add_step ( & io[ 32 * 12 ..] ) ;
176
174
}
177
175
#[ cfg( feature = "bls12_381" ) ]
178
176
{
179
- bls12_381:: setup_0 ( ) ;
180
- bls12_381:: setup_all_complex_extensions ( ) ;
181
177
bls12_381:: test_miller_step ( & io[ ..48 * 12 ] ) ;
182
178
bls12_381:: test_miller_double_and_add_step ( & io[ 48 * 12 ..] ) ;
183
179
}
Original file line number Diff line number Diff line change 1
1
// This file is automatically generated by cargo openvm. Do not rename or edit.
2
- openvm_algebra_guest:: moduli_macros:: moduli_init! { "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787 " }
3
- openvm_algebra_guest:: complex_macros:: complex_init! { Bls12_381Fp2 { mod_idx = 0 } }
2
+ openvm_algebra_guest:: moduli_macros:: moduli_init! { "21888242871839275222246405745257275088696311157297823662689037894645226208583 " }
3
+ openvm_algebra_guest:: complex_macros:: complex_init! { Bn254Fp2 { mod_idx = 0 } }
4
4
openvm_ecc_guest:: sw_macros:: sw_init! { }
You can’t perform that action at this time.
0 commit comments