tests: update (#26548)

This updates the reference tests to the latest version.

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Martin Holst Swende
2023-02-06 14:52:51 -05:00
committed by GitHub
co-authored by Felix Lange
parent 37e3208e33
commit 91cb6f863a
7 changed files with 50 additions and 7 deletions
+8
View File
@@ -24,6 +24,7 @@ import (
"fmt"
"math/big"
"os"
"reflect"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@@ -87,6 +88,7 @@ type btHeader struct {
GasUsed uint64
Timestamp uint64
BaseFeePerGas *big.Int
WithdrawalsRoot *common.Hash
}
type btHeaderMarshaling struct {
@@ -275,6 +277,12 @@ func validateHeader(h *btHeader, h2 *types.Header) error {
if h.Timestamp != h2.Time {
return fmt.Errorf("timestamp: want: %v have: %v", h.Timestamp, h2.Time)
}
if !reflect.DeepEqual(h.BaseFeePerGas, h2.BaseFee) {
return fmt.Errorf("baseFeePerGas: want: %v have: %v", h.BaseFeePerGas, h2.BaseFee)
}
if !reflect.DeepEqual(h.WithdrawalsRoot, h2.WithdrawalsHash) {
return fmt.Errorf("withdrawalsRoot: want: %v have: %v", h.WithdrawalsRoot, h2.WithdrawalsHash)
}
return nil
}
+6
View File
@@ -34,6 +34,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
GasUsed math.HexOrDecimal64
Timestamp math.HexOrDecimal64
BaseFeePerGas *math.HexOrDecimal256
WithdrawalsRoot *common.Hash
}
var enc btHeader
enc.Bloom = b.Bloom
@@ -53,6 +54,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
enc.GasUsed = math.HexOrDecimal64(b.GasUsed)
enc.Timestamp = math.HexOrDecimal64(b.Timestamp)
enc.BaseFeePerGas = (*math.HexOrDecimal256)(b.BaseFeePerGas)
enc.WithdrawalsRoot = b.WithdrawalsRoot
return json.Marshal(&enc)
}
@@ -76,6 +78,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
GasUsed *math.HexOrDecimal64
Timestamp *math.HexOrDecimal64
BaseFeePerGas *math.HexOrDecimal256
WithdrawalsRoot *common.Hash
}
var dec btHeader
if err := json.Unmarshal(input, &dec); err != nil {
@@ -132,5 +135,8 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
if dec.BaseFeePerGas != nil {
b.BaseFeePerGas = (*big.Int)(dec.BaseFeePerGas)
}
if dec.WithdrawalsRoot != nil {
b.WithdrawalsRoot = dec.WithdrawalsRoot
}
return nil
}
+18
View File
@@ -268,6 +268,24 @@ var Forks = map[string]*params.ChainConfig{
TerminalTotalDifficulty: big.NewInt(0),
ShanghaiTime: u64(0),
},
"MergeToShanghaiAtTime15k": {
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),
MergeNetsplitBlock: big.NewInt(0),
TerminalTotalDifficulty: big.NewInt(0),
ShanghaiTime: u64(15_000),
},
}
// AvailableForks returns the set of defined fork names
+4 -4
View File
@@ -56,11 +56,11 @@ 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:
//
// The stEOF tests are generated with EOF as part of Shanghai, which
// is erroneous. Therefore, these tests are skipped.
st.skipLoad(`^EIPTests/stEOF/`)
// Expected failures:
// For Istanbul, older tests were moved into LegacyTests