forked from cerc-io/plugeth
tests: update tests/testdata to v9.0.4 (london) (#23279)
This commit is contained in:
parent
5c13012b56
commit
fb8ea5993f
@ -85,17 +85,17 @@ type btHeader struct {
|
|||||||
GasLimit uint64
|
GasLimit uint64
|
||||||
GasUsed uint64
|
GasUsed uint64
|
||||||
Timestamp uint64
|
Timestamp uint64
|
||||||
BaseFee *big.Int
|
BaseFeePerGas *big.Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type btHeaderMarshaling struct {
|
type btHeaderMarshaling struct {
|
||||||
ExtraData hexutil.Bytes
|
ExtraData hexutil.Bytes
|
||||||
Number *math.HexOrDecimal256
|
Number *math.HexOrDecimal256
|
||||||
Difficulty *math.HexOrDecimal256
|
Difficulty *math.HexOrDecimal256
|
||||||
GasLimit math.HexOrDecimal64
|
GasLimit math.HexOrDecimal64
|
||||||
GasUsed math.HexOrDecimal64
|
GasUsed math.HexOrDecimal64
|
||||||
Timestamp math.HexOrDecimal64
|
Timestamp math.HexOrDecimal64
|
||||||
BaseFee *math.HexOrDecimal256
|
BaseFeePerGas *math.HexOrDecimal256
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *BlockTest) Run(snapshotter bool) error {
|
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,
|
Mixhash: t.json.Genesis.MixHash,
|
||||||
Coinbase: t.json.Genesis.Coinbase,
|
Coinbase: t.json.Genesis.Coinbase,
|
||||||
Alloc: t.json.Pre,
|
Alloc: t.json.Pre,
|
||||||
BaseFee: t.json.Genesis.BaseFee,
|
BaseFee: t.json.Genesis.BaseFeePerGas,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
|
|||||||
GasLimit math.HexOrDecimal64
|
GasLimit math.HexOrDecimal64
|
||||||
GasUsed math.HexOrDecimal64
|
GasUsed math.HexOrDecimal64
|
||||||
Timestamp math.HexOrDecimal64
|
Timestamp math.HexOrDecimal64
|
||||||
BaseFee *math.HexOrDecimal256
|
BaseFeePerGas *math.HexOrDecimal256
|
||||||
}
|
}
|
||||||
var enc btHeader
|
var enc btHeader
|
||||||
enc.Bloom = b.Bloom
|
enc.Bloom = b.Bloom
|
||||||
@ -52,7 +52,7 @@ func (b btHeader) MarshalJSON() ([]byte, error) {
|
|||||||
enc.GasLimit = math.HexOrDecimal64(b.GasLimit)
|
enc.GasLimit = math.HexOrDecimal64(b.GasLimit)
|
||||||
enc.GasUsed = math.HexOrDecimal64(b.GasUsed)
|
enc.GasUsed = math.HexOrDecimal64(b.GasUsed)
|
||||||
enc.Timestamp = math.HexOrDecimal64(b.Timestamp)
|
enc.Timestamp = math.HexOrDecimal64(b.Timestamp)
|
||||||
enc.BaseFee = (*math.HexOrDecimal256)(b.BaseFee)
|
enc.BaseFeePerGas = (*math.HexOrDecimal256)(b.BaseFeePerGas)
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
|
|||||||
GasLimit *math.HexOrDecimal64
|
GasLimit *math.HexOrDecimal64
|
||||||
GasUsed *math.HexOrDecimal64
|
GasUsed *math.HexOrDecimal64
|
||||||
Timestamp *math.HexOrDecimal64
|
Timestamp *math.HexOrDecimal64
|
||||||
BaseFee *math.HexOrDecimal256
|
BaseFeePerGas *math.HexOrDecimal256
|
||||||
}
|
}
|
||||||
var dec btHeader
|
var dec btHeader
|
||||||
if err := json.Unmarshal(input, &dec); err != nil {
|
if err := json.Unmarshal(input, &dec); err != nil {
|
||||||
@ -129,8 +129,8 @@ func (b *btHeader) UnmarshalJSON(input []byte) error {
|
|||||||
if dec.Timestamp != nil {
|
if dec.Timestamp != nil {
|
||||||
b.Timestamp = uint64(*dec.Timestamp)
|
b.Timestamp = uint64(*dec.Timestamp)
|
||||||
}
|
}
|
||||||
if dec.BaseFee != nil {
|
if dec.BaseFeePerGas != nil {
|
||||||
b.BaseFee = (*big.Int)(dec.BaseFee)
|
b.BaseFeePerGas = (*big.Int)(dec.BaseFeePerGas)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,10 @@ func TestState(t *testing.T) {
|
|||||||
t.Run(key+"/trie", func(t *testing.T) {
|
t.Run(key+"/trie", func(t *testing.T) {
|
||||||
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
|
withTrace(t, test.gasLimit(subtest), func(vmconfig vm.Config) error {
|
||||||
_, _, err := test.Run(subtest, vmconfig, false)
|
_, _, 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)
|
return st.checkFailure(t, err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -79,6 +83,10 @@ func TestState(t *testing.T) {
|
|||||||
return err
|
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)
|
return st.checkFailure(t, err)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -65,9 +65,11 @@ type stJSON struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type stPostState struct {
|
type stPostState struct {
|
||||||
Root common.UnprefixedHash `json:"hash"`
|
Root common.UnprefixedHash `json:"hash"`
|
||||||
Logs common.UnprefixedHash `json:"logs"`
|
Logs common.UnprefixedHash `json:"logs"`
|
||||||
Indexes struct {
|
TxBytes hexutil.Bytes `json:"txbytes"`
|
||||||
|
ExpectException string `json:"expectException"`
|
||||||
|
Indexes struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Gas int `json:"gas"`
|
Gas int `json:"gas"`
|
||||||
Value int `json:"value"`
|
Value int `json:"value"`
|
||||||
@ -198,6 +200,19 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
|||||||
return nil, nil, common.Hash{}, err
|
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.
|
// Prepare the EVM.
|
||||||
txContext := core.NewEVMTxContext(msg)
|
txContext := core.NewEVMTxContext(msg)
|
||||||
context := core.NewEVMBlockContext(block.Header(), nil, &t.json.Env.Coinbase)
|
context := core.NewEVMBlockContext(block.Header(), nil, &t.json.Env.Coinbase)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit fa0ab110f3f45d1f6786f978ea596a18ecbe8275
|
Subproject commit 5d534e37b80e9310e8c7751f805ca481a451123e
|
Loading…
Reference in New Issue
Block a user