Skip to content

Commit

Permalink
Merge pull request #1789 from CortexFoundation/dev
Browse files Browse the repository at this point in the history
add position field for callTracer logs
  • Loading branch information
ucwong authored Nov 5, 2023
2 parents 50ba6c7 + abc71f6 commit c1e8c52
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ctxc/tracers/native/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit c1e8c52

Please sign in to comment.