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

@ -253,7 +253,7 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
time = parent.Time() + 10 // block time is fixed at 10 seconds
}
return &types.Header{
header := &types.Header{
Root: state.IntermediateRoot(chain.Config().IsEIP158(parent.Number())),
ParentHash: parent.Hash(),
Coinbase: parent.Coinbase(),
@ -267,6 +267,12 @@ func makeHeader(chain consensus.ChainReader, parent *types.Block, state *state.S
Number: new(big.Int).Add(parent.Number(), common.Big1),
Time: time,
}
if chain.Config().IsLondon(parent.Number()) {
header.BaseFee = misc.CalcBaseFee(chain.Config(), parent.Header())
}
return header
}
// makeHeaderChain creates a deterministic chain of headers rooted at parent.