Skip to content

Commit

Permalink
fix nil checks in runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
dhyaniarun1993 committed Mar 28, 2024
1 parent 31702d8 commit 4253a3e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func Execute(code, input []byte, cfg *Config, bn uint64) ([]byte, *state.IntraBl
sender = vm.AccountRef(cfg.Origin)
rules = vmenv.ChainRules()
)
if cfg.EVMConfig.Tracer != nil {
if cfg.EVMConfig.Tracer != nil && cfg.EVMConfig.Tracer.OnTxStart != nil {
cfg.EVMConfig.Tracer.OnTxStart(vmenv.GetVMContext(), types.NewTransaction(0, address, cfg.Value, cfg.GasLimit, cfg.GasPrice, input), cfg.Origin)
}
cfg.State.Prepare(rules, cfg.Origin, cfg.Coinbase, &address, vm.ActivePrecompiles(rules), nil)
Expand Down Expand Up @@ -182,7 +182,7 @@ func Create(input []byte, cfg *Config, blockNr uint64) ([]byte, libcommon.Addres
sender = vm.AccountRef(cfg.Origin)
rules = vmenv.ChainRules()
)
if cfg.EVMConfig.Tracer != nil {
if cfg.EVMConfig.Tracer != nil && cfg.EVMConfig.Tracer.OnTxStart != nil {
cfg.EVMConfig.Tracer.OnTxStart(vmenv.GetVMContext(), types.NewContractCreation(0, cfg.Value, cfg.GasLimit, cfg.GasPrice, input), cfg.Origin)
}

Expand Down Expand Up @@ -211,7 +211,7 @@ func Call(address libcommon.Address, input []byte, cfg *Config) ([]byte, uint64,
sender := cfg.State.GetOrNewStateObject(cfg.Origin)
statedb := cfg.State
rules := vmenv.ChainRules()
if cfg.EVMConfig.Tracer != nil {
if cfg.EVMConfig.Tracer != nil && cfg.EVMConfig.Tracer.OnTxStart != nil {
cfg.EVMConfig.Tracer.OnTxStart(vmenv.GetVMContext(), types.NewTransaction(0, address, cfg.Value, cfg.GasLimit, cfg.GasPrice, input), cfg.Origin)
}
statedb.Prepare(rules, cfg.Origin, cfg.Coinbase, &address, vm.ActivePrecompiles(rules), nil)
Expand Down

0 comments on commit 4253a3e

Please sign in to comment.