core: rename blobfee -> blobbasefee

This commit is contained in:
Marius van der Wijden 2023-09-21 17:40:32 +02:00
parent a09c7f1f06
commit 9f1bd25939
8 changed files with 27 additions and 27 deletions

View file

@ -166,7 +166,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
// If excessBlobGas is defined, add it to the vmContext. // If excessBlobGas is defined, add it to the vmContext.
if pre.Env.ExcessBlobGas != nil { if pre.Env.ExcessBlobGas != nil {
vmContext.ExcessBlobGas = pre.Env.ExcessBlobGas vmContext.ExcessBlobGas = pre.Env.ExcessBlobGas
vmContext.BlobFee = eip4844.CalcBlobFee(*pre.Env.ExcessBlobGas) vmContext.BlobBaseFee = eip4844.CalcBlobFee(*pre.Env.ExcessBlobGas)
} else { } else {
// If it is not explicitly defined, but we have the parent values, we try // If it is not explicitly defined, but we have the parent values, we try
// to calculate it ourselves. // to calculate it ourselves.
@ -175,7 +175,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
if parentExcessBlobGas != nil && parentBlobGasUsed != nil { if parentExcessBlobGas != nil && parentBlobGasUsed != nil {
excessBlobGas := eip4844.CalcExcessBlobGas(*parentExcessBlobGas, *parentBlobGasUsed) excessBlobGas := eip4844.CalcExcessBlobGas(*parentExcessBlobGas, *parentBlobGasUsed)
vmContext.ExcessBlobGas = &excessBlobGas vmContext.ExcessBlobGas = &excessBlobGas
vmContext.BlobFee = eip4844.CalcBlobFee(excessBlobGas) vmContext.BlobBaseFee = eip4844.CalcBlobFee(excessBlobGas)
} }
} }
// If DAO is supported/enabled, we need to handle it here. In geth 'proper', it's // If DAO is supported/enabled, we need to handle it here. In geth 'proper', it's

View file

@ -124,7 +124,7 @@ func runCmd(ctx *cli.Context) error {
receiver = common.BytesToAddress([]byte("receiver")) receiver = common.BytesToAddress([]byte("receiver"))
preimages = ctx.Bool(DumpFlag.Name) preimages = ctx.Bool(DumpFlag.Name)
blobHashes []common.Hash // TODO (MariusVanDerWijden) implement blob hashes in state tests blobHashes []common.Hash // TODO (MariusVanDerWijden) implement blob hashes in state tests
blobFee = new(big.Int) // TODO (MariusVanDerWijden) implement blob fee in state tests blobBaseFee = new(big.Int) // TODO (MariusVanDerWijden) implement blob fee in state tests
) )
if ctx.Bool(MachineFlag.Name) { if ctx.Bool(MachineFlag.Name) {
tracer = logger.NewJSONLogger(logconfig, os.Stdout) tracer = logger.NewJSONLogger(logconfig, os.Stdout)
@ -222,7 +222,7 @@ func runCmd(ctx *cli.Context) error {
Coinbase: genesisConfig.Coinbase, Coinbase: genesisConfig.Coinbase,
BlockNumber: new(big.Int).SetUint64(genesisConfig.Number), BlockNumber: new(big.Int).SetUint64(genesisConfig.Number),
BlobHashes: blobHashes, BlobHashes: blobHashes,
BlobFee: blobFee, BlobBaseFee: blobBaseFee,
EVMConfig: vm.Config{ EVMConfig: vm.Config{
Tracer: tracer, Tracer: tracer,
}, },

View file

@ -41,7 +41,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common
var ( var (
beneficiary common.Address beneficiary common.Address
baseFee *big.Int baseFee *big.Int
blobFee *big.Int blobBaseFee *big.Int
random *common.Hash random *common.Hash
) )
@ -55,7 +55,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common
baseFee = new(big.Int).Set(header.BaseFee) baseFee = new(big.Int).Set(header.BaseFee)
} }
if header.ExcessBlobGas != nil { if header.ExcessBlobGas != nil {
blobFee = eip4844.CalcBlobFee(*header.ExcessBlobGas) blobBaseFee = eip4844.CalcBlobFee(*header.ExcessBlobGas)
} }
if header.Difficulty.Cmp(common.Big0) == 0 { if header.Difficulty.Cmp(common.Big0) == 0 {
random = &header.MixDigest random = &header.MixDigest
@ -69,7 +69,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common
Time: header.Time, Time: header.Time,
Difficulty: new(big.Int).Set(header.Difficulty), Difficulty: new(big.Int).Set(header.Difficulty),
BaseFee: baseFee, BaseFee: baseFee,
BlobFee: blobFee, BlobBaseFee: blobBaseFee,
GasLimit: header.GasLimit, GasLimit: header.GasLimit,
Random: random, Random: random,
ExcessBlobGas: header.ExcessBlobGas, ExcessBlobGas: header.ExcessBlobGas,

View file

@ -282,10 +282,10 @@ func opBlobHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([
return nil, nil return nil, nil
} }
// opBlobFee implements BLOBBASEFEE opcode // opBlobBaseFee implements BLOBBASEFEE opcode
func opBlobFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { func opBlobBaseFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
blobFee, _ := uint256.FromBig(interpreter.evm.Context.BlobFee) blobBaseFee, _ := uint256.FromBig(interpreter.evm.Context.BlobBaseFee)
scope.Stack.push(blobFee) scope.Stack.push(blobBaseFee)
return nil, nil return nil, nil
} }
@ -299,7 +299,7 @@ func enable4844(jt *JumpTable) {
maxStack: maxStack(1, 1), maxStack: maxStack(1, 1),
} }
jt[BLOBBASEFEE] = &operation{ jt[BLOBBASEFEE] = &operation{
execute: opBlobFee, execute: opBlobBaseFee,
constantGas: GasQuickStep, constantGas: GasQuickStep,
minStack: minStack(0, 1), minStack: minStack(0, 1),
maxStack: maxStack(0, 1), maxStack: maxStack(0, 1),

View file

@ -73,7 +73,7 @@ type BlockContext struct {
Time uint64 // Provides information for TIME Time uint64 // Provides information for TIME
Difficulty *big.Int // Provides information for DIFFICULTY Difficulty *big.Int // Provides information for DIFFICULTY
BaseFee *big.Int // Provides information for BASEFEE BaseFee *big.Int // Provides information for BASEFEE
BlobFee *big.Int // Provides information for BLOBBASEFEE BlobBaseFee *big.Int // Provides information for BLOBBASEFEE
Random *common.Hash // Provides information for PREVRANDAO Random *common.Hash // Provides information for PREVRANDAO
ExcessBlobGas *uint64 // ExcessBlobGas field in the header, needed to compute the data ExcessBlobGas *uint64 // ExcessBlobGas field in the header, needed to compute the data
} }

View file

@ -37,7 +37,7 @@ func NewEnv(cfg *Config) *vm.EVM {
Difficulty: cfg.Difficulty, Difficulty: cfg.Difficulty,
GasLimit: cfg.GasLimit, GasLimit: cfg.GasLimit,
BaseFee: cfg.BaseFee, BaseFee: cfg.BaseFee,
BlobFee: cfg.BlobFee, BlobBaseFee: cfg.BlobBaseFee,
Random: cfg.Random, Random: cfg.Random,
} }

View file

@ -44,7 +44,7 @@ type Config struct {
Debug bool Debug bool
EVMConfig vm.Config EVMConfig vm.Config
BaseFee *big.Int BaseFee *big.Int
BlobFee *big.Int BlobBaseFee *big.Int
BlobHashes []common.Hash BlobHashes []common.Hash
Random *common.Hash Random *common.Hash
@ -96,8 +96,8 @@ func setDefaults(cfg *Config) {
if cfg.BaseFee == nil { if cfg.BaseFee == nil {
cfg.BaseFee = big.NewInt(params.InitialBaseFee) cfg.BaseFee = big.NewInt(params.InitialBaseFee)
} }
if cfg.BlobFee == nil { if cfg.BlobBaseFee == nil {
cfg.BlobFee = new(big.Int) cfg.BlobBaseFee = new(big.Int)
} }
} }

View file

@ -991,14 +991,14 @@ func (diff *StateOverride) Apply(state *state.StateDB) error {
// BlockOverrides is a set of header fields to override. // BlockOverrides is a set of header fields to override.
type BlockOverrides struct { type BlockOverrides struct {
Number *hexutil.Big Number *hexutil.Big
Difficulty *hexutil.Big Difficulty *hexutil.Big
Time *hexutil.Uint64 Time *hexutil.Uint64
GasLimit *hexutil.Uint64 GasLimit *hexutil.Uint64
Coinbase *common.Address Coinbase *common.Address
Random *common.Hash Random *common.Hash
BaseFee *hexutil.Big BaseFee *hexutil.Big
BlobFee *hexutil.Big BlobBaseFee *hexutil.Big
} }
// Apply overrides the given header fields into the given block context. // Apply overrides the given header fields into the given block context.
@ -1027,8 +1027,8 @@ func (diff *BlockOverrides) Apply(blockCtx *vm.BlockContext) {
if diff.BaseFee != nil { if diff.BaseFee != nil {
blockCtx.BaseFee = diff.BaseFee.ToInt() blockCtx.BaseFee = diff.BaseFee.ToInt()
} }
if diff.BlobFee != nil { if diff.BlobBaseFee != nil {
blockCtx.BlobFee = diff.BlobFee.ToInt() blockCtx.BlobBaseFee = diff.BlobBaseFee.ToInt()
} }
} }