diff --git a/cmd/evm/internal/t8ntool/execution.go b/cmd/evm/internal/t8ntool/execution.go index 5d11240c14..eb26bde584 100644 --- a/cmd/evm/internal/t8ntool/execution.go +++ b/cmd/evm/internal/t8ntool/execution.go @@ -166,7 +166,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, // If excessBlobGas is defined, add it to the vmContext. if pre.Env.ExcessBlobGas != nil { vmContext.ExcessBlobGas = pre.Env.ExcessBlobGas - vmContext.BlobFee = eip4844.CalcBlobFee(*pre.Env.ExcessBlobGas) + vmContext.BlobBaseFee = eip4844.CalcBlobFee(*pre.Env.ExcessBlobGas) } else { // If it is not explicitly defined, but we have the parent values, we try // to calculate it ourselves. @@ -175,7 +175,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig, if parentExcessBlobGas != nil && parentBlobGasUsed != nil { excessBlobGas := eip4844.CalcExcessBlobGas(*parentExcessBlobGas, *parentBlobGasUsed) 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 diff --git a/cmd/evm/runner.go b/cmd/evm/runner.go index 4539089884..45fc985351 100644 --- a/cmd/evm/runner.go +++ b/cmd/evm/runner.go @@ -124,7 +124,7 @@ func runCmd(ctx *cli.Context) error { receiver = common.BytesToAddress([]byte("receiver")) preimages = ctx.Bool(DumpFlag.Name) 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) { tracer = logger.NewJSONLogger(logconfig, os.Stdout) @@ -222,7 +222,7 @@ func runCmd(ctx *cli.Context) error { Coinbase: genesisConfig.Coinbase, BlockNumber: new(big.Int).SetUint64(genesisConfig.Number), BlobHashes: blobHashes, - BlobFee: blobFee, + BlobBaseFee: blobBaseFee, EVMConfig: vm.Config{ Tracer: tracer, }, diff --git a/core/evm.go b/core/evm.go index 1ef777b769..c6625af705 100644 --- a/core/evm.go +++ b/core/evm.go @@ -41,7 +41,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common var ( beneficiary common.Address baseFee *big.Int - blobFee *big.Int + blobBaseFee *big.Int random *common.Hash ) @@ -55,7 +55,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common baseFee = new(big.Int).Set(header.BaseFee) } if header.ExcessBlobGas != nil { - blobFee = eip4844.CalcBlobFee(*header.ExcessBlobGas) + blobBaseFee = eip4844.CalcBlobFee(*header.ExcessBlobGas) } if header.Difficulty.Cmp(common.Big0) == 0 { random = &header.MixDigest @@ -69,7 +69,7 @@ func NewEVMBlockContext(header *types.Header, chain ChainContext, author *common Time: header.Time, Difficulty: new(big.Int).Set(header.Difficulty), BaseFee: baseFee, - BlobFee: blobFee, + BlobBaseFee: blobBaseFee, GasLimit: header.GasLimit, Random: random, ExcessBlobGas: header.ExcessBlobGas, diff --git a/core/vm/eips.go b/core/vm/eips.go index 827c69ba72..147883dd72 100644 --- a/core/vm/eips.go +++ b/core/vm/eips.go @@ -282,10 +282,10 @@ func opBlobHash(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([ return nil, nil } -// opBlobFee implements BLOBBASEFEE opcode -func opBlobFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { - blobFee, _ := uint256.FromBig(interpreter.evm.Context.BlobFee) - scope.Stack.push(blobFee) +// opBlobBaseFee implements BLOBBASEFEE opcode +func opBlobBaseFee(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) { + blobBaseFee, _ := uint256.FromBig(interpreter.evm.Context.BlobBaseFee) + scope.Stack.push(blobBaseFee) return nil, nil } @@ -299,7 +299,7 @@ func enable4844(jt *JumpTable) { maxStack: maxStack(1, 1), } jt[BLOBBASEFEE] = &operation{ - execute: opBlobFee, + execute: opBlobBaseFee, constantGas: GasQuickStep, minStack: minStack(0, 1), maxStack: maxStack(0, 1), diff --git a/core/vm/evm.go b/core/vm/evm.go index c20460a5c5..1dbcfff194 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -73,7 +73,7 @@ type BlockContext struct { Time uint64 // Provides information for TIME Difficulty *big.Int // Provides information for DIFFICULTY 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 ExcessBlobGas *uint64 // ExcessBlobGas field in the header, needed to compute the data } diff --git a/core/vm/runtime/env.go b/core/vm/runtime/env.go index ce44d4d24d..64aa550a25 100644 --- a/core/vm/runtime/env.go +++ b/core/vm/runtime/env.go @@ -37,7 +37,7 @@ func NewEnv(cfg *Config) *vm.EVM { Difficulty: cfg.Difficulty, GasLimit: cfg.GasLimit, BaseFee: cfg.BaseFee, - BlobFee: cfg.BlobFee, + BlobBaseFee: cfg.BlobBaseFee, Random: cfg.Random, } diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go index 0f4a27d04e..cfd7e4dbc4 100644 --- a/core/vm/runtime/runtime.go +++ b/core/vm/runtime/runtime.go @@ -44,7 +44,7 @@ type Config struct { Debug bool EVMConfig vm.Config BaseFee *big.Int - BlobFee *big.Int + BlobBaseFee *big.Int BlobHashes []common.Hash Random *common.Hash @@ -96,8 +96,8 @@ func setDefaults(cfg *Config) { if cfg.BaseFee == nil { cfg.BaseFee = big.NewInt(params.InitialBaseFee) } - if cfg.BlobFee == nil { - cfg.BlobFee = new(big.Int) + if cfg.BlobBaseFee == nil { + cfg.BlobBaseFee = new(big.Int) } } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 13ec5058c2..2049432e15 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -991,14 +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 - BlobFee *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. @@ -1027,8 +1027,8 @@ func (diff *BlockOverrides) Apply(blockCtx *vm.BlockContext) { if diff.BaseFee != nil { blockCtx.BaseFee = diff.BaseFee.ToInt() } - if diff.BlobFee != nil { - blockCtx.BlobFee = diff.BlobFee.ToInt() + if diff.BlobBaseFee != nil { + blockCtx.BlobBaseFee = diff.BlobBaseFee.ToInt() } }