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

@ -16,17 +16,21 @@ var _ = (*stTransactionMarshaling)(nil)
// MarshalJSON marshals as JSON.
func (s stTransaction) MarshalJSON() ([]byte, error) {
type stTransaction struct {
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
Nonce math.HexOrDecimal64 `json:"nonce"`
To string `json:"to"`
Data []string `json:"data"`
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey hexutil.Bytes `json:"secretKey"`
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
Nonce math.HexOrDecimal64 `json:"nonce"`
To string `json:"to"`
Data []string `json:"data"`
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey hexutil.Bytes `json:"secretKey"`
}
var enc stTransaction
enc.GasPrice = (*math.HexOrDecimal256)(s.GasPrice)
enc.MaxFeePerGas = (*math.HexOrDecimal256)(s.MaxFeePerGas)
enc.MaxPriorityFeePerGas = (*math.HexOrDecimal256)(s.MaxPriorityFeePerGas)
enc.Nonce = math.HexOrDecimal64(s.Nonce)
enc.To = s.To
enc.Data = s.Data
@ -45,14 +49,16 @@ func (s stTransaction) MarshalJSON() ([]byte, error) {
// UnmarshalJSON unmarshals from JSON.
func (s *stTransaction) UnmarshalJSON(input []byte) error {
type stTransaction struct {
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
Nonce *math.HexOrDecimal64 `json:"nonce"`
To *string `json:"to"`
Data []string `json:"data"`
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey *hexutil.Bytes `json:"secretKey"`
GasPrice *math.HexOrDecimal256 `json:"gasPrice"`
MaxFeePerGas *math.HexOrDecimal256 `json:"maxFeePerGas"`
MaxPriorityFeePerGas *math.HexOrDecimal256 `json:"maxPriorityFeePerGas"`
Nonce *math.HexOrDecimal64 `json:"nonce"`
To *string `json:"to"`
Data []string `json:"data"`
AccessLists []*types.AccessList `json:"accessLists,omitempty"`
GasLimit []math.HexOrDecimal64 `json:"gasLimit"`
Value []string `json:"value"`
PrivateKey *hexutil.Bytes `json:"secretKey"`
}
var dec stTransaction
if err := json.Unmarshal(input, &dec); err != nil {
@ -61,6 +67,12 @@ func (s *stTransaction) UnmarshalJSON(input []byte) error {
if dec.GasPrice != nil {
s.GasPrice = (*big.Int)(dec.GasPrice)
}
if dec.MaxFeePerGas != nil {
s.MaxFeePerGas = (*big.Int)(dec.MaxFeePerGas)
}
if dec.MaxPriorityFeePerGas != nil {
s.MaxPriorityFeePerGas = (*big.Int)(dec.MaxPriorityFeePerGas)
}
if dec.Nonce != nil {
s.Nonce = uint64(*dec.Nonce)
}