build: update EEST fixtures to prague devnet-6 (#31088)
Co-authored-by: lightclient <lightclient@protonmail.com>
This commit is contained in:
parent
9e33b29c74
commit
1847b5f635
|
@ -1,9 +1,9 @@
|
||||||
# This file contains sha256 checksums of optional build dependencies.
|
# This file contains sha256 checksums of optional build dependencies.
|
||||||
|
|
||||||
# version:spec-tests 2.1.0
|
# version:spec-tests pectra-devnet-6@v1.0.0
|
||||||
# https://github.com/ethereum/execution-spec-tests/releases
|
# https://github.com/ethereum/execution-spec-tests/releases
|
||||||
# https://github.com/ethereum/execution-spec-tests/releases/download/v2.1.0/
|
# https://github.com/ethereum/execution-spec-tests/releases/download/pectra-devnet-6%40v1.0.0/fixtures_pectra-devnet-6.tar.gz
|
||||||
ca89c76851b0900bfcc3cbb9a26cbece1f3d7c64a3bed38723e914713290df6c fixtures_develop.tar.gz
|
b69211752a3029083c020dc635fe12156ca1a6725a08559da540a0337586a77e fixtures_pectra-devnet-6.tar.gz
|
||||||
|
|
||||||
# version:golang 1.23.6
|
# version:golang 1.23.6
|
||||||
# https://go.dev/dl/
|
# https://go.dev/dl/
|
||||||
|
|
|
@ -338,8 +338,8 @@ func downloadSpecTestFixtures(csdb *build.ChecksumDB, cachedir string) string {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
ext := ".tar.gz"
|
ext := ".tar.gz"
|
||||||
base := "fixtures_develop" // TODO(MariusVanDerWijden) rename once the version becomes part of the filename
|
base := "fixtures_pectra-devnet-6" // TODO(s1na) rename once the version becomes part of the filename
|
||||||
url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/v%s/%s%s", executionSpecTestsVersion, base, ext)
|
url := fmt.Sprintf("https://github.com/ethereum/execution-spec-tests/releases/download/%s/%s%s", executionSpecTestsVersion, base, ext)
|
||||||
archivePath := filepath.Join(cachedir, base+ext)
|
archivePath := filepath.Join(cachedir, base+ext)
|
||||||
if err := csdb.DownloadFile(url, archivePath); err != nil {
|
if err := csdb.DownloadFile(url, archivePath); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|
|
@ -34,16 +34,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
baseDir = filepath.Join(".", "testdata")
|
baseDir = filepath.Join(".", "testdata")
|
||||||
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
blockTestDir = filepath.Join(baseDir, "BlockchainTests")
|
||||||
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
|
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
|
||||||
legacyStateTestDir = filepath.Join(baseDir, "LegacyTests", "Constantinople", "GeneralStateTests")
|
legacyStateTestDir = filepath.Join(baseDir, "LegacyTests", "Constantinople", "GeneralStateTests")
|
||||||
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
|
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
|
||||||
rlpTestDir = filepath.Join(baseDir, "RLPTests")
|
rlpTestDir = filepath.Join(baseDir, "RLPTests")
|
||||||
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
|
difficultyTestDir = filepath.Join(baseDir, "BasicTests")
|
||||||
executionSpecBlockchainTestDir = filepath.Join(".", "spec-tests", "fixtures", "blockchain_tests")
|
executionSpecBlockchainTestDir = filepath.Join(".", "spec-tests", "fixtures", "blockchain_tests")
|
||||||
executionSpecStateTestDir = filepath.Join(".", "spec-tests", "fixtures", "state_tests")
|
executionSpecStateTestDir = filepath.Join(".", "spec-tests", "fixtures", "state_tests")
|
||||||
benchmarksDir = filepath.Join(".", "evm-benchmarks", "benchmarks")
|
executionSpecTransactionTestDir = filepath.Join(".", "spec-tests", "fixtures", "transaction_tests")
|
||||||
|
benchmarksDir = filepath.Join(".", "evm-benchmarks", "benchmarks")
|
||||||
)
|
)
|
||||||
|
|
||||||
func readJSON(reader io.Reader, value interface{}) error {
|
func readJSON(reader io.Reader, value interface{}) error {
|
||||||
|
|
|
@ -19,6 +19,7 @@ package tests
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -42,6 +43,20 @@ func TestTransaction(t *testing.T) {
|
||||||
// Geth accepts it, which is not a consensus issue since we use big.Int's
|
// Geth accepts it, which is not a consensus issue since we use big.Int's
|
||||||
// internally to calculate the cost
|
// internally to calculate the cost
|
||||||
txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json")
|
txt.skipLoad("^ttValue/TransactionWithHighValueOverflow.json")
|
||||||
|
|
||||||
|
// The size of a create tx's initcode is only checked during the state
|
||||||
|
// transition
|
||||||
|
txt.skipLoad("^ttEIP3860/DataTestInitCodeTooBig.json")
|
||||||
|
|
||||||
|
// The following tests require the tx precheck to be performed
|
||||||
|
// TODO(s1na): expose stateTransition.precheck publicly to be able to run these tests
|
||||||
|
txt.skipLoad("^ttEIP1559/maxPriorityFeePerGass32BytesValue.json")
|
||||||
|
txt.skipLoad("^ttEIP1559/maxPriorityFeePerGasOverflow.json")
|
||||||
|
txt.skipLoad("^ttEIP1559/maxFeePerGas32BytesValue.json")
|
||||||
|
txt.skipLoad("^ttEIP1559/maxFeePerGasOverflow.json")
|
||||||
|
txt.skipLoad("^ttEIP1559/GasLimitPriceProductPlusOneOverflow.json")
|
||||||
|
txt.skipLoad("^ttEIP1559/GasLimitPriceProductOverflow.json")
|
||||||
|
|
||||||
txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) {
|
txt.walk(t, transactionTestDir, func(t *testing.T, name string, test *TransactionTest) {
|
||||||
cfg := params.MainnetChainConfig
|
cfg := params.MainnetChainConfig
|
||||||
if err := txt.checkFailure(t, test.Run(cfg)); err != nil {
|
if err := txt.checkFailure(t, test.Run(cfg)); err != nil {
|
||||||
|
@ -49,3 +64,20 @@ func TestTransaction(t *testing.T) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestExecutionSpecTransaction(t *testing.T) {
|
||||||
|
if !common.FileExist(executionSpecStateTestDir) {
|
||||||
|
t.Skipf("directory %s does not exist", executionSpecStateTestDir)
|
||||||
|
}
|
||||||
|
st := new(testMatcher)
|
||||||
|
|
||||||
|
// Emptiness of authorization list is only validated during the tx precheck
|
||||||
|
st.skipLoad("^prague/eip7702_set_code_tx/invalid_tx/empty_authorization_list.json")
|
||||||
|
|
||||||
|
st.walk(t, executionSpecTransactionTestDir, func(t *testing.T, name string, test *TransactionTest) {
|
||||||
|
cfg := params.MainnetChainConfig
|
||||||
|
if err := st.checkFailure(t, test.Run(cfg)); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -21,93 +21,120 @@ import (
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TransactionTest checks RLP decoding and sender derivation of transactions.
|
// TransactionTest checks RLP decoding and sender derivation of transactions.
|
||||||
type TransactionTest struct {
|
type TransactionTest struct {
|
||||||
Txbytes hexutil.Bytes `json:"txbytes"`
|
Txbytes hexutil.Bytes `json:"txbytes"`
|
||||||
Result ttResult
|
Result map[string]*ttFork
|
||||||
}
|
|
||||||
|
|
||||||
type ttResult struct {
|
|
||||||
Byzantium ttFork
|
|
||||||
Constantinople ttFork
|
|
||||||
Istanbul ttFork
|
|
||||||
EIP150 ttFork
|
|
||||||
EIP158 ttFork
|
|
||||||
Frontier ttFork
|
|
||||||
Homestead ttFork
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ttFork struct {
|
type ttFork struct {
|
||||||
Sender common.UnprefixedAddress `json:"sender"`
|
Sender *common.UnprefixedAddress `json:"sender"`
|
||||||
Hash common.UnprefixedHash `json:"hash"`
|
Hash *common.UnprefixedHash `json:"hash"`
|
||||||
|
Exception *string `json:"exception"`
|
||||||
|
IntrinsicGas math.HexOrDecimal64 `json:"intrinsicGas"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tt *TransactionTest) Run(config *params.ChainConfig) error {
|
func (tt *TransactionTest) validate() error {
|
||||||
validateTx := func(rlpData hexutil.Bytes, signer types.Signer, isHomestead bool, isIstanbul bool) (*common.Address, *common.Hash, error) {
|
if tt.Txbytes == nil {
|
||||||
tx := new(types.Transaction)
|
return fmt.Errorf("missing txbytes")
|
||||||
if err := rlp.DecodeBytes(rlpData, tx); err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
sender, err := types.Sender(signer, tx)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
// Intrinsic gas
|
|
||||||
requiredGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, isHomestead, isIstanbul, false)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
if requiredGas > tx.Gas() {
|
|
||||||
return nil, nil, fmt.Errorf("insufficient gas ( %d < %d )", tx.Gas(), requiredGas)
|
|
||||||
}
|
|
||||||
h := tx.Hash()
|
|
||||||
return &sender, &h, nil
|
|
||||||
}
|
}
|
||||||
|
for name, fork := range tt.Result {
|
||||||
for _, testcase := range []struct {
|
if err := tt.validateFork(fork); err != nil {
|
||||||
name string
|
return fmt.Errorf("invalid %s: %v", name, err)
|
||||||
signer types.Signer
|
}
|
||||||
fork ttFork
|
}
|
||||||
isHomestead bool
|
return nil
|
||||||
isIstanbul bool
|
}
|
||||||
}{
|
|
||||||
{"Frontier", types.FrontierSigner{}, tt.Result.Frontier, false, false},
|
func (tt *TransactionTest) validateFork(fork *ttFork) error {
|
||||||
{"Homestead", types.HomesteadSigner{}, tt.Result.Homestead, true, false},
|
if fork == nil {
|
||||||
{"EIP150", types.HomesteadSigner{}, tt.Result.EIP150, true, false},
|
return nil
|
||||||
{"EIP158", types.NewEIP155Signer(config.ChainID), tt.Result.EIP158, true, false},
|
}
|
||||||
{"Byzantium", types.NewEIP155Signer(config.ChainID), tt.Result.Byzantium, true, false},
|
if fork.Hash == nil && fork.Exception == nil {
|
||||||
{"Constantinople", types.NewEIP155Signer(config.ChainID), tt.Result.Constantinople, true, false},
|
return fmt.Errorf("missing hash and exception")
|
||||||
{"Istanbul", types.NewEIP155Signer(config.ChainID), tt.Result.Istanbul, true, true},
|
}
|
||||||
} {
|
if fork.Hash != nil && fork.Sender == nil {
|
||||||
sender, txhash, err := validateTx(tt.Txbytes, testcase.signer, testcase.isHomestead, testcase.isIstanbul)
|
return fmt.Errorf("missing sender")
|
||||||
|
}
|
||||||
if testcase.fork.Sender == (common.UnprefixedAddress{}) {
|
return nil
|
||||||
if err == nil {
|
}
|
||||||
return fmt.Errorf("expected error, got none (address %v)[%v]", sender.String(), testcase.name)
|
|
||||||
}
|
func (tt *TransactionTest) Run(config *params.ChainConfig) error {
|
||||||
continue
|
if err := tt.validate(); err != nil {
|
||||||
}
|
return err
|
||||||
// Should resolve the right address
|
}
|
||||||
if err != nil {
|
validateTx := func(rlpData hexutil.Bytes, signer types.Signer, isHomestead, isIstanbul, isShanghai bool) (sender common.Address, hash common.Hash, requiredGas uint64, err error) {
|
||||||
return fmt.Errorf("got error, expected none: %v", err)
|
tx := new(types.Transaction)
|
||||||
}
|
if err = tx.UnmarshalBinary(rlpData); err != nil {
|
||||||
if sender == nil {
|
return
|
||||||
return fmt.Errorf("sender was nil, should be %x", common.Address(testcase.fork.Sender))
|
}
|
||||||
}
|
sender, err = types.Sender(signer, tx)
|
||||||
if *sender != common.Address(testcase.fork.Sender) {
|
if err != nil {
|
||||||
return fmt.Errorf("sender mismatch: got %x, want %x", sender, testcase.fork.Sender)
|
return
|
||||||
}
|
}
|
||||||
if txhash == nil {
|
// Intrinsic gas
|
||||||
return fmt.Errorf("txhash was nil, should be %x", common.Hash(testcase.fork.Hash))
|
requiredGas, err = core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, isHomestead, isIstanbul, isShanghai)
|
||||||
}
|
if err != nil {
|
||||||
if *txhash != common.Hash(testcase.fork.Hash) {
|
return
|
||||||
return fmt.Errorf("hash mismatch: got %x, want %x", *txhash, testcase.fork.Hash)
|
}
|
||||||
|
if requiredGas > tx.Gas() {
|
||||||
|
return sender, hash, 0, fmt.Errorf("insufficient gas ( %d < %d )", tx.Gas(), requiredGas)
|
||||||
|
}
|
||||||
|
hash = tx.Hash()
|
||||||
|
return sender, hash, requiredGas, nil
|
||||||
|
}
|
||||||
|
for _, testcase := range []struct {
|
||||||
|
name string
|
||||||
|
signer types.Signer
|
||||||
|
fork *ttFork
|
||||||
|
isHomestead bool
|
||||||
|
isIstanbul bool
|
||||||
|
isShanghai bool
|
||||||
|
}{
|
||||||
|
{"Frontier", types.FrontierSigner{}, tt.Result["Frontier"], false, false, false},
|
||||||
|
{"Homestead", types.HomesteadSigner{}, tt.Result["Homestead"], true, false, false},
|
||||||
|
{"EIP150", types.HomesteadSigner{}, tt.Result["EIP150"], true, false, false},
|
||||||
|
{"EIP158", types.NewEIP155Signer(config.ChainID), tt.Result["EIP158"], true, false, false},
|
||||||
|
{"Byzantium", types.NewEIP155Signer(config.ChainID), tt.Result["Byzantium"], true, false, false},
|
||||||
|
{"Constantinople", types.NewEIP155Signer(config.ChainID), tt.Result["Constantinople"], true, false, false},
|
||||||
|
{"Istanbul", types.NewEIP155Signer(config.ChainID), tt.Result["Istanbul"], true, true, false},
|
||||||
|
{"Berlin", types.NewEIP2930Signer(config.ChainID), tt.Result["Berlin"], true, true, false},
|
||||||
|
{"London", types.NewLondonSigner(config.ChainID), tt.Result["London"], true, true, false},
|
||||||
|
{"Paris", types.NewLondonSigner(config.ChainID), tt.Result["Paris"], true, true, false},
|
||||||
|
{"Shanghai", types.NewLondonSigner(config.ChainID), tt.Result["Shanghai"], true, true, true},
|
||||||
|
{"Cancun", types.NewCancunSigner(config.ChainID), tt.Result["Cancun"], true, true, true},
|
||||||
|
{"Prague", types.NewPragueSigner(config.ChainID), tt.Result["Prague"], true, true, true},
|
||||||
|
} {
|
||||||
|
if testcase.fork == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
sender, hash, gas, err := validateTx(tt.Txbytes, testcase.signer, testcase.isHomestead, testcase.isIstanbul, testcase.isShanghai)
|
||||||
|
if err != nil {
|
||||||
|
if testcase.fork.Hash != nil {
|
||||||
|
return fmt.Errorf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if testcase.fork.Exception != nil {
|
||||||
|
return fmt.Errorf("expected error %v, got none (%v)", *testcase.fork.Exception, err)
|
||||||
|
}
|
||||||
|
if common.Hash(*testcase.fork.Hash) != hash {
|
||||||
|
return fmt.Errorf("hash mismatch: got %x, want %x", hash, common.Hash(*testcase.fork.Hash))
|
||||||
|
}
|
||||||
|
if common.Address(*testcase.fork.Sender) != sender {
|
||||||
|
return fmt.Errorf("sender mismatch: got %x, want %x", sender, testcase.fork.Sender)
|
||||||
|
}
|
||||||
|
if hash != common.Hash(*testcase.fork.Hash) {
|
||||||
|
return fmt.Errorf("hash mismatch: got %x, want %x", hash, testcase.fork.Hash)
|
||||||
|
}
|
||||||
|
if uint64(testcase.fork.IntrinsicGas) != gas {
|
||||||
|
return fmt.Errorf("intrinsic gas mismatch: got %d, want %d", gas, uint64(testcase.fork.IntrinsicGas))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue