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

@ -52,7 +52,7 @@ type ExecutionResult struct {
LogsHash common.Hash `json:"logsHash"`
Bloom types.Bloom `json:"logsBloom" gencodec:"required"`
Receipts types.Receipts `json:"receipts"`
Rejected []int `json:"rejected,omitempty"`
Rejected []*rejectedTx `json:"rejected,omitempty"`
}
type ommer struct {
@ -81,6 +81,11 @@ type stEnvMarshaling struct {
BaseFee *math.HexOrDecimal256
}
type rejectedTx struct {
Index int `json:"index"`
Err string `json:"error"`
}
// Apply applies a set of transactions to a pre-state
func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
txs types.Transactions, miningReward int64,
@ -105,7 +110,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number))
gaspool = new(core.GasPool)
blockHash = common.Hash{0x13, 0x37}
rejectedTxs []int
rejectedTxs []*rejectedTx
includedTxs types.Transactions
gasUsed = uint64(0)
receipts = make(types.Receipts, 0)
@ -137,8 +142,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
for i, tx := range txs {
msg, err := tx.AsMessage(signer, pre.Env.BaseFee)
if err != nil {
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "error", err)
rejectedTxs = append(rejectedTxs, i)
log.Warn("rejected tx", "index", i, "hash", tx.Hash(), "error", err)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
continue
}
tracer, err := getTracerFn(txIndex, tx.Hash())
@ -157,7 +162,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
if err != nil {
statedb.RevertToSnapshot(snapshot)
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From(), "error", err)
rejectedTxs = append(rejectedTxs, i)
rejectedTxs = append(rejectedTxs, &rejectedTx{i, err.Error()})
continue
}
includedTxs = append(includedTxs, tx)