tests: update for London (#22976)
This updates the tests submodule to the London fork tests, and also updates the test runner to support the new EIP-1559 fields in test JSON.
This commit is contained in:
committed by
GitHub
parent
08379b5533
commit
0e9c7d564d
@ -23,6 +23,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
@ -59,9 +60,10 @@ type btJSON struct {
|
||||
}
|
||||
|
||||
type btBlock struct {
|
||||
BlockHeader *btHeader
|
||||
Rlp string
|
||||
UncleHeaders []*btHeader
|
||||
BlockHeader *btHeader
|
||||
ExpectException string
|
||||
Rlp string
|
||||
UncleHeaders []*btHeader
|
||||
}
|
||||
|
||||
//go:generate gencodec -type btHeader -field-override btHeaderMarshaling -out gen_btheader.go
|
||||
@ -83,6 +85,7 @@ type btHeader struct {
|
||||
GasLimit uint64
|
||||
GasUsed uint64
|
||||
Timestamp uint64
|
||||
BaseFee *big.Int
|
||||
}
|
||||
|
||||
type btHeaderMarshaling struct {
|
||||
@ -92,6 +95,7 @@ type btHeaderMarshaling struct {
|
||||
GasLimit math.HexOrDecimal64
|
||||
GasUsed math.HexOrDecimal64
|
||||
Timestamp math.HexOrDecimal64
|
||||
BaseFee *math.HexOrDecimal256
|
||||
}
|
||||
|
||||
func (t *BlockTest) Run(snapshotter bool) error {
|
||||
@ -166,6 +170,7 @@ func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
|
||||
Mixhash: t.json.Genesis.MixHash,
|
||||
Coinbase: t.json.Genesis.Coinbase,
|
||||
Alloc: t.json.Pre,
|
||||
BaseFee: t.json.Genesis.BaseFee,
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,7 +189,7 @@ func (t *BlockTest) genesis(config *params.ChainConfig) *core.Genesis {
|
||||
func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error) {
|
||||
validBlocks := make([]btBlock, 0)
|
||||
// insert the test blocks, which will execute all transactions
|
||||
for _, b := range t.json.Blocks {
|
||||
for bi, b := range t.json.Blocks {
|
||||
cb, err := b.decode()
|
||||
if err != nil {
|
||||
if b.BlockHeader == nil {
|
||||
@ -204,7 +209,12 @@ func (t *BlockTest) insertBlocks(blockchain *core.BlockChain) ([]btBlock, error)
|
||||
}
|
||||
}
|
||||
if b.BlockHeader == nil {
|
||||
return nil, fmt.Errorf("block insertion should have failed")
|
||||
if data, err := json.MarshalIndent(cb.Header(), "", " "); err == nil {
|
||||
fmt.Fprintf(os.Stderr, "block (index %d) insertion should have failed due to: %v:\n%v\n",
|
||||
bi, b.ExpectException, string(data))
|
||||
}
|
||||
return nil, fmt.Errorf("block (index %d) insertion should have failed due to: %v",
|
||||
bi, b.ExpectException)
|
||||
}
|
||||
|
||||
// validate RLP decoding by checking all values against test file JSON
|
||||
|
Reference in New Issue
Block a user