From f4e5f666c51e5c700726a30984595cd0e2629e75 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Mon, 6 Nov 2023 08:03:00 +0100 Subject: [PATCH] restore contracts_test.go --- core/vm/contracts_fuzz_test.go | 26 -------------------------- core/vm/contracts_test.go | 26 ++++++++++++++++++++++++++ oss-fuzz.sh | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/core/vm/contracts_fuzz_test.go b/core/vm/contracts_fuzz_test.go index b8b4bdcb6a..87c1fff7cc 100644 --- a/core/vm/contracts_fuzz_test.go +++ b/core/vm/contracts_fuzz_test.go @@ -22,32 +22,6 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// allPrecompiles does not map to the actual set of precompiles, as it also contains -// repriced versions of precompiles at certain slots -var allPrecompiles = map[common.Address]PrecompiledContract{ - common.BytesToAddress([]byte{1}): &ecrecover{}, - common.BytesToAddress([]byte{2}): &sha256hash{}, - common.BytesToAddress([]byte{3}): &ripemd160hash{}, - common.BytesToAddress([]byte{4}): &dataCopy{}, - common.BytesToAddress([]byte{5}): &bigModExp{eip2565: false}, - common.BytesToAddress([]byte{0xf5}): &bigModExp{eip2565: true}, - common.BytesToAddress([]byte{6}): &bn256AddIstanbul{}, - common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, - common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, - common.BytesToAddress([]byte{9}): &blake2F{}, - common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{}, - - common.BytesToAddress([]byte{0x0f, 0x0a}): &bls12381G1Add{}, - common.BytesToAddress([]byte{0x0f, 0x0b}): &bls12381G1Mul{}, - common.BytesToAddress([]byte{0x0f, 0x0c}): &bls12381G1MultiExp{}, - common.BytesToAddress([]byte{0x0f, 0x0d}): &bls12381G2Add{}, - common.BytesToAddress([]byte{0x0f, 0x0e}): &bls12381G2Mul{}, - common.BytesToAddress([]byte{0x0f, 0x0f}): &bls12381G2MultiExp{}, - common.BytesToAddress([]byte{0x0f, 0x10}): &bls12381Pairing{}, - common.BytesToAddress([]byte{0x0f, 0x11}): &bls12381MapG1{}, - common.BytesToAddress([]byte{0x0f, 0x12}): &bls12381MapG2{}, -} - func FuzzPrecompiledContracts(f *testing.F) { // Create list of addresses var addrs []common.Address diff --git a/core/vm/contracts_test.go b/core/vm/contracts_test.go index 7c25f47638..f40e2c8f9e 100644 --- a/core/vm/contracts_test.go +++ b/core/vm/contracts_test.go @@ -43,6 +43,32 @@ type precompiledFailureTest struct { Name string } +// allPrecompiles does not map to the actual set of precompiles, as it also contains +// repriced versions of precompiles at certain slots +var allPrecompiles = map[common.Address]PrecompiledContract{ + common.BytesToAddress([]byte{1}): &ecrecover{}, + common.BytesToAddress([]byte{2}): &sha256hash{}, + common.BytesToAddress([]byte{3}): &ripemd160hash{}, + common.BytesToAddress([]byte{4}): &dataCopy{}, + common.BytesToAddress([]byte{5}): &bigModExp{eip2565: false}, + common.BytesToAddress([]byte{0xf5}): &bigModExp{eip2565: true}, + common.BytesToAddress([]byte{6}): &bn256AddIstanbul{}, + common.BytesToAddress([]byte{7}): &bn256ScalarMulIstanbul{}, + common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, + common.BytesToAddress([]byte{9}): &blake2F{}, + common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{}, + + common.BytesToAddress([]byte{0x0f, 0x0a}): &bls12381G1Add{}, + common.BytesToAddress([]byte{0x0f, 0x0b}): &bls12381G1Mul{}, + common.BytesToAddress([]byte{0x0f, 0x0c}): &bls12381G1MultiExp{}, + common.BytesToAddress([]byte{0x0f, 0x0d}): &bls12381G2Add{}, + common.BytesToAddress([]byte{0x0f, 0x0e}): &bls12381G2Mul{}, + common.BytesToAddress([]byte{0x0f, 0x0f}): &bls12381G2MultiExp{}, + common.BytesToAddress([]byte{0x0f, 0x10}): &bls12381Pairing{}, + common.BytesToAddress([]byte{0x0f, 0x11}): &bls12381MapG1{}, + common.BytesToAddress([]byte{0x0f, 0x12}): &bls12381MapG2{}, +} + // EIP-152 test vectors var blake2FMalformedInputTests = []precompiledFailureTest{ { diff --git a/oss-fuzz.sh b/oss-fuzz.sh index ba7f442592..8978de70dd 100644 --- a/oss-fuzz.sh +++ b/oss-fuzz.sh @@ -100,7 +100,7 @@ compile_fuzzer github.com/ethereum/go-ethereum/core/vm/runtime \ compile_fuzzer github.com/ethereum/go-ethereum/core/vm \ FuzzPrecompiledContracts fuzzPrecompiledContracts\ - $repo/core/vm/contracts_fuzz_test.go + $repo/core/vm/contracts_fuzz_test.go,$repo/core/vm/contracts_test.go compile_fuzzer github.com/ethereum/go-ethereum/core/types \ FuzzRLP fuzzRlp \