From abc71f696ea688f9ce4baa9eb95d0ffb69639202 Mon Sep 17 00:00:00 2001 From: ucwong Date: Fri, 3 Nov 2023 17:59:05 +0800 Subject: [PATCH] add position field for callTracer logs --- ctxc/tracers/native/call.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ctxc/tracers/native/call.go b/ctxc/tracers/native/call.go index 3514679971..371569f93c 100644 --- a/ctxc/tracers/native/call.go +++ b/ctxc/tracers/native/call.go @@ -36,9 +36,10 @@ func init() { } type callLog struct { - Address common.Address `json:"address"` - Topics []common.Hash `json:"topics"` - Data hexutil.Bytes `json:"data"` + Address common.Address `json:"address"` + Topics []common.Hash `json:"topics"` + Data hexutil.Bytes `json:"data"` + Position hexutil.Uint `json:"position"` } type callFrame struct { @@ -184,7 +185,12 @@ func (t *callTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, sco // mSize was unrealistically large return } - log := callLog{Address: scope.Contract.Address(), Topics: topics, Data: hexutil.Bytes(data)} + log := callLog{ + Address: scope.Contract.Address(), + Topics: topics, + Data: hexutil.Bytes(data), + Position: hexutil.Uint(len(t.callstack[len(t.callstack)-1].Calls)), + } t.callstack[len(t.callstack)-1].Logs = append(t.callstack[len(t.callstack)-1].Logs, log) } }