|
|
|
@ -42,17 +42,17 @@ type callLog struct { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type callFrame struct { |
|
|
|
|
Type vm.OpCode `json:"-"` |
|
|
|
|
From common.Address `json:"from"` |
|
|
|
|
Gas uint64 `json:"gas"` |
|
|
|
|
GasUsed uint64 `json:"gasUsed"` |
|
|
|
|
To common.Address `json:"to,omitempty" rlp:"optional"` |
|
|
|
|
Input []byte `json:"input" rlp:"optional"` |
|
|
|
|
Output []byte `json:"output,omitempty" rlp:"optional"` |
|
|
|
|
Error string `json:"error,omitempty" rlp:"optional"` |
|
|
|
|
RevertReason string `json:"revertReason,omitempty"` |
|
|
|
|
Calls []callFrame `json:"calls,omitempty" rlp:"optional"` |
|
|
|
|
Logs []callLog `json:"logs,omitempty" rlp:"optional"` |
|
|
|
|
Type vm.OpCode `json:"-"` |
|
|
|
|
From common.Address `json:"from"` |
|
|
|
|
Gas uint64 `json:"gas"` |
|
|
|
|
GasUsed uint64 `json:"gasUsed"` |
|
|
|
|
To *common.Address `json:"to,omitempty" rlp:"optional"` |
|
|
|
|
Input []byte `json:"input" rlp:"optional"` |
|
|
|
|
Output []byte `json:"output,omitempty" rlp:"optional"` |
|
|
|
|
Error string `json:"error,omitempty" rlp:"optional"` |
|
|
|
|
RevertReason string `json:"revertReason,omitempty"` |
|
|
|
|
Calls []callFrame `json:"calls,omitempty" rlp:"optional"` |
|
|
|
|
Logs []callLog `json:"logs,omitempty" rlp:"optional"` |
|
|
|
|
// Placed at end on purpose. The RLP will be decoded to 0 instead of
|
|
|
|
|
// nil if there are non-empty elements after in the struct.
|
|
|
|
|
Value *big.Int `json:"value,omitempty" rlp:"optional"` |
|
|
|
@ -74,7 +74,7 @@ func (f *callFrame) processOutput(output []byte, err error) { |
|
|
|
|
} |
|
|
|
|
f.Error = err.Error() |
|
|
|
|
if f.Type == vm.CREATE || f.Type == vm.CREATE2 { |
|
|
|
|
f.To = common.Address{} |
|
|
|
|
f.To = nil |
|
|
|
|
} |
|
|
|
|
if !errors.Is(err, vm.ErrExecutionReverted) || len(output) == 0 { |
|
|
|
|
return |
|
|
|
@ -127,10 +127,11 @@ func newCallTracer(ctx *tracers.Context, cfg json.RawMessage) (tracers.Tracer, e |
|
|
|
|
|
|
|
|
|
// CaptureStart implements the EVMLogger interface to initialize the tracing operation.
|
|
|
|
|
func (t *callTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) { |
|
|
|
|
toCopy := to |
|
|
|
|
t.callstack[0] = callFrame{ |
|
|
|
|
Type: vm.CALL, |
|
|
|
|
From: from, |
|
|
|
|
To: to, |
|
|
|
|
To: &toCopy, |
|
|
|
|
Input: common.CopyBytes(input), |
|
|
|
|
Gas: gas, |
|
|
|
|
Value: value, |
|
|
|
@ -191,10 +192,11 @@ func (t *callTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common. |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
toCopy := to |
|
|
|
|
call := callFrame{ |
|
|
|
|
Type: typ, |
|
|
|
|
From: from, |
|
|
|
|
To: to, |
|
|
|
|
To: &toCopy, |
|
|
|
|
Input: common.CopyBytes(input), |
|
|
|
|
Gas: gas, |
|
|
|
|
Value: value, |
|
|
|
|