eth/tracers/logger: use omitzero for legacy error omission

Use a plain string field with omitzero for the legacy structLog error field so the JSON shape stays unchanged without pointer indirection.
This commit is contained in:
Chase Wright 2026-03-30 09:27:41 -05:00
parent 957e1ed413
commit fd461323fc
No known key found for this signature in database
GPG key ID: 7EA41EDCB1BE04A7

View file

@ -148,7 +148,7 @@ type structLogLegacy struct {
Gas uint64 `json:"gas"`
GasCost uint64 `json:"gasCost"`
Depth int `json:"depth"`
Error *string `json:"error,omitempty"`
Error string `json:"error,omitempty,omitzero"`
Stack *[]string `json:"stack,omitempty"`
ReturnData string `json:"returnData,omitempty"`
Memory *[]string `json:"memory,omitempty"`
@ -173,11 +173,9 @@ func (s *StructLog) toLegacyJSON() json.RawMessage {
Gas: s.Gas,
GasCost: s.GasCost,
Depth: s.Depth,
Error: s.ErrorString(),
RefundCounter: s.RefundCounter,
}
if err := s.ErrorString(); err != "" {
msg.Error = &err
}
if s.Stack != nil {
stack := make([]string, len(s.Stack))
for i, stackValue := range s.Stack {