diff --git a/core/vm/evm.go b/core/vm/evm.go index e9fdac9b99b22ace55ab33b266a901d02e6dfced..221bd2b32d3023172bca7b676ccd562d8429bd32 100644 --- a/core/vm/evm.go +++ b/core/vm/evm.go @@ -301,6 +301,14 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, snapshot = evm.IntraBlockState.Snapshot() ) + // Capture the tracer start/end events in debug mode + if evm.vmConfig.Debug { + _ = evm.vmConfig.Tracer.CaptureStart(evm.depth, caller.Address(), addr, false, input, gas, value.ToBig()) + defer func(startGas uint64, startTime time.Time) { // Lazy evaluation of the parameters + evm.vmConfig.Tracer.CaptureEnd(evm.depth, ret, startGas-gas, time.Since(startTime), err) //nolint:errcheck + }(gas, time.Now()) + } + // It is allowed to call precompiles, even via delegatecall if p, isPrecompile := evm.precompile(addr); isPrecompile { ret, gas, err = RunPrecompiledContract(p, input, gas) @@ -337,6 +345,14 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by } snapshot := evm.IntraBlockState.Snapshot() + // Capture the tracer start/end events in debug mode + if evm.vmConfig.Debug { + _ = evm.vmConfig.Tracer.CaptureStart(evm.depth, caller.Address(), addr, false, input, gas, big.NewInt(-1)) + defer func(startGas uint64, startTime time.Time) { // Lazy evaluation of the parameters + evm.vmConfig.Tracer.CaptureEnd(evm.depth, ret, startGas-gas, time.Since(startTime), err) //nolint:errcheck + }(gas, time.Now()) + } + // It is allowed to call precompiles, even via delegatecall if p, isPrecompile := evm.precompile(addr); isPrecompile { ret, gas, err = RunPrecompiledContract(p, input, gas) @@ -382,6 +398,14 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte // future scenarios evm.IntraBlockState.AddBalance(addr, u256.Num0) + // Capture the tracer start/end events in debug mode + if evm.vmConfig.Debug { + _ = evm.vmConfig.Tracer.CaptureStart(evm.depth, caller.Address(), addr, false, input, gas, big.NewInt(-2)) + defer func(startGas uint64, startTime time.Time) { // Lazy evaluation of the parameters + evm.vmConfig.Tracer.CaptureEnd(evm.depth, ret, startGas-gas, time.Since(startTime), err) //nolint:errcheck + }(gas, time.Now()) + } + if p, isPrecompile := evm.precompile(addr); isPrecompile { ret, gas, err = RunPrecompiledContract(p, input, gas) } else {