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