@@ -128,7 +128,7 @@ type EVM struct {
128128 chainRules params.Rules
129129 // virtual machine configuration options used to initialise the
130130 // evm.
131- vmConfig Config
131+ Config Config
132132 // global (to this context) ethereum virtual machine
133133 // used throughout the execution of the tx.
134134 interpreters []Interpreter
@@ -144,12 +144,12 @@ type EVM struct {
144144
145145// NewEVM returns a new EVM. The returned EVM is not thread safe and should
146146// 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 {
148148 evm := & EVM {
149149 Context : blockCtx ,
150150 TxContext : txCtx ,
151151 StateDB : statedb ,
152- vmConfig : vmConfig ,
152+ Config : config ,
153153 chainConfig : chainConfig ,
154154 chainRules : chainConfig .Rules (blockCtx .BlockNumber ),
155155 interpreters : make ([]Interpreter , 0 , 1 ),
@@ -173,7 +173,7 @@ func NewEVM(blockCtx BlockContext, txCtx TxContext, statedb StateDB, chainConfig
173173
174174 // vmConfig.EVMInterpreter will be used by EVM-C, it won't be checked here
175175 // 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 ))
177177 evm .interpreter = evm .interpreters [0 ]
178178
179179 return evm
@@ -207,7 +207,7 @@ func (evm *EVM) Interpreter() Interpreter {
207207// the necessary steps to create accounts and reverses the state in case of an
208208// execution error or failed value transfer.
209209func (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 {
211211 return nil , gas , nil
212212 }
213213 // 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
224224 if ! evm .StateDB .Exist (addr ) {
225225 if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
226226 // 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 )
230230 }
231231 return nil , gas , nil
232232 }
@@ -235,10 +235,10 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
235235 evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
236236
237237 // 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 )
240240 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 )
242242 }(gas , time .Now ())
243243 }
244244
@@ -283,7 +283,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
283283// CallCode differs from Call in the sense that it executes the given address'
284284// code with the caller as context.
285285func (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 {
287287 return nil , gas , nil
288288 }
289289 // 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,
326326// DelegateCall differs from CallCode in the sense that it executes the given address'
327327// code with the caller as context and the caller is set to the caller of the caller.
328328func (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 {
330330 return nil , gas , nil
331331 }
332332 // 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
360360// Opcodes that attempt to perform such modifications will result in exceptions
361361// instead of performing the modifications.
362362func (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 {
364364 return nil , gas , nil
365365 }
366366 // 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,
453453 contract := NewContract (caller , AccountRef (address ), value , gas )
454454 contract .SetCodeOptionalHash (& address , codeAndHash )
455455
456- if evm .vmConfig .NoRecursion && evm .depth > 0 {
456+ if evm .Config .NoRecursion && evm .depth > 0 {
457457 return nil , address , gas , nil
458458 }
459459
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 )
462462 }
463463 start := time .Now ()
464464
@@ -497,8 +497,8 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
497497 }
498498 }
499499
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 )
502502 }
503503 return ret , address , contract .Gas , err
504504}
0 commit comments