core: implement BLOBBASEFEE opcode (0x4a) (#28098)

Implements "EIP-7516: BLOBBASEFEE opcode" for cancun, as per spec: https://eips.ethereum.org/EIPS/eip-7516
This commit is contained in:
Marius van der Wijden
2023-10-02 05:49:29 -04:00
committed by GitHub
parent 7b6ff527d5
commit c39cbc1a78
12 changed files with 78 additions and 42 deletions
+11 -7
View File
@@ -991,13 +991,14 @@ func (diff *StateOverride) Apply(state *state.StateDB) error {
// BlockOverrides is a set of header fields to override.
type BlockOverrides struct {
Number *hexutil.Big
Difficulty *hexutil.Big
Time *hexutil.Uint64
GasLimit *hexutil.Uint64
Coinbase *common.Address
Random *common.Hash
BaseFee *hexutil.Big
Number *hexutil.Big
Difficulty *hexutil.Big
Time *hexutil.Uint64
GasLimit *hexutil.Uint64
Coinbase *common.Address
Random *common.Hash
BaseFee *hexutil.Big
BlobBaseFee *hexutil.Big
}
// Apply overrides the given header fields into the given block context.
@@ -1026,6 +1027,9 @@ func (diff *BlockOverrides) Apply(blockCtx *vm.BlockContext) {
if diff.BaseFee != nil {
blockCtx.BaseFee = diff.BaseFee.ToInt()
}
if diff.BlobBaseFee != nil {
blockCtx.BlobBaseFee = diff.BlobBaseFee.ToInt()
}
}
// ChainContextBackend provides methods required to implement ChainContext.