mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
restore contracts_test.go
This commit is contained in:
parent
a89885f232
commit
f4e5f666c5
3 changed files with 27 additions and 27 deletions
|
|
@ -22,32 +22,6 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"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) {
|
func FuzzPrecompiledContracts(f *testing.F) {
|
||||||
// Create list of addresses
|
// Create list of addresses
|
||||||
var addrs []common.Address
|
var addrs []common.Address
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,32 @@ type precompiledFailureTest struct {
|
||||||
Name string
|
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
|
// EIP-152 test vectors
|
||||||
var blake2FMalformedInputTests = []precompiledFailureTest{
|
var blake2FMalformedInputTests = []precompiledFailureTest{
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ compile_fuzzer github.com/ethereum/go-ethereum/core/vm/runtime \
|
||||||
|
|
||||||
compile_fuzzer github.com/ethereum/go-ethereum/core/vm \
|
compile_fuzzer github.com/ethereum/go-ethereum/core/vm \
|
||||||
FuzzPrecompiledContracts fuzzPrecompiledContracts\
|
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 \
|
compile_fuzzer github.com/ethereum/go-ethereum/core/types \
|
||||||
FuzzRLP fuzzRlp \
|
FuzzRLP fuzzRlp \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue