@@ -128,7 +128,7 @@ type EVM struct {
128
128
chainRules params.Rules
129
129
// virtual machine configuration options used to initialise the
130
130
// evm.
131
- vmConfig Config
131
+ Config Config
132
132
// global (to this context) ethereum virtual machine
133
133
// used throughout the execution of the tx.
134
134
interpreters []Interpreter
@@ -144,12 +144,12 @@ type EVM struct {
144
144
145
145
// NewEVM returns a new EVM. The returned EVM is not thread safe and should
146
146
// only ever be used *once*.
147
- func NewEVM (blockCtx BlockContext , txCtx TxContext , statedb StateDB , chainConfig * params.ChainConfig , vmConfig Config ) * EVM {
147
+ func NewEVM (blockCtx BlockContext , txCtx TxContext , statedb StateDB , chainConfig * params.ChainConfig , config Config ) * EVM {
148
148
evm := & EVM {
149
149
Context : blockCtx ,
150
150
TxContext : txCtx ,
151
151
StateDB : statedb ,
152
- vmConfig : vmConfig ,
152
+ Config : config ,
153
153
chainConfig : chainConfig ,
154
154
chainRules : chainConfig .Rules (blockCtx .BlockNumber ),
155
155
interpreters : make ([]Interpreter , 0 , 1 ),
@@ -173,7 +173,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
173
173
174
174
// vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here
175
175
// as we always want to have the built-in EVM as the failover option.
176
- evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , vmConfig ))
176
+ evm .interpreters = append (evm .interpreters , NewEVMInterpreter (evm , config ))
177
177
evm .interpreter = evm .interpreters [0 ]
178
178
179
179
return evm
@@ -207,7 +207,7 @@ func (evm *EVM) Interpreter() Interpreter {
207
207
// the necessary steps to create accounts and reverses the state in case of an
208
208
// execution error or failed value transfer.
209
209
func (evm * EVM ) Call (caller ContractRef , addr common.Address , input []byte , gas uint64 , value * big.Int ) (ret []byte , leftOverGas uint64 , err error ) {
210
- if evm .vmConfig .NoRecursion && evm .depth > 0 {
210
+ if evm .Config .NoRecursion && evm .depth > 0 {
211
211
return nil , gas , nil
212
212
}
213
213
// Fail if we're trying to execute above the call depth limit
@@ -224,9 +224,9 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
224
224
if ! evm .StateDB .Exist (addr ) {
225
225
if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
226
226
// Calling a non existing account, don't do anything, but ping the tracer
227
- if evm .vmConfig .Debug && evm .depth == 0 {
228
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
229
- evm .vmConfig .Tracer .CaptureEnd (ret , 0 , 0 , nil )
227
+ if evm .Config .Debug && evm .depth == 0 {
228
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
229
+ evm .Config .Tracer .CaptureEnd (ret , 0 , 0 , nil )
230
230
}
231
231
return nil , gas , nil
232
232
}
@@ -235,10 +235,10 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
235
235
evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
236
236
237
237
// Capture the tracer start/end events in debug mode
238
- if evm .vmConfig .Debug && evm .depth == 0 {
239
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
238
+ if evm .Config .Debug && evm .depth == 0 {
239
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
240
240
defer func (startGas uint64 , startTime time.Time ) { // Lazy evaluation of the parameters
241
- evm .vmConfig .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
241
+ evm .Config .Tracer .CaptureEnd (ret , startGas - gas , time .Since (startTime ), err )
242
242
}(gas , time .Now ())
243
243
}
244
244
@@ -283,7 +283,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
283
283
// CallCode differs from Call in the sense that it executes the given address'
284
284
// code with the caller as context.
285
285
func (evm * EVM ) CallCode (caller ContractRef , addr common.Address , input []byte , gas uint64 , value * big.Int ) (ret []byte , leftOverGas uint64 , err error ) {
286
- if evm .vmConfig .NoRecursion && evm .depth > 0 {
286
+ if evm .Config .NoRecursion && evm .depth > 0 {
287
287
return nil , gas , nil
288
288
}
289
289
// Fail if we're trying to execute above the call depth limit
@@ -326,7 +326,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
326
326
// DelegateCall differs from CallCode in the sense that it executes the given address'
327
327
// code with the caller as context and the caller is set to the caller of the caller.
328
328
func (evm * EVM ) DelegateCall (caller ContractRef , addr common.Address , input []byte , gas uint64 ) (ret []byte , leftOverGas uint64 , err error ) {
329
- if evm .vmConfig .NoRecursion && evm .depth > 0 {
329
+ if evm .Config .NoRecursion && evm .depth > 0 {
330
330
return nil , gas , nil
331
331
}
332
332
// Fail if we're trying to execute above the call depth limit
@@ -360,7 +360,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
360
360
// Opcodes that attempt to perform such modifications will result in exceptions
361
361
// instead of performing the modifications.
362
362
func (evm * EVM ) StaticCall (caller ContractRef , addr common.Address , input []byte , gas uint64 ) (ret []byte , leftOverGas uint64 , err error ) {
363
- if evm .vmConfig .NoRecursion && evm .depth > 0 {
363
+ if evm .Config .NoRecursion && evm .depth > 0 {
364
364
return nil , gas , nil
365
365
}
366
366
// Fail if we're trying to execute above the call depth limit
@@ -453,12 +453,12 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
453
453
contract := NewContract (caller , AccountRef (address ), value , gas )
454
454
contract .SetCodeOptionalHash (& address , codeAndHash )
455
455
456
- if evm .vmConfig .NoRecursion && evm .depth > 0 {
456
+ if evm .Config .NoRecursion && evm .depth > 0 {
457
457
return nil , address , gas , nil
458
458
}
459
459
460
- if evm .vmConfig .Debug && evm .depth == 0 {
461
- evm .vmConfig .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
460
+ if evm .Config .Debug && evm .depth == 0 {
461
+ evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
462
462
}
463
463
start := time .Now ()
464
464
@@ -497,8 +497,8 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
497
497
}
498
498
}
499
499
500
- if evm .vmConfig .Debug && evm .depth == 0 {
501
- evm .vmConfig .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
500
+ if evm .Config .Debug && evm .depth == 0 {
501
+ evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , time .Since (start ), err )
502
502
}
503
503
return ret , address , contract .Gas , err
504
504
}
0 commit comments