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:
Martin Holst Swende
2021-06-07 14:37:56 +02:00
committed by GitHub
parent 08379b5533
commit 0e9c7d564d
11 changed files with 130 additions and 44 deletions

View File

@ -15,6 +15,7 @@ import (
var _ = (*genesisSpecMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (g Genesis) MarshalJSON() ([]byte, error) {
type Genesis struct {
Config *params.ChainConfig `json:"config"`
@ -29,6 +30,7 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
Number math.HexOrDecimal64 `json:"number"`
GasUsed math.HexOrDecimal64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
BaseFee *big.Int `json:"baseFee"`
}
var enc Genesis
enc.Config = g.Config
@ -48,9 +50,11 @@ func (g Genesis) MarshalJSON() ([]byte, error) {
enc.Number = math.HexOrDecimal64(g.Number)
enc.GasUsed = math.HexOrDecimal64(g.GasUsed)
enc.ParentHash = g.ParentHash
enc.BaseFee = g.BaseFee
return json.Marshal(&enc)
}
// UnmarshalJSON unmarshals from JSON.
func (g *Genesis) UnmarshalJSON(input []byte) error {
type Genesis struct {
Config *params.ChainConfig `json:"config"`
@ -65,6 +69,7 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
Number *math.HexOrDecimal64 `json:"number"`
GasUsed *math.HexOrDecimal64 `json:"gasUsed"`
ParentHash *common.Hash `json:"parentHash"`
BaseFee *big.Int `json:"baseFee"`
}
var dec Genesis
if err := json.Unmarshal(input, &dec); err != nil {
@ -112,5 +117,8 @@ func (g *Genesis) UnmarshalJSON(input []byte) error {
if dec.ParentHash != nil {
g.ParentHash = *dec.ParentHash
}
if dec.BaseFee != nil {
g.BaseFee = dec.BaseFee
}
return nil
}