@@ -82,10 +82,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
8282 evm := vm .NewEVM (context , tracingStateDB , p .config , cfg )
8383
8484 if beaconRoot := block .BeaconRoot (); beaconRoot != nil {
85- ProcessBeaconBlockRoot (* beaconRoot , evm , tracingStateDB )
85+ ProcessBeaconBlockRoot (* beaconRoot , evm )
8686 }
8787 if p .config .IsPrague (block .Number (), block .Time ()) {
88- ProcessParentBlockHash (block .ParentHash (), evm , tracingStateDB )
88+ ProcessParentBlockHash (block .ParentHash (), evm )
8989 }
9090
9191 // Iterate over and process the individual transactions
@@ -96,7 +96,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
9696 }
9797 statedb .SetTxContext (tx .Hash (), i )
9898
99- receipt , err := ApplyTransactionWithEVM (msg , p . config , gp , statedb , blockNumber , blockHash , tx , usedGas , evm )
99+ receipt , err := ApplyTransactionWithEVM (msg , gp , statedb , blockNumber , blockHash , tx , usedGas , evm )
100100 if err != nil {
101101 return nil , fmt .Errorf ("could not apply tx %d [%v]: %w" , i , tx .Hash ().Hex (), err )
102102 }
@@ -113,10 +113,10 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
113113 }
114114 requests = append (requests , depositRequests )
115115 // EIP-7002 withdrawals
116- withdrawalRequests := ProcessWithdrawalQueue (evm , tracingStateDB )
116+ withdrawalRequests := ProcessWithdrawalQueue (evm )
117117 requests = append (requests , withdrawalRequests )
118118 // EIP-7251 consolidations
119- consolidationRequests := ProcessConsolidationQueue (evm , tracingStateDB )
119+ consolidationRequests := ProcessConsolidationQueue (evm )
120120 requests = append (requests , consolidationRequests )
121121 }
122122
@@ -134,7 +134,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
134134// ApplyTransactionWithEVM attempts to apply a transaction to the given state database
135135// and uses the input parameters for its environment similar to ApplyTransaction. However,
136136// this method takes an already created EVM instance as input.
137- func ApplyTransactionWithEVM (msg * Message , config * params. ChainConfig , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (receipt * types.Receipt , err error ) {
137+ func ApplyTransactionWithEVM (msg * Message , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (receipt * types.Receipt , err error ) {
138138 if hooks := evm .Config .Tracer ; hooks != nil {
139139 if hooks .OnTxStart != nil {
140140 hooks .OnTxStart (evm .GetVMContext (), tx , msg .From )
@@ -156,10 +156,10 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
156156
157157 // Update the state with pending changes.
158158 var root []byte
159- if config .IsByzantium (blockNumber ) {
159+ if evm . ChainConfig () .IsByzantium (blockNumber ) {
160160 evm .StateDB .Finalise (true )
161161 } else {
162- root = statedb .IntermediateRoot (config .IsEIP158 (blockNumber )).Bytes ()
162+ root = statedb .IntermediateRoot (evm . ChainConfig () .IsEIP158 (blockNumber )).Bytes ()
163163 }
164164 * usedGas += result .UsedGas
165165
@@ -208,19 +208,19 @@ func MakeReceipt(evm *vm.EVM, result *ExecutionResult, statedb *state.StateDB, b
208208// and uses the input parameters for its environment. It returns the receipt
209209// for the transaction, gas used and an error if the transaction failed,
210210// indicating the block was invalid.
211- func ApplyTransaction (config * params. ChainConfig , evm * vm.EVM , gp * GasPool , statedb * state.StateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , error ) {
212- msg , err := TransactionToMessage (tx , types .MakeSigner (config , header .Number , header .Time ), header .BaseFee )
211+ func ApplyTransaction (evm * vm.EVM , gp * GasPool , statedb * state.StateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 ) (* types.Receipt , error ) {
212+ msg , err := TransactionToMessage (tx , types .MakeSigner (evm . ChainConfig () , header .Number , header .Time ), header .BaseFee )
213213 if err != nil {
214214 return nil , err
215215 }
216216 // Create a new context to be used in the EVM environment
217- return ApplyTransactionWithEVM (msg , config , gp , statedb , header .Number , header .Hash (), tx , usedGas , evm )
217+ return ApplyTransactionWithEVM (msg , gp , statedb , header .Number , header .Hash (), tx , usedGas , evm )
218218}
219219
220220// ProcessBeaconBlockRoot applies the EIP-4788 system call to the beacon block root
221221// contract. This method is exported to be used in tests.
222- func ProcessBeaconBlockRoot (beaconRoot common.Hash , vmenv * vm.EVM , statedb vm. StateDB ) {
223- if tracer := vmenv .Config .Tracer ; tracer != nil {
222+ func ProcessBeaconBlockRoot (beaconRoot common.Hash , evm * vm.EVM ) {
223+ if tracer := evm .Config .Tracer ; tracer != nil {
224224 if tracer .OnSystemCallStart != nil {
225225 tracer .OnSystemCallStart ()
226226 }
@@ -237,16 +237,16 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb vm.St
237237 To : & params .BeaconRootsAddress ,
238238 Data : beaconRoot [:],
239239 }
240- vmenv .SetTxContext (NewEVMTxContext (msg ))
241- statedb .AddAddressToAccessList (params .BeaconRootsAddress )
242- _ , _ , _ = vmenv .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
243- statedb .Finalise (true )
240+ evm .SetTxContext (NewEVMTxContext (msg ))
241+ evm . StateDB .AddAddressToAccessList (params .BeaconRootsAddress )
242+ _ , _ , _ = evm .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
243+ evm . StateDB .Finalise (true )
244244}
245245
246246// ProcessParentBlockHash stores the parent block hash in the history storage contract
247247// as per EIP-2935.
248- func ProcessParentBlockHash (prevHash common.Hash , vmenv * vm.EVM , statedb vm. StateDB ) {
249- if tracer := vmenv .Config .Tracer ; tracer != nil {
248+ func ProcessParentBlockHash (prevHash common.Hash , evm * vm.EVM ) {
249+ if tracer := evm .Config .Tracer ; tracer != nil {
250250 if tracer .OnSystemCallStart != nil {
251251 tracer .OnSystemCallStart ()
252252 }
@@ -263,34 +263,33 @@ func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb vm.Stat
263263 To : & params .HistoryStorageAddress ,
264264 Data : prevHash .Bytes (),
265265 }
266- vmenv .SetTxContext (NewEVMTxContext (msg ))
267- statedb .AddAddressToAccessList (params .HistoryStorageAddress )
268- _ , _ , _ = vmenv .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
269- statedb .Finalise (true )
266+ evm .SetTxContext (NewEVMTxContext (msg ))
267+ evm . StateDB .AddAddressToAccessList (params .HistoryStorageAddress )
268+ _ , _ , _ = evm .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
269+ evm . StateDB .Finalise (true )
270270}
271271
272272// ProcessWithdrawalQueue calls the EIP-7002 withdrawal queue contract.
273273// It returns the opaque request data returned by the contract.
274- func ProcessWithdrawalQueue (vmenv * vm.EVM , statedb vm. StateDB ) []byte {
275- return processRequestsSystemCall (vmenv , statedb , 0x01 , params .WithdrawalQueueAddress )
274+ func ProcessWithdrawalQueue (evm * vm.EVM ) []byte {
275+ return processRequestsSystemCall (evm , 0x01 , params .WithdrawalQueueAddress )
276276}
277277
278278// ProcessConsolidationQueue calls the EIP-7251 consolidation queue contract.
279279// It returns the opaque request data returned by the contract.
280- func ProcessConsolidationQueue (vmenv * vm.EVM , statedb vm. StateDB ) []byte {
281- return processRequestsSystemCall (vmenv , statedb , 0x02 , params .ConsolidationQueueAddress )
280+ func ProcessConsolidationQueue (evm * vm.EVM ) []byte {
281+ return processRequestsSystemCall (evm , 0x02 , params .ConsolidationQueueAddress )
282282}
283283
284- func processRequestsSystemCall (vmenv * vm.EVM , statedb vm. StateDB , requestType byte , addr common.Address ) []byte {
285- if tracer := vmenv .Config .Tracer ; tracer != nil {
284+ func processRequestsSystemCall (evm * vm.EVM , requestType byte , addr common.Address ) []byte {
285+ if tracer := evm .Config .Tracer ; tracer != nil {
286286 if tracer .OnSystemCallStart != nil {
287287 tracer .OnSystemCallStart ()
288288 }
289289 if tracer .OnSystemCallEnd != nil {
290290 defer tracer .OnSystemCallEnd ()
291291 }
292292 }
293-
294293 msg := & Message {
295294 From : params .SystemAddress ,
296295 GasLimit : 30_000_000 ,
@@ -299,10 +298,10 @@ func processRequestsSystemCall(vmenv *vm.EVM, statedb vm.StateDB, requestType by
299298 GasTipCap : common .Big0 ,
300299 To : & addr ,
301300 }
302- vmenv .SetTxContext (NewEVMTxContext (msg ))
303- statedb .AddAddressToAccessList (addr )
304- ret , _ , _ := vmenv .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
305- statedb .Finalise (true )
301+ evm .SetTxContext (NewEVMTxContext (msg ))
302+ evm . StateDB .AddAddressToAccessList (addr )
303+ ret , _ , _ := evm .Call (vm .AccountRef (msg .From ), * msg .To , msg .Data , 30_000_000 , common .U2560 )
304+ evm . StateDB .Finalise (true )
306305
307306 // Create withdrawals requestsData with prefix 0x01
308307 requestsData := make ([]byte , len (ret )+ 1 )
0 commit comments