From b5a129ea248f259a367d804cdf396ce442109d85 Mon Sep 17 00:00:00 2001 From: Zhang Zhuo Date: Wed, 30 Mar 2022 04:34:10 +0800 Subject: [PATCH] internal/ethapi: add refund to StructLogRes (#24567) * internal/ethapi: add refund to StructLogRes * Update internal/ethapi/api.go Co-authored-by: rjl493456442 Co-authored-by: rjl493456442 --- internal/ethapi/api.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 366d57141..491c9b134 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1135,15 +1135,16 @@ type ExecutionResult struct { // StructLogRes stores a structured log emitted by the EVM while replaying a // transaction in debug mode type StructLogRes struct { - Pc uint64 `json:"pc"` - Op string `json:"op"` - Gas uint64 `json:"gas"` - GasCost uint64 `json:"gasCost"` - Depth int `json:"depth"` - Error string `json:"error,omitempty"` - Stack *[]string `json:"stack,omitempty"` - Memory *[]string `json:"memory,omitempty"` - Storage *map[string]string `json:"storage,omitempty"` + Pc uint64 `json:"pc"` + Op string `json:"op"` + Gas uint64 `json:"gas"` + GasCost uint64 `json:"gasCost"` + Depth int `json:"depth"` + Error string `json:"error,omitempty"` + Stack *[]string `json:"stack,omitempty"` + Memory *[]string `json:"memory,omitempty"` + Storage *map[string]string `json:"storage,omitempty"` + RefundCounter uint64 `json:"refund,omitempty"` } // FormatLogs formats EVM returned structured logs for json output @@ -1151,12 +1152,13 @@ func FormatLogs(logs []logger.StructLog) []StructLogRes { formatted := make([]StructLogRes, len(logs)) for index, trace := range logs { formatted[index] = StructLogRes{ - Pc: trace.Pc, - Op: trace.Op.String(), - Gas: trace.Gas, - GasCost: trace.GasCost, - Depth: trace.Depth, - Error: trace.ErrorString(), + Pc: trace.Pc, + Op: trace.Op.String(), + Gas: trace.Gas, + GasCost: trace.GasCost, + Depth: trace.Depth, + Error: trace.ErrorString(), + RefundCounter: trace.RefundCounter, } if trace.Stack != nil { stack := make([]string, len(trace.Stack))