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