Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/tracers: add ReturnData in the structLogger tracer's response #27704

Merged
merged 3 commits into from Jul 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions eth/tracers/logger/logger.go
Expand Up @@ -418,6 +418,7 @@ type StructLogRes struct {
Depth int `json:"depth"`
Error string `json:"error,omitempty"`
Stack *[]string `json:"stack,omitempty"`
ReturnData *[]string `json:"returnData,omitempty"`
Memory *[]string `json:"memory,omitempty"`
Storage *map[string]string `json:"storage,omitempty"`
RefundCounter uint64 `json:"refund,omitempty"`
Expand All @@ -443,6 +444,13 @@ func formatLogs(logs []StructLog) []StructLogRes {
}
formatted[index].Stack = &stack
}
if trace.ReturnData != nil {
jsvisa marked this conversation as resolved.
Show resolved Hide resolved
rdata := make([]string, 0, (len(trace.ReturnData)+31)/32)
for i := 0; i+32 <= len(trace.ReturnData); i += 32 {
rdata = append(rdata, fmt.Sprintf("%x", trace.ReturnData[i:i+32]))
}
formatted[index].ReturnData = &rdata
}
if trace.Memory != nil {
memory := make([]string, 0, (len(trace.Memory)+31)/32)
for i := 0; i+32 <= len(trace.Memory); i += 32 {
Expand Down