forked from cerc-io/plugeth
tests: update tests (#26314)
This PR builds on #26299, but also updates the tests to the most recent version, which includes tests regarding TheMerge. This change adds checks to the beacon consensus engine, making it more strict in validating the pre- and post-headers, and not relying on the caller to have already correctly sanitized the headers/blocks.
This commit is contained in:
@@ -46,6 +46,7 @@ func TestBlockchain(t *testing.T) {
|
||||
// test takes a lot for time and goes easily OOM because of sha3 calculation on a huge range,
|
||||
// using 4.6 TGas
|
||||
bt.skipLoad(`.*randomStatetest94.json.*`)
|
||||
|
||||
bt.walk(t, blockTestDir, func(t *testing.T, name string, test *BlockTest) {
|
||||
if err := bt.checkFailure(t, test.Run(false)); err != nil {
|
||||
t.Errorf("test without snapshotter failed: %v", err)
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/common/math"
|
||||
"github.com/ethereum/go-ethereum/consensus"
|
||||
"github.com/ethereum/go-ethereum/consensus/beacon"
|
||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
@@ -120,6 +121,9 @@ func (t *BlockTest) Run(snapshotter bool) error {
|
||||
} else {
|
||||
engine = ethash.NewShared()
|
||||
}
|
||||
// Wrap the original engine within the beacon-engine
|
||||
engine = beacon.New(engine)
|
||||
|
||||
cache := &core.CacheConfig{TrieCleanLimit: 0}
|
||||
if snapshotter {
|
||||
cache.SnapshotLimit = 1
|
||||
|
||||
+19
-1
@@ -197,6 +197,24 @@ var Forks = map[string]*params.ChainConfig{
|
||||
LondonBlock: big.NewInt(0),
|
||||
ArrowGlacierBlock: big.NewInt(0),
|
||||
},
|
||||
"ArrowGlacierToMergeAtDiffC0000": {
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
EIP155Block: big.NewInt(0),
|
||||
EIP158Block: big.NewInt(0),
|
||||
ByzantiumBlock: big.NewInt(0),
|
||||
ConstantinopleBlock: big.NewInt(0),
|
||||
PetersburgBlock: big.NewInt(0),
|
||||
IstanbulBlock: big.NewInt(0),
|
||||
MuirGlacierBlock: big.NewInt(0),
|
||||
BerlinBlock: big.NewInt(0),
|
||||
LondonBlock: big.NewInt(0),
|
||||
ArrowGlacierBlock: big.NewInt(0),
|
||||
GrayGlacierBlock: big.NewInt(0),
|
||||
MergeNetsplitBlock: big.NewInt(0),
|
||||
TerminalTotalDifficulty: big.NewInt(0xC0000),
|
||||
},
|
||||
"GrayGlacier": {
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
@@ -213,7 +231,7 @@ var Forks = map[string]*params.ChainConfig{
|
||||
ArrowGlacierBlock: big.NewInt(0),
|
||||
GrayGlacierBlock: big.NewInt(0),
|
||||
},
|
||||
"Merged": {
|
||||
"Merge": {
|
||||
ChainID: big.NewInt(1),
|
||||
HomesteadBlock: big.NewInt(0),
|
||||
EIP150Block: big.NewInt(0),
|
||||
|
||||
+4
-6
@@ -56,14 +56,12 @@ func TestState(t *testing.T) {
|
||||
// Uses 1GB RAM per tested fork
|
||||
st.skipLoad(`^stStaticCall/static_Call1MB`)
|
||||
|
||||
// Not yet supported TODO
|
||||
st.skipLoad(`^stEIP3540/`)
|
||||
st.skipLoad(`^stEIP3860/`)
|
||||
|
||||
// Broken tests:
|
||||
// Expected failures:
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/0`, "bug in test")
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/3`, "bug in test")
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
|
||||
// st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test")
|
||||
|
||||
// For Istanbul, older tests were moved into LegacyTests
|
||||
for _, dir := range []string{
|
||||
|
||||
@@ -249,10 +249,16 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
||||
context.GetHash = vmTestBlockHash
|
||||
context.BaseFee = baseFee
|
||||
context.Random = nil
|
||||
if config.IsLondon(new(big.Int)) && t.json.Env.Random != nil {
|
||||
rnd := common.BigToHash(t.json.Env.Random)
|
||||
context.Random = &rnd
|
||||
if config.IsLondon(new(big.Int)) {
|
||||
if t.json.Env.Random != nil {
|
||||
rnd := common.BigToHash(t.json.Env.Random)
|
||||
context.Random = &rnd
|
||||
}
|
||||
context.Difficulty = big.NewInt(0)
|
||||
} else {
|
||||
if t.json.Env.Difficulty != nil {
|
||||
context.Difficulty = new(big.Int).Set(t.json.Env.Difficulty)
|
||||
}
|
||||
}
|
||||
evm := vm.NewEVM(context, txContext, statedb, config, vmconfig)
|
||||
// Execute the message.
|
||||
|
||||
+1
-1
Submodule tests/testdata updated: a380655e5f...24fa31adb3
Reference in New Issue
Block a user