@@ -59,14 +59,12 @@ var allPrecompiles = map[common.Address]PrecompiledContract{
59
59
common .BytesToAddress ([]byte {0x0a }): & kzgPointEvaluation {},
60
60
61
61
common .BytesToAddress ([]byte {0x0f , 0x0a }): & bls12381G1Add {},
62
- common .BytesToAddress ([]byte {0x0f , 0x0b }): & bls12381G1Mul {},
63
- common .BytesToAddress ([]byte {0x0f , 0x0c }): & bls12381G1MultiExp {},
64
- common .BytesToAddress ([]byte {0x0f , 0x0d }): & bls12381G2Add {},
65
- common .BytesToAddress ([]byte {0x0f , 0x0e }): & bls12381G2Mul {},
66
- common .BytesToAddress ([]byte {0x0f , 0x0f }): & bls12381G2MultiExp {},
67
- common .BytesToAddress ([]byte {0x0f , 0x10 }): & bls12381Pairing {},
68
- common .BytesToAddress ([]byte {0x0f , 0x11 }): & bls12381MapG1 {},
69
- common .BytesToAddress ([]byte {0x0f , 0x12 }): & bls12381MapG2 {},
62
+ common .BytesToAddress ([]byte {0x0f , 0x0b }): & bls12381G1MultiExp {},
63
+ common .BytesToAddress ([]byte {0x0f , 0x0c }): & bls12381G2Add {},
64
+ common .BytesToAddress ([]byte {0x0f , 0x0d }): & bls12381G2MultiExp {},
65
+ common .BytesToAddress ([]byte {0x0f , 0x0e }): & bls12381Pairing {},
66
+ common .BytesToAddress ([]byte {0x0f , 0x0f }): & bls12381MapG1 {},
67
+ common .BytesToAddress ([]byte {0x0f , 0x10 }): & bls12381MapG2 {},
70
68
}
71
69
72
70
// EIP-152 test vectors
@@ -306,38 +304,36 @@ func benchJson(name, addr string, b *testing.B) {
306
304
307
305
func TestPrecompiledBLS12381G1Add (t * testing.T ) { testJson ("blsG1Add" , "f0a" , t ) }
308
306
func TestPrecompiledBLS12381G1Mul (t * testing.T ) { testJson ("blsG1Mul" , "f0b" , t ) }
309
- func TestPrecompiledBLS12381G1MultiExp (t * testing.T ) { testJson ("blsG1MultiExp" , "f0c " , t ) }
310
- func TestPrecompiledBLS12381G2Add (t * testing.T ) { testJson ("blsG2Add" , "f0d " , t ) }
311
- func TestPrecompiledBLS12381G2Mul (t * testing.T ) { testJson ("blsG2Mul" , "f0e " , t ) }
312
- func TestPrecompiledBLS12381G2MultiExp (t * testing.T ) { testJson ("blsG2MultiExp" , "f0f " , t ) }
313
- func TestPrecompiledBLS12381Pairing (t * testing.T ) { testJson ("blsPairing" , "f10 " , t ) }
314
- func TestPrecompiledBLS12381MapG1 (t * testing.T ) { testJson ("blsMapG1" , "f11 " , t ) }
315
- func TestPrecompiledBLS12381MapG2 (t * testing.T ) { testJson ("blsMapG2" , "f12 " , t ) }
307
+ func TestPrecompiledBLS12381G1MultiExp (t * testing.T ) { testJson ("blsG1MultiExp" , "f0b " , t ) }
308
+ func TestPrecompiledBLS12381G2Add (t * testing.T ) { testJson ("blsG2Add" , "f0c " , t ) }
309
+ func TestPrecompiledBLS12381G2Mul (t * testing.T ) { testJson ("blsG2Mul" , "f0d " , t ) }
310
+ func TestPrecompiledBLS12381G2MultiExp (t * testing.T ) { testJson ("blsG2MultiExp" , "f0d " , t ) }
311
+ func TestPrecompiledBLS12381Pairing (t * testing.T ) { testJson ("blsPairing" , "f0e " , t ) }
312
+ func TestPrecompiledBLS12381MapG1 (t * testing.T ) { testJson ("blsMapG1" , "f0f " , t ) }
313
+ func TestPrecompiledBLS12381MapG2 (t * testing.T ) { testJson ("blsMapG2" , "f10 " , t ) }
316
314
317
315
func TestPrecompiledPointEvaluation (t * testing.T ) { testJson ("pointEvaluation" , "0a" , t ) }
318
316
319
317
func BenchmarkPrecompiledPointEvaluation (b * testing.B ) { benchJson ("pointEvaluation" , "0a" , b ) }
320
318
321
319
func BenchmarkPrecompiledBLS12381G1Add (b * testing.B ) { benchJson ("blsG1Add" , "f0a" , b ) }
322
- func BenchmarkPrecompiledBLS12381G1Mul (b * testing.B ) { benchJson ("blsG1Mul" , "f0b" , b ) }
323
- func BenchmarkPrecompiledBLS12381G1MultiExp (b * testing.B ) { benchJson ("blsG1MultiExp" , "f0c" , b ) }
324
- func BenchmarkPrecompiledBLS12381G2Add (b * testing.B ) { benchJson ("blsG2Add" , "f0d" , b ) }
325
- func BenchmarkPrecompiledBLS12381G2Mul (b * testing.B ) { benchJson ("blsG2Mul" , "f0e" , b ) }
326
- func BenchmarkPrecompiledBLS12381G2MultiExp (b * testing.B ) { benchJson ("blsG2MultiExp" , "f0f" , b ) }
327
- func BenchmarkPrecompiledBLS12381Pairing (b * testing.B ) { benchJson ("blsPairing" , "f10" , b ) }
328
- func BenchmarkPrecompiledBLS12381MapG1 (b * testing.B ) { benchJson ("blsMapG1" , "f11" , b ) }
329
- func BenchmarkPrecompiledBLS12381MapG2 (b * testing.B ) { benchJson ("blsMapG2" , "f12" , b ) }
320
+ func BenchmarkPrecompiledBLS12381G1MultiExp (b * testing.B ) { benchJson ("blsG1MultiExp" , "f0b" , b ) }
321
+ func BenchmarkPrecompiledBLS12381G2Add (b * testing.B ) { benchJson ("blsG2Add" , "f0c" , b ) }
322
+ func BenchmarkPrecompiledBLS12381G2MultiExp (b * testing.B ) { benchJson ("blsG2MultiExp" , "f0d" , b ) }
323
+ func BenchmarkPrecompiledBLS12381Pairing (b * testing.B ) { benchJson ("blsPairing" , "f0e" , b ) }
324
+ func BenchmarkPrecompiledBLS12381MapG1 (b * testing.B ) { benchJson ("blsMapG1" , "f0f" , b ) }
325
+ func BenchmarkPrecompiledBLS12381MapG2 (b * testing.B ) { benchJson ("blsMapG2" , "f10" , b ) }
330
326
331
327
// Failure tests
332
328
func TestPrecompiledBLS12381G1AddFail (t * testing.T ) { testJsonFail ("blsG1Add" , "f0a" , t ) }
333
329
func TestPrecompiledBLS12381G1MulFail (t * testing.T ) { testJsonFail ("blsG1Mul" , "f0b" , t ) }
334
- func TestPrecompiledBLS12381G1MultiExpFail (t * testing.T ) { testJsonFail ("blsG1MultiExp" , "f0c " , t ) }
335
- func TestPrecompiledBLS12381G2AddFail (t * testing.T ) { testJsonFail ("blsG2Add" , "f0d " , t ) }
336
- func TestPrecompiledBLS12381G2MulFail (t * testing.T ) { testJsonFail ("blsG2Mul" , "f0e " , t ) }
337
- func TestPrecompiledBLS12381G2MultiExpFail (t * testing.T ) { testJsonFail ("blsG2MultiExp" , "f0f " , t ) }
338
- func TestPrecompiledBLS12381PairingFail (t * testing.T ) { testJsonFail ("blsPairing" , "f10 " , t ) }
339
- func TestPrecompiledBLS12381MapG1Fail (t * testing.T ) { testJsonFail ("blsMapG1" , "f11 " , t ) }
340
- func TestPrecompiledBLS12381MapG2Fail (t * testing.T ) { testJsonFail ("blsMapG2" , "f12 " , t ) }
330
+ func TestPrecompiledBLS12381G1MultiExpFail (t * testing.T ) { testJsonFail ("blsG1MultiExp" , "f0b " , t ) }
331
+ func TestPrecompiledBLS12381G2AddFail (t * testing.T ) { testJsonFail ("blsG2Add" , "f0c " , t ) }
332
+ func TestPrecompiledBLS12381G2MulFail (t * testing.T ) { testJsonFail ("blsG2Mul" , "f0d " , t ) }
333
+ func TestPrecompiledBLS12381G2MultiExpFail (t * testing.T ) { testJsonFail ("blsG2MultiExp" , "f0d " , t ) }
334
+ func TestPrecompiledBLS12381PairingFail (t * testing.T ) { testJsonFail ("blsPairing" , "f0e " , t ) }
335
+ func TestPrecompiledBLS12381MapG1Fail (t * testing.T ) { testJsonFail ("blsMapG1" , "f0f " , t ) }
336
+ func TestPrecompiledBLS12381MapG2Fail (t * testing.T ) { testJsonFail ("blsMapG2" , "f10 " , t ) }
341
337
342
338
func loadJson (name string ) ([]precompiledTest , error ) {
343
339
data , err := os .ReadFile (fmt .Sprintf ("testdata/precompiles/%v.json" , name ))
0 commit comments