diff --git a/tests/block_test_util.go b/tests/block_test_util.go index c9c0afb1b..bcf861e09 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -85,17 +85,17 @@ type btHeader struct { GasLimit uint64 GasUsed uint64 Timestamp uint64 - BaseFee *big.Int + BaseFeePerGas *big.Int } type btHeaderMarshaling struct { - ExtraData hexutil.Bytes - Number *math.HexOrDecimal256 - Difficulty *math.HexOrDecimal256 - GasLimit math.HexOrDecimal64 - GasUsed math.HexOrDecimal64 - Timestamp math.HexOrDecimal64 - BaseFee *math.HexOrDecimal256 + ExtraData hexutil.Bytes + Number *math.HexOrDecimal256 + Difficulty *math.HexOrDecimal256 + GasLimit math.HexOrDecimal64 + GasUsed math.HexOrDecimal64 + Timestamp math.HexOrDecimal64 + BaseFeePerGas *math.HexOrDecimal256 } func (t *BlockTest) Run(snapshotter bool) error { @@ -170,7 +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, + BaseFee: t.json.Genesis.BaseFeePerGas, } } diff --git a/tests/gen_btheader.go b/tests/gen_btheader.go index 07df1ecb3..4387f8db4 100644 --- a/tests/gen_btheader.go +++ b/tests/gen_btheader.go @@ -33,7 +33,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) { GasLimit math.HexOrDecimal64 GasUsed math.HexOrDecimal64 Timestamp math.HexOrDecimal64 - BaseFee *math.HexOrDecimal256 + BaseFeePerGas *math.HexOrDecimal256 } var enc btHeader enc.Bloom = b.Bloom @@ -52,7 +52,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) { enc.GasLimit = math.HexOrDecimal64(b.GasLimit) enc.GasUsed = math.HexOrDecimal64(b.GasUsed) enc.Timestamp = math.HexOrDecimal64(b.Timestamp) - enc.BaseFee = (*math.HexOrDecimal256)(b.BaseFee) + enc.BaseFeePerGas = (*math.HexOrDecimal256)(b.BaseFeePerGas) return json.Marshal(&enc) } @@ -75,7 +75,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { GasLimit *math.HexOrDecimal64 GasUsed *math.HexOrDecimal64 Timestamp *math.HexOrDecimal64 - BaseFee *math.HexOrDecimal256 + BaseFeePerGas *math.HexOrDecimal256 } var dec btHeader if err := json.Unmarshal(input, &dec); err != nil { @@ -129,8 +129,8 @@ func (b *btHeader) UnmarshalJSON(input []byte) error { if dec.Timestamp != nil { b.Timestamp = uint64(*dec.Timestamp) } - if dec.BaseFee != nil { - b.BaseFee = (*big.Int)(dec.BaseFee) + if dec.BaseFeePerGas != nil { + b.BaseFeePerGas = (*big.Int)(dec.BaseFeePerGas) } return nil } diff --git a/tests/state_test.go b/tests/state_test.go index 2ed98b650..c2ca0e8d6 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -68,6 +68,10 @@ func TestState(t *testing.T) { t.Run(key+"/trie", func(t *testing.T) { withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error { _, _, err := test.Run(subtest, vmconfig, false) + if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { + // Ignore expected errors (TODO MariusVanDerWijden check error string) + return nil + } return st.checkFailure(t, err) }) }) @@ -79,6 +83,10 @@ func TestState(t *testing.T) { return err } } + if err != nil && len(test.json.Post[subtest.Fork][subtest.Index].ExpectException) > 0 { + // Ignore expected errors (TODO MariusVanDerWijden check error string) + return nil + } return st.checkFailure(t, err) }) }) diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 97fd3fb6a..4f57fee89 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -65,9 +65,11 @@ type stJSON struct { } type stPostState struct { - Root common.UnprefixedHash `json:"hash"` - Logs common.UnprefixedHash `json:"logs"` - Indexes struct { + Root common.UnprefixedHash `json:"hash"` + Logs common.UnprefixedHash `json:"logs"` + TxBytes hexutil.Bytes `json:"txbytes"` + ExpectException string `json:"expectException"` + Indexes struct { Data int `json:"data"` Gas int `json:"gas"` Value int `json:"value"` @@ -198,6 +200,19 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh return nil, nil, common.Hash{}, err } + // Try to recover tx with current signer + if len(post.TxBytes) != 0 { + var ttx types.Transaction + err := ttx.UnmarshalBinary(post.TxBytes) + if err != nil { + return nil, nil, common.Hash{}, err + } + + if _, err := types.Sender(types.LatestSigner(config), &ttx); err != nil { + return nil, nil, common.Hash{}, err + } + } + // Prepare the EVM. txContext := core.NewEVMTxContext(msg) context := core.NewEVMBlockContext(block.Header(), nil, &t.json.Env.Coinbase) diff --git a/tests/testdata b/tests/testdata index fa0ab110f..5d534e37b 160000 --- a/tests/testdata +++ b/tests/testdata @@ -1 +1 @@ -Subproject commit fa0ab110f3f45d1f6786f978ea596a18ecbe8275 +Subproject commit 5d534e37b80e9310e8c7751f805ca481a451123e