Skip to content

Commit a4f5363

Browse files
committed
Actually support large contracts
1 parent d24b17b commit a4f5363

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

eth/backend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
299299
return nil, err
300300
}
301301

302-
eth.miner = miner.New(eth, config.Miner, eth.engine)
302+
eth.miner = miner.New(eth, config.Miner, eth.engine, vmConfig)
303303
eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))
304304

305305
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, config.RollupDisableTxPoolAdmission, eth, nil}

miner/miner.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/ethereum/go-ethereum/core/state"
3232
"github.com/ethereum/go-ethereum/core/txpool"
3333
"github.com/ethereum/go-ethereum/core/types"
34+
"github.com/ethereum/go-ethereum/core/vm"
3435
"github.com/ethereum/go-ethereum/eth/tracers"
3536
"github.com/ethereum/go-ethereum/params"
3637
)
@@ -84,10 +85,15 @@ type Miner struct {
8485
pendingMu sync.Mutex // Lock protects the pending block
8586

8687
backend Backend
88+
89+
// evmConfig is the EVM execution configuration used during payload building.
90+
// It must match the vm.Config used by block validation to ensure
91+
// self-consistent gas accounting.
92+
evmConfig vm.Config
8793
}
8894

8995
// New creates a new miner with provided config.
90-
func New(eth Backend, config Config, engine consensus.Engine) *Miner {
96+
func New(eth Backend, config Config, engine consensus.Engine, evmConfig vm.Config) *Miner {
9197
return &Miner{
9298
backend: eth,
9399
config: &config,
@@ -96,6 +102,7 @@ func New(eth Backend, config Config, engine consensus.Engine) *Miner {
96102
txpool: eth.TxPool(),
97103
chain: eth.BlockChain(),
98104
pending: &pending{},
105+
evmConfig: evmConfig,
99106
}
100107
}
101108

miner/worker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (miner *Miner) prepareWork(genParams *generateParams) (*environment, error)
248248
}
249249
if header.ParentBeaconRoot != nil {
250250
context := core.NewEVMBlockContext(header, miner.chain, nil, miner.chainConfig, env.state)
251-
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, miner.chainConfig, vm.Config{})
251+
vmenv := vm.NewEVM(context, vm.TxContext{}, env.state, miner.chainConfig, miner.evmConfig)
252252
core.ProcessBeaconBlockRoot(*header.ParentBeaconRoot, vmenv, env.state)
253253
}
254254
return env, nil
@@ -328,7 +328,7 @@ func (miner *Miner) applyTransaction(env *environment, tx *types.Transaction) (*
328328
snap = env.state.Snapshot()
329329
gp = env.gasPool.Gas()
330330
)
331-
receipt, err := core.ApplyTransaction(miner.chainConfig, miner.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, vm.Config{})
331+
receipt, err := core.ApplyTransaction(miner.chainConfig, miner.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, miner.evmConfig)
332332
if err != nil {
333333
env.state.RevertToSnapshot(snap)
334334
env.gasPool.SetGas(gp)

0 commit comments

Comments
 (0)