@@ -140,7 +140,7 @@ type EVM struct {
140
140
chainRules params.Rules
141
141
// virtual machine configuration options used to initialise the
142
142
// evm.
143
- vmConfig Config
143
+ Config Config
144
144
// global (to this context) ethereum virtual machine
145
145
// used throughout the execution of the tx.
146
146
interpreters []Interpreter
@@ -156,21 +156,21 @@ type EVM struct {
156
156
157
157
// NewEVM returns a new EVM. The returned EVM is not thread safe and should
158
158
// only ever be used *once*.
159
- func NewEVM (blockCtx BlockContext , txCtx TxContext , statedb StateDB , tradingStateDB * tradingstate.TradingStateDB , chainConfig * params.ChainConfig , vmConfig Config ) * EVM {
159
+ func NewEVM (blockCtx BlockContext , txCtx TxContext , statedb StateDB , tradingStateDB * tradingstate.TradingStateDB , chainConfig * params.ChainConfig , config Config ) * EVM {
160
160
evm := & EVM {
161
161
Context : blockCtx ,
162
162
TxContext : txCtx ,
163
163
StateDB : statedb ,
164
164
tradingStateDB : tradingStateDB ,
165
- vmConfig : vmConfig ,
165
+ Config : config ,
166
166
chainConfig : chainConfig ,
167
167
chainRules : chainConfig .Rules (blockCtx .BlockNumber ),
168
168
interpreters : make ([]Interpreter , 0 , 1 ),
169
169
}
170
170
171
171
// vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here
172
172
// as we always want to have the built-in EVM as the failover option.
173
- evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , vmConfig ))
173
+ evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , config ))
174
174
evm .interpreter = evm .interpreters [0 ]
175
175
176
176
return evm
@@ -218,13 +218,13 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
218
218
if ! evm .StateDB .Exist (addr ) {
219
219
if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
220
220
// Calling a non existing account, don't do anything, but ping the tracer
221
- if evm .vmConfig .Debug {
221
+ if evm .Config .Debug {
222
222
if evm .depth == 0 {
223
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
224
- evm .vmConfig .Tracer .CaptureEnd (ret , 0 , 0 , nil )
223
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
224
+ evm .Config .Tracer .CaptureEnd (ret , 0 , 0 , nil )
225
225
} else {
226
- evm .vmConfig .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
227
- evm .vmConfig .Tracer .CaptureExit (ret , 0 , nil )
226
+ evm .Config .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
227
+ evm .Config .Tracer .CaptureExit (ret , 0 , nil )
228
228
}
229
229
}
230
230
return nil , gas , nil
@@ -234,18 +234,18 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
234
234
evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
235
235
236
236
// Capture the tracer start/end events in debug mode
237
- if evm .vmConfig .Debug {
237
+ if evm .Config .Debug {
238
238
if evm .depth == 0 {
239
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
239
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
240
240
241
241
defer func (startGas uint64 , startTime time.Time ) { // Lazy evaluation of the parameters
242
- evm .vmConfig .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
242
+ evm .Config .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
243
243
}(gas , time .Now ())
244
244
} else {
245
245
// Handle tracer events for entering and exiting a call frame
246
- evm .vmConfig .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
246
+ evm .Config .Tracer .CaptureEnter (CALL , caller .Address (), addr , input , gas , value )
247
247
defer func (startGas uint64 ) {
248
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
248
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
249
249
}(gas )
250
250
}
251
251
}
@@ -305,10 +305,10 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
305
305
var snapshot = evm .StateDB .Snapshot ()
306
306
307
307
// Invoke tracer hooks that signal entering/exiting a call frame
308
- if evm .vmConfig .Debug {
309
- evm .vmConfig .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
308
+ if evm .Config .Debug {
309
+ evm .Config .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
310
310
defer func (startGas uint64 ) {
311
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
311
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
312
312
}(gas )
313
313
}
314
314
@@ -346,10 +346,10 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
346
346
var snapshot = evm .StateDB .Snapshot ()
347
347
348
348
// Invoke tracer hooks that signal entering/exiting a call frame
349
- if evm .vmConfig .Debug {
350
- evm .vmConfig .Tracer .CaptureEnter (DELEGATECALL , caller .Address (), addr , input , gas , nil )
349
+ if evm .Config .Debug {
350
+ evm .Config .Tracer .CaptureEnter (DELEGATECALL , caller .Address (), addr , input , gas , nil )
351
351
defer func (startGas uint64 ) {
352
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
352
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
353
353
}(gas )
354
354
}
355
355
@@ -396,10 +396,10 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
396
396
evm .StateDB .AddBalance (addr , big0 )
397
397
398
398
// Invoke tracer hooks that signal entering/exiting a call frame
399
- if evm .vmConfig .Debug {
400
- evm .vmConfig .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
399
+ if evm .Config .Debug {
400
+ evm .Config .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
401
401
defer func (startGas uint64 ) {
402
- evm .vmConfig .Tracer .CaptureExit (ret , startGas - gas , err )
402
+ evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
403
403
}(gas )
404
404
}
405
405
@@ -480,11 +480,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
480
480
contract := NewContract (caller , AccountRef (address ), value , gas )
481
481
contract .SetCodeOptionalHash (& address , codeAndHash )
482
482
483
- if evm .vmConfig .Debug {
483
+ if evm .Config .Debug {
484
484
if evm .depth == 0 {
485
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
485
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
486
486
} else {
487
- evm .vmConfig .Tracer .CaptureEnter (typ , caller .Address (), address , codeAndHash .code , gas , value )
487
+ evm .Config .Tracer .CaptureEnter (typ , caller .Address (), address , codeAndHash .code , gas , value )
488
488
}
489
489
}
490
490
start := time .Now ()
@@ -524,11 +524,11 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
524
524
}
525
525
}
526
526
527
- if evm .vmConfig .Debug {
527
+ if evm .Config .Debug {
528
528
if evm .depth == 0 {
529
- evm .vmConfig .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
529
+ evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
530
530
} else {
531
- evm .vmConfig .Tracer .CaptureExit (ret , gas - contract .Gas , err )
531
+ evm .Config .Tracer .CaptureExit (ret , gas - contract .Gas , err )
532
532
}
533
533
}
534
534
return ret , address , contract .Gas , err
0 commit comments