Skip to content

Commit

Permalink
alternative fix for lookupAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
darioush authored and ARR4N committed Oct 28, 2024
1 parent 5c66352 commit 7fe6b5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/vm/environment.libevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,15 @@ func (e *environment) callContract(typ CallType, addr common.Address, input []by
if in.readOnly && !value.IsZero() {
return nil, gas, ErrWriteProtection
}
return e.evm.Call(caller, addr, input, gas, value)
if e.evm.Config.Tracer != nil {
e.evm.Config.Tracer.CaptureEnter(CALL, caller.Address(), addr, input, gas, value.ToBig())
}
startGas := gas
ret, gas, err := e.evm.Call(caller, addr, input, gas, value)
if e.evm.Config.Tracer != nil {
e.evm.Config.Tracer.CaptureEnd(ret, startGas-gas, err)
}
return ret, gas, err
case CallCode, DelegateCall, StaticCall:
// TODO(arr4n): these cases should be very similar to CALL, hence the
// early abstraction, to signal to future maintainers. If implementing
Expand Down
4 changes: 4 additions & 0 deletions eth/tracers/native/prestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func newPrestateTracer(ctx *tracers.Context, cfg json.RawMessage) (tracers.Trace
}, nil
}

func (t *prestateTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
t.lookupAccount(to)
}

// CaptureStart implements the EVMLogger interface to initialize the tracing operation.
func (t *prestateTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
t.env = env
Expand Down

0 comments on commit 7fe6b5e

Please sign in to comment.