From 9f1d8552e4d0abb30096ab3a75d9ab4616ac23b6 Mon Sep 17 00:00:00 2001 From: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Date: Thu, 31 Mar 2022 13:11:34 +0800 Subject: [PATCH] feat: add `RefundCounter` to `StructLogRes` (#66) --- core/types/l2trace.go | 21 +++++++++++---------- core/vm/logger.go | 13 +++++++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/core/types/l2trace.go b/core/types/l2trace.go index 7a2f3d0f31..fa4e6ccd99 100644 --- a/core/types/l2trace.go +++ b/core/types/l2trace.go @@ -31,16 +31,17 @@ 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"` - ExtraData *ExtraData `json:"extraData,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"` + ExtraData *ExtraData `json:"extraData,omitempty"` } type ExtraData struct { diff --git a/core/vm/logger.go b/core/vm/logger.go index 938896748f..b0f75ad7c8 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -419,12 +419,13 @@ func FormatLogs(logs []StructLog) []types.StructLogRes { formatted := make([]types.StructLogRes, len(logs)) for index, trace := range logs { formatted[index] = types.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, + RefundCounter: trace.RefundCounter, + Error: trace.ErrorString(), } if len(trace.Stack) != 0 { stack := make([]string, len(trace.Stack))