all: implement EIP-1559 (#22837)

This is the initial implementation of EIP-1559 in packages core/types and core.
Mining, RPC, etc. will be added in subsequent commits.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: lightclient@protonmail.com <lightclient@protonmail.com>
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Martin Holst Swende
2021-05-17 15:13:22 +02:00
committed by GitHub
parent 14bc6e5130
commit 94451c2788
59 changed files with 1522 additions and 173 deletions

View File

@ -271,7 +271,7 @@ func (api *API) traceChain(ctx context.Context, start, end *types.Block, config
blockCtx := core.NewEVMBlockContext(task.block.Header(), api.chainContext(localctx), nil)
// Trace all the transactions contained within
for i, tx := range task.block.Transactions() {
msg, _ := tx.AsMessage(signer)
msg, _ := tx.AsMessage(signer, task.block.BaseFee())
txctx := &txTraceContext{
index: i,
hash: tx.Hash(),
@ -523,7 +523,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
defer pend.Done()
// Fetch and execute the next transaction trace tasks
for task := range jobs {
msg, _ := txs[task.index].AsMessage(signer)
msg, _ := txs[task.index].AsMessage(signer, block.BaseFee())
txctx := &txTraceContext{
index: task.index,
hash: txs[task.index].Hash(),
@ -545,7 +545,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
jobs <- &txTraceTask{statedb: statedb.Copy(), index: i}
// Generate the next state snapshot fast without tracing
msg, _ := tx.AsMessage(signer)
msg, _ := tx.AsMessage(signer, block.BaseFee())
statedb.Prepare(tx.Hash(), block.Hash(), i)
vmenv := vm.NewEVM(blockCtx, core.NewEVMTxContext(msg), statedb, api.backend.ChainConfig(), vm.Config{})
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas())); err != nil {
@ -630,7 +630,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
for i, tx := range block.Transactions() {
// Prepare the trasaction for un-traced execution
var (
msg, _ = tx.AsMessage(signer)
msg, _ = tx.AsMessage(signer, block.BaseFee())
txContext = core.NewEVMTxContext(msg)
vmConf vm.Config
dump *os.File