mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
eip-4844: NewEVMBlockContext now expects excessDataGas (#7203)
Small change in core.NewEVMBlockContext and now it expects excessDataGas. This will be used in state transition to compute data fee for eip-4844 data blobs. The logic that computes it will be added in the next PRs.
This commit is contained in:
parent
3ce1b9b5ce
commit
975e38a800
@ -683,7 +683,7 @@ func (b *SimulatedBackend) callContract(_ context.Context, call ethereum.CallMsg
|
||||
|
||||
txContext := core.NewEVMTxContext(msg)
|
||||
header := block.Header()
|
||||
evmContext := core.NewEVMBlockContext(header, core.GetHashFn(header, b.getHeader), b.m.Engine, nil)
|
||||
evmContext := core.NewEVMBlockContext(header, core.GetHashFn(header, b.getHeader), b.m.Engine, nil, nil /*excessDataGas*/)
|
||||
// Create a new environment which holds all relevant information
|
||||
// about the transaction and calling mechanisms.
|
||||
vmEnv := vm.NewEVM(evmContext, txContext, statedb, b.m.ChainConfig, vm.Config{})
|
||||
|
@ -88,7 +88,7 @@ func (api *OtterscanAPIImpl) genericTracer(dbtx kv.Tx, ctx context.Context, bloc
|
||||
|
||||
msg, _ := tx.AsMessage(*signer, header.BaseFee, rules)
|
||||
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil)
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil, nil /*excessDataGas*/)
|
||||
TxContext := core.NewEVMTxContext(msg)
|
||||
|
||||
vmenv := vm.NewEVM(BlockContext, TxContext, ibs, chainConfig, vm.Config{Debug: true, Tracer: tracer})
|
||||
|
@ -85,7 +85,7 @@ func (api *OtterscanAPIImpl) traceBlock(dbtx kv.Tx, ctx context.Context, blockNu
|
||||
msg, _ := tx.AsMessage(*signer, header.BaseFee, rules)
|
||||
|
||||
tracer := NewTouchTracer(searchAddr)
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil)
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil, nil /*excessDataGas*/)
|
||||
TxContext := core.NewEVMTxContext(msg)
|
||||
|
||||
vmenv := vm.NewEVM(BlockContext, TxContext, ibs, chainConfig, vm.Config{Debug: true, Tracer: tracer})
|
||||
|
@ -207,7 +207,7 @@ func (rw *Worker) RunTxTaskNoLock(txTask *exec22.TxTask) {
|
||||
blockContext := txTask.EvmBlockContext
|
||||
if !rw.background {
|
||||
getHashFn := core.GetHashFn(header, rw.getHeader)
|
||||
blockContext = core.NewEVMBlockContext(header, getHashFn, rw.engine, nil /* author */)
|
||||
blockContext = core.NewEVMBlockContext(header, getHashFn, rw.engine, nil /* author */, nil /*excessDataGas*/)
|
||||
}
|
||||
rw.evm.ResetBetweenBlocks(blockContext, core.NewEVMTxContext(msg), ibs, vmConfig, rules)
|
||||
vmenv := rw.evm
|
||||
|
@ -1262,7 +1262,7 @@ func (p *Parlia) systemCall(from, contract libcommon.Address, data []byte, ibs *
|
||||
)
|
||||
vmConfig := vm.Config{NoReceipts: true}
|
||||
// Create a new context to be used in the EVM environment
|
||||
blockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, nil), p, &from)
|
||||
blockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, nil), p, &from, nil /*excessDataGas*/)
|
||||
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), ibs, chainConfig, vmConfig)
|
||||
ret, leftOverGas, err := evm.Call(
|
||||
vm.AccountRef(msg.From()),
|
||||
|
@ -493,7 +493,7 @@ func SysCallContract(contract libcommon.Address, data []byte, chainConfig chain.
|
||||
author = &state.SystemAddress
|
||||
txContext = NewEVMTxContext(msg)
|
||||
}
|
||||
blockContext := NewEVMBlockContext(header, GetHashFn(header, nil), engine, author)
|
||||
blockContext := NewEVMBlockContext(header, GetHashFn(header, nil), engine, author, nil /*excessDataGas*/)
|
||||
evm := vm.NewEVM(blockContext, txContext, ibs, &chainConfig, vmConfig)
|
||||
|
||||
ret, _, err := evm.Call(
|
||||
@ -529,7 +529,7 @@ func SysCreate(contract libcommon.Address, data []byte, chainConfig chain.Config
|
||||
// Create a new context to be used in the EVM environment
|
||||
author := &contract
|
||||
txContext := NewEVMTxContext(msg)
|
||||
blockContext := NewEVMBlockContext(header, GetHashFn(header, nil), nil, author)
|
||||
blockContext := NewEVMBlockContext(header, GetHashFn(header, nil), nil, author, nil /*excessDataGas*/)
|
||||
evm := vm.NewEVM(blockContext, txContext, ibs, &chainConfig, vmConfig)
|
||||
|
||||
ret, _, err := evm.SysCreate(
|
||||
|
@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
// NewEVMBlockContext creates a new context for use in the EVM.
|
||||
func NewEVMBlockContext(header *types.Header, blockHashFunc func(n uint64) libcommon.Hash, engine consensus.EngineReader, author *libcommon.Address) evmtypes.BlockContext {
|
||||
func NewEVMBlockContext(header *types.Header, blockHashFunc func(n uint64) libcommon.Hash, engine consensus.EngineReader, author *libcommon.Address, excessDataGas *big.Int) evmtypes.BlockContext {
|
||||
// If we don't have an explicit author (i.e. not mining), extract from the header
|
||||
var beneficiary libcommon.Address
|
||||
if author == nil {
|
||||
|
@ -104,7 +104,7 @@ func ApplyTransaction(config *chain.Config, blockHashFunc func(n uint64) libcomm
|
||||
// about the transaction and calling mechanisms.
|
||||
cfg.SkipAnalysis = SkipAnalysis(config, header.Number.Uint64())
|
||||
|
||||
blockContext := NewEVMBlockContext(header, blockHashFunc, engine, author)
|
||||
blockContext := NewEVMBlockContext(header, blockHashFunc, engine, author, nil /*excessDataGas*/)
|
||||
vmenv := vm.NewEVM(blockContext, evmtypes.TxContext{}, ibs, config, cfg)
|
||||
|
||||
return applyTransaction(config, engine, gp, ibs, stateWriter, header, tx, usedGas, vmenv, cfg)
|
||||
|
@ -545,7 +545,7 @@ Loop:
|
||||
defer getHashFnMute.Unlock()
|
||||
return f(n)
|
||||
}
|
||||
blockContext := core.NewEVMBlockContext(header, getHashFn, engine, nil /* author */)
|
||||
blockContext := core.NewEVMBlockContext(header, getHashFn, engine, nil /* author */, nil /*excessDataGas*/)
|
||||
|
||||
if parallel {
|
||||
select {
|
||||
@ -1057,7 +1057,7 @@ func reconstituteStep(last bool,
|
||||
defer getHashFnMute.Unlock()
|
||||
return f(n)
|
||||
}
|
||||
blockContext := core.NewEVMBlockContext(header, getHashFn, engine, nil /* author */)
|
||||
blockContext := core.NewEVMBlockContext(header, getHashFn, engine, nil /* author */, nil /*excessDataGas*/)
|
||||
rules := chainConfig.Rules(bn, b.Time())
|
||||
|
||||
for txIndex := -1; txIndex <= len(txs); txIndex++ {
|
||||
|
@ -221,7 +221,7 @@ func (t *StateTest) RunNoVerify(tx kv.RwTx, subtest StateSubtest, vmconfig vm.Co
|
||||
// Prepare the EVM.
|
||||
txContext := core.NewEVMTxContext(msg)
|
||||
header := block.Header()
|
||||
context := core.NewEVMBlockContext(header, core.GetHashFn(header, nil), nil, &t.json.Env.Coinbase)
|
||||
context := core.NewEVMBlockContext(header, core.GetHashFn(header, nil), nil, &t.json.Env.Coinbase, nil /*excessDataGas*/)
|
||||
context.GetHash = vmTestBlockHash
|
||||
if baseFee != nil {
|
||||
context.BaseFee = new(uint256.Int)
|
||||
|
@ -107,7 +107,7 @@ func DoCall(
|
||||
}
|
||||
|
||||
func NewEVMBlockContext(engine consensus.EngineReader, header *types.Header, requireCanonical bool, tx kv.Tx, headerReader services.HeaderReader) evmtypes.BlockContext {
|
||||
return core.NewEVMBlockContext(header, MakeHeaderGetter(requireCanonical, tx, headerReader), engine, nil /* author */)
|
||||
return core.NewEVMBlockContext(header, MakeHeaderGetter(requireCanonical, tx, headerReader), engine, nil /* author */, nil /*excessDataGas*/)
|
||||
}
|
||||
|
||||
func MakeHeaderGetter(requireCanonical bool, tx kv.Tx, headerReader services.HeaderReader) func(uint64) libcommon.Hash {
|
||||
|
@ -53,7 +53,7 @@ func ComputeTxEnv(ctx context.Context, engine consensus.EngineReader, block *typ
|
||||
return h
|
||||
}
|
||||
header := block.HeaderNoCopy()
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil)
|
||||
BlockContext := core.NewEVMBlockContext(header, core.GetHashFn(header, getHeader), engine, nil, nil /*excessDataGas*/)
|
||||
|
||||
// Recompute transactions up to the target index.
|
||||
signer := types.MakeSigner(cfg, block.NumberU64())
|
||||
|
Loading…
Reference in New Issue
Block a user