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 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

View file

@ -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,
},

View file

@ -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,

View file

@ -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),

View file

@ -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
}

View file

@ -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,
}

View file

@ -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)
}
}

View file

@ -998,7 +998,7 @@ type BlockOverrides struct {
Coinbase *common.Address
Random *common.Hash
BaseFee *hexutil.Big
BlobFee *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()
}
}