Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
return nil, err
}

eth.miner = miner.New(eth, config.Miner, eth.engine)
eth.miner = miner.New(eth, config.Miner, eth.engine, vmConfig)
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))

eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.RollupDisableTxPoolAdmission, eth, nil}
Expand Down
9 changes: 8 additions & 1 deletion miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/params"
)
Expand Down Expand Up @@ -84,10 +85,15 @@ type Miner struct {
pendingMu sync.Mutex // Lock protects the pending block

backend Backend

// evmConfig is the EVM execution configuration used during payload building.
// It must match the vm.Config used by block validation to ensure
// self-consistent gas accounting.
evmConfig vm.Config
}

// New creates a new miner with provided config.
func New(eth Backend, config Config, engine consensus.Engine) *Miner {
func New(eth Backend, config Config, engine consensus.Engine, evmConfig vm.Config) *Miner {
return &Miner{
backend: eth,
config: &config,
Expand All @@ -96,6 +102,7 @@ func New(eth Backend, config Config, engine consensus.Engine) *Miner {
txpool: eth.TxPool(),
chain: eth.BlockChain(),
pending: &pending{},
evmConfig: evmConfig,
}
}

Expand Down
4 changes: 2 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (miner *Miner) prepareWork(genParams *generateParams) (*environment, error)
}
if header.ParentBeaconRoot != nil {
context := core.NewEVMBlockContext(header, miner.chain, nil, miner.chainConfig, env.state)
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, miner.chainConfig, vm.Config{})
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, miner.chainConfig, miner.evmConfig)
core.ProcessBeaconBlockRoot(*header.ParentBeaconRoot, vmenv, env.state)
}
return env, nil
Expand Down Expand Up @@ -328,7 +328,7 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
snap = env.state.Snapshot()
gp = env.gasPool.Gas()
)
receipt, err := core.ApplyTransaction(miner.chainConfig, miner.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, vm.Config{})
receipt, err := core.ApplyTransaction(miner.chainConfig, miner.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, miner.evmConfig)
if err != nil {
env.state.RevertToSnapshot(snap)
env.gasPool.SetGas(gp)
Expand Down
Loading