From b305591e1491229c35a4551f18bd5e745405700f Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 16 Oct 2020 11:28:03 +0200 Subject: [PATCH] core/vm: marshall returnData as hexstring in trace logs (#21715) * core/vm: marshall returnData as hexstring in trace logs * core/vm: marshall returnData as hexstring in trace logs --- core/vm/gen_structlog.go | 6 +++--- core/vm/logger.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/vm/gen_structlog.go b/core/vm/gen_structlog.go index ac1a9070c..44da014de 100644 --- a/core/vm/gen_structlog.go +++ b/core/vm/gen_structlog.go @@ -24,7 +24,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) { MemorySize int `json:"memSize"` Stack []*math.HexOrDecimal256 `json:"stack"` ReturnStack []math.HexOrDecimal64 `json:"returnStack"` - ReturnData []byte `json:"returnData"` + ReturnData hexutil.Bytes `json:"returnData"` Storage map[common.Hash]common.Hash `json:"-"` Depth int `json:"depth"` RefundCounter uint64 `json:"refund"` @@ -72,7 +72,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { MemorySize *int `json:"memSize"` Stack []*math.HexOrDecimal256 `json:"stack"` ReturnStack []math.HexOrDecimal64 `json:"returnStack"` - ReturnData []byte `json:"returnData"` + ReturnData *hexutil.Bytes `json:"returnData"` Storage map[common.Hash]common.Hash `json:"-"` Depth *int `json:"depth"` RefundCounter *uint64 `json:"refund"` @@ -113,7 +113,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error { } } if dec.ReturnData != nil { - s.ReturnData = dec.ReturnData + s.ReturnData = *dec.ReturnData } if dec.Storage != nil { s.Storage = dec.Storage diff --git a/core/vm/logger.go b/core/vm/logger.go index 3b166b5d2..c07e7787c 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -82,6 +82,7 @@ type structLogMarshaling struct { Gas math.HexOrDecimal64 GasCost math.HexOrDecimal64 Memory hexutil.Bytes + ReturnData hexutil.Bytes OpName string `json:"opName"` // adds call to OpName() in MarshalJSON ErrorString string `json:"error"` // adds call to ErrorString() in MarshalJSON }