@@ -161,7 +161,7 @@ type EVM struct {
161
161
chainRules params.Rules
162
162
// virtual machine configuration options used to initialise the
163
163
// evm.
164
- vmConfig Config
164
+ Config Config
165
165
// global (to this context) ethereum virtual machine
166
166
// used throughout the execution of the tx.
167
167
interpreters []Interpreter
@@ -177,20 +177,20 @@ type EVM struct {
177
177
178
178
// NewEVM returns a new EVM. The returned EVM is not thread safe and should
179
179
// only ever be used *once*.
180
- func NewEVM (ctx Context , statedb StateDB , tradingStateDB * tradingstate.TradingStateDB , chainConfig * params.ChainConfig , vmConfig Config ) * EVM {
180
+ func NewEVM (ctx Context , statedb StateDB , tradingStateDB * tradingstate.TradingStateDB , chainConfig * params.ChainConfig , config Config ) * EVM {
181
181
evm := & EVM {
182
182
Context : ctx ,
183
183
StateDB : statedb ,
184
184
tradingStateDB : tradingStateDB ,
185
- vmConfig : vmConfig ,
185
+ Config : config ,
186
186
chainConfig : chainConfig ,
187
187
chainRules : chainConfig .Rules (ctx .BlockNumber ),
188
188
interpreters : make ([]Interpreter , 0 , 1 ),
189
189
}
190
190
191
191
// vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here
192
192
// as we always want to have the built-in EVM as the failover option.
193
- evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , vmConfig ))
193
+ evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , config ))
194
194
evm .interpreter = evm .interpreters [0 ]
195
195
196
196
return evm
@@ -233,13 +233,13 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
233
233
_ , isPrecompile := evm .precompile2 (addr )
234
234
if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
235
235
// Calling a non existing account, don't do anything, but ping the tracer
236
- if evm .vmConfig .Debug {
236
+ if evm .Config .Debug {
237
237
if evm .depth == 0 {
238
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
239
- evm .vmConfig .Tracer .CaptureEnd (ret , 0 , 0 , nil )
238
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
239
+ evm .Config .Tracer .CaptureEnd (ret , 0 , 0 , nil )
240
240
} else {
241
- evm .vmConfig .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
242
- evm .vmConfig .Tracer .CaptureExit (ret , 0 , nil )
241
+ evm .Config .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
242
+ evm .Config .Tracer .CaptureExit (ret , 0 , nil )
243
243
}
244
244
}
245
245
return nil , gas , nil
@@ -249,18 +249,18 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
249
249
evm .Transfer (evm .StateDB , caller .Address (), to .Address (), value )
250
250
251
251
// Capture the tracer start/end events in debug mode
252
- if evm .vmConfig .Debug {
252
+ if evm .Config .Debug {
253
253
if evm .depth == 0 {
254
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
254
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
255
255
256
256
defer func (startGas uint64 , startTime time.Time ) { // Lazy evaluation of the parameters
257
- evm .vmConfig .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
257
+ evm .Config .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
258
258
}(gas , time .Now ())
259
259
} else {
260
260
// Handle tracer events for entering and exiting a call frame
261
- evm .vmConfig .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
261
+ evm .Config .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
262
262
defer func (startGas uint64 ) {
263
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
263
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
264
264
}(gas )
265
265
}
266
266
}
@@ -312,10 +312,10 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
312
312
)
313
313
314
314
// Invoke tracer hooks that signal entering/exiting a call frame
315
- if evm .vmConfig .Debug {
316
- evm .vmConfig .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
315
+ if evm .Config .Debug {
316
+ evm .Config .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
317
317
defer func (startGas uint64 ) {
318
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
318
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
319
319
}(gas )
320
320
}
321
321
@@ -351,10 +351,10 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
351
351
)
352
352
353
353
// Invoke tracer hooks that signal entering/exiting a call frame
354
- if evm .vmConfig .Debug {
355
- evm .vmConfig .Tracer .CaptureEnter (DELEGATECALL , caller .Address (), addr , input , gas , nil )
354
+ if evm .Config .Debug {
355
+ evm .Config .Tracer .CaptureEnter (DELEGATECALL , caller .Address (), addr , input , gas , nil )
356
356
defer func (startGas uint64 ) {
357
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
357
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
358
358
}(gas )
359
359
}
360
360
@@ -400,10 +400,10 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
400
400
}
401
401
402
402
// Invoke tracer hooks that signal entering/exiting a call frame
403
- if evm .vmConfig .Debug {
404
- evm .vmConfig .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
403
+ if evm .Config .Debug {
404
+ evm .Config .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
405
405
defer func (startGas uint64 ) {
406
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
406
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
407
407
}(gas )
408
408
}
409
409
@@ -471,11 +471,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
471
471
contract := NewContract (caller , AccountRef (address ), value , gas )
472
472
contract .SetCodeOptionalHash (& address , codeAndHash )
473
473
474
- if evm .vmConfig .Debug {
474
+ if evm .Config .Debug {
475
475
if evm .depth == 0 {
476
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
476
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
477
477
} else {
478
- evm .vmConfig .Tracer .CaptureEnter (typ , caller .Address (), address , codeAndHash .code , gas , value )
478
+ evm .Config .Tracer .CaptureEnter (typ , caller .Address (), address , codeAndHash .code , gas , value )
479
479
}
480
480
}
481
481
start := time .Now ()
@@ -515,11 +515,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
515
515
}
516
516
}
517
517
518
- if evm .vmConfig .Debug {
518
+ if evm .Config .Debug {
519
519
if evm .depth == 0 {
520
- evm .vmConfig .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
520
+ evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
521
521
} else {
522
- evm .vmConfig .Tracer .CaptureExit (ret , gas - contract .Gas , err )
522
+ evm .Config .Tracer .CaptureExit (ret , gas - contract .Gas , err )
523
523
}
524
524
}
525
525
return ret , address , contract .Gas , err
0 commit comments