Skip to content

Commit

Permalink
add runners to donup precompile map
Browse files Browse the repository at this point in the history
redefine precompileaddresses in tests
  • Loading branch information
kilic committed Jan 24, 2021
1 parent 5a2b885 commit 8ce2e68
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ var PrecompiledContractsDonut = map[common.Address]PrecompiledContract{

// TODO(Donut): Add instances
edd25519Address: nil,
b12_381G1AddAddress: nil,
b12_381G1MulAddress: nil,
b12_381G1MultiExpAddress: nil,
b12_381G2AddAddress: nil,
b12_381G2MulAddress: nil,
b12_381G2MultiExpAddress: nil,
b12_381PairingAddress: nil,
b12_381MapFpToG1Address: nil,
b12_381MapFp2ToG2Address: nil,
b12_381G1AddAddress: &bls12381G1Add{},
b12_381G1MulAddress: &bls12381G1Mul{},
b12_381G1MultiExpAddress: &bls12381G1MultiExp{},
b12_381G2AddAddress: &bls12381G2Add{},
b12_381G2MulAddress: &bls12381G2Mul{},
b12_381G2MultiExpAddress: &bls12381G2MultiExp{},
b12_381PairingAddress: &bls12381Pairing{},
b12_381MapFpToG1Address: &bls12381MapG1{},
b12_381MapFp2ToG2Address: &bls12381MapG2{},
b12_377G1AddAddress: nil,
b12_377G1MulAddress: nil,
b12_377G1MultiExpAddress: nil,
Expand Down
56 changes: 28 additions & 28 deletions core/vm/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,33 +1069,33 @@ func TestGetVerifiedSealBitmap(t *testing.T) {
}
}

func TestPrecompiledBLS12381G1Add(t *testing.T) { testJson("blsG1Add", "0a", t) }
func TestPrecompiledBLS12381G1Mul(t *testing.T) { testJson("blsG1Mul", "0b", t) }
func TestPrecompiledBLS12381G1MultiExp(t *testing.T) { testJson("blsG1MultiExp", "0c", t) }
func TestPrecompiledBLS12381G2Add(t *testing.T) { testJson("blsG2Add", "0d", t) }
func TestPrecompiledBLS12381G2Mul(t *testing.T) { testJson("blsG2Mul", "0e", t) }
func TestPrecompiledBLS12381G2MultiExp(t *testing.T) { testJson("blsG2MultiExp", "0f", t) }
func TestPrecompiledBLS12381Pairing(t *testing.T) { testJson("blsPairing", "10", t) }
func TestPrecompiledBLS12381MapG1(t *testing.T) { testJson("blsMapG1", "11", t) }
func TestPrecompiledBLS12381MapG2(t *testing.T) { testJson("blsMapG2", "12", t) }

func BenchmarkPrecompiledBLS12381G1Add(b *testing.B) { benchJson("blsG1Add", "0a", b) }
func BenchmarkPrecompiledBLS12381G1Mul(b *testing.B) { benchJson("blsG1Mul", "0b", b) }
func BenchmarkPrecompiledBLS12381G1MultiExp(b *testing.B) { benchJson("blsG1MultiExp", "0c", b) }
func BenchmarkPrecompiledBLS12381G2Add(b *testing.B) { benchJson("blsG2Add", "0d", b) }
func BenchmarkPrecompiledBLS12381G2Mul(b *testing.B) { benchJson("blsG2Mul", "0e", b) }
func BenchmarkPrecompiledBLS12381G2MultiExp(b *testing.B) { benchJson("blsG2MultiExp", "0f", b) }
func BenchmarkPrecompiledBLS12381Pairing(b *testing.B) { benchJson("blsPairing", "10", b) }
func BenchmarkPrecompiledBLS12381MapG1(b *testing.B) { benchJson("blsMapG1", "11", b) }
func BenchmarkPrecompiledBLS12381MapG2(b *testing.B) { benchJson("blsMapG2", "12", b) }
func TestPrecompiledBLS12381G1Add(t *testing.T) { testJson("blsG1Add", "f2", t) }
func TestPrecompiledBLS12381G1Mul(t *testing.T) { testJson("blsG1Mul", "f1", t) }
func TestPrecompiledBLS12381G1MultiExp(t *testing.T) { testJson("blsG1MultiExp", "f0", t) }
func TestPrecompiledBLS12381G2Add(t *testing.T) { testJson("blsG2Add", "ef", t) }
func TestPrecompiledBLS12381G2Mul(t *testing.T) { testJson("blsG2Mul", "ee", t) }
func TestPrecompiledBLS12381G2MultiExp(t *testing.T) { testJson("blsG2MultiExp", "ed", t) }
func TestPrecompiledBLS12381Pairing(t *testing.T) { testJson("blsPairing", "ec", t) }
func TestPrecompiledBLS12381MapG1(t *testing.T) { testJson("blsMapG1", "eb", t) }
func TestPrecompiledBLS12381MapG2(t *testing.T) { testJson("blsMapG2", "ea", t) }

func BenchmarkPrecompiledBLS12381G1Add(b *testing.B) { benchJson("blsG1Add", "f2", b) }
func BenchmarkPrecompiledBLS12381G1Mul(b *testing.B) { benchJson("blsG1Mul", "f1", b) }
func BenchmarkPrecompiledBLS12381G1MultiExp(b *testing.B) { benchJson("blsG1MultiExp", "f0", b) }
func BenchmarkPrecompiledBLS12381G2Add(b *testing.B) { benchJson("blsG2Add", "ef", b) }
func BenchmarkPrecompiledBLS12381G2Mul(b *testing.B) { benchJson("blsG2Mul", "ee", b) }
func BenchmarkPrecompiledBLS12381G2MultiExp(b *testing.B) { benchJson("blsG2MultiExp", "ed", b) }
func BenchmarkPrecompiledBLS12381Pairing(b *testing.B) { benchJson("blsPairing", "ec", b) }
func BenchmarkPrecompiledBLS12381MapG1(b *testing.B) { benchJson("blsMapG1", "eb", b) }
func BenchmarkPrecompiledBLS12381MapG2(b *testing.B) { benchJson("blsMapG2", "ea", b) }

// Failure tests
func TestPrecompiledBLS12381G1AddFail(t *testing.T) { testJsonFail("fail-blsG1Add", "0a", t) }
func TestPrecompiledBLS12381G1MulFail(t *testing.T) { testJsonFail("fail-blsG1Mul", "0b", t) }
func TestPrecompiledBLS12381G1MultiExpFail(t *testing.T) { testJsonFail("fail-blsG1MultiExp", "0c", t) }
func TestPrecompiledBLS12381G2AddFail(t *testing.T) { testJsonFail("fail-blsG2Add", "0d", t) }
func TestPrecompiledBLS12381G2MulFail(t *testing.T) { testJsonFail("fail-blsG2Mul", "0e", t) }
func TestPrecompiledBLS12381G2MultiExpFail(t *testing.T) { testJsonFail("fail-blsG2MultiExp", "0f", t) }
func TestPrecompiledBLS12381PairingFail(t *testing.T) { testJsonFail("fail-blsPairing", "10", t) }
func TestPrecompiledBLS12381MapG1Fail(t *testing.T) { testJsonFail("fail-blsMapG1", "11", t) }
func TestPrecompiledBLS12381MapG2Fail(t *testing.T) { testJsonFail("fail-blsMapG2", "12", t) }
func TestPrecompiledBLS12381G1AddFail(t *testing.T) { testJsonFail("fail-blsG1Add", "f2", t) }
func TestPrecompiledBLS12381G1MulFail(t *testing.T) { testJsonFail("fail-blsG1Mul", "f1", t) }
func TestPrecompiledBLS12381G1MultiExpFail(t *testing.T) { testJsonFail("fail-blsG1MultiExp", "f0", t) }
func TestPrecompiledBLS12381G2AddFail(t *testing.T) { testJsonFail("fail-blsG2Add", "ef", t) }
func TestPrecompiledBLS12381G2MulFail(t *testing.T) { testJsonFail("fail-blsG2Mul", "ee", t) }
func TestPrecompiledBLS12381G2MultiExpFail(t *testing.T) { testJsonFail("fail-blsG2MultiExp", "ed", t) }
func TestPrecompiledBLS12381PairingFail(t *testing.T) { testJsonFail("fail-blsPairing", "ec", t) }
func TestPrecompiledBLS12381MapG1Fail(t *testing.T) { testJsonFail("fail-blsMapG1", "eb", t) }
func TestPrecompiledBLS12381MapG2Fail(t *testing.T) { testJsonFail("fail-blsMapG2", "ea", t) }

0 comments on commit 8ce2e68

Please sign in to comment.