From 05c7c62fa0077363bef0c198d5c81aad8171abf2 Mon Sep 17 00:00:00 2001 From: "erigon-copilot[bot]" Date: Sat, 18 Apr 2026 12:38:11 +0200 Subject: [PATCH 1/2] [SharovBot] fix: add 0x prefix to structLogs storage keys/values in debug_traceCall FormatLogs() was formatting storage map keys and values using fmt.Sprintf("%x", ...) which produces bare hex without the 0x prefix. The reference implementation returns storage keys/values with 0x prefix (e.g. "0x2fa8c5322c..."), but Erigon was returning "2fa8c5322c...". Fix: use common.Hash.Hex() which internally calls hexutil.Encode() and properly produces 0x-prefixed hex strings for both keys and values. This affects both rpc/ethapi/api.go (FormatLogs used by debug_traceCall, debug_traceTransaction, etc.) and the duplicate copy in execution/tracing/tracers/logger/logger.go. Fixes mainnet-rpc-integ-tests-latest CI failure consistently seen across all 10 recent release/3.4 commits (debug_traceCall/test_43.json). Refs: https://github.com/erigontech/erigon/actions/runs/24602505567/job/71943405095 Co-authored-by: Giulio Rebuffo --- execution/tracing/tracers/logger/logger.go | 2 +- rpc/ethapi/api.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/execution/tracing/tracers/logger/logger.go b/execution/tracing/tracers/logger/logger.go index 894bb545e53..bbbc0b5bb37 100644 --- a/execution/tracing/tracers/logger/logger.go +++ b/execution/tracing/tracers/logger/logger.go @@ -322,7 +322,7 @@ func FormatLogs(logs []StructLog) []StructLogRes { if trace.Storage != nil { storage := make(map[string]string) for i, storageValue := range trace.Storage { - storage[fmt.Sprintf("%x", i)] = fmt.Sprintf("%x", storageValue) + storage[i.Hex()] = storageValue.Hex() } formatted[index].Storage = &storage } diff --git a/rpc/ethapi/api.go b/rpc/ethapi/api.go index bfc5ca54727..670297cc9f3 100644 --- a/rpc/ethapi/api.go +++ b/rpc/ethapi/api.go @@ -415,7 +415,7 @@ func FormatLogs(logs []logger.StructLog) []StructLogRes { if trace.Storage != nil { storage := make(map[string]string) for i, storageValue := range trace.Storage { - storage[fmt.Sprintf("%x", i)] = fmt.Sprintf("%x", storageValue) + storage[i.Hex()] = storageValue.Hex() } formatted[index].Storage = &storage } From 1338d6425aecfb1815cd57d8407a0d2caf46a7eb Mon Sep 17 00:00:00 2001 From: SharovBot Date: Wed, 22 Apr 2026 21:47:09 +0200 Subject: [PATCH 2/2] fix: add 0x prefix to structLogs storage in JsonStreamLogger (debug_traceCall) Co-authored-by: Giulio Rebuffo --- execution/tracing/tracers/logger/json_stream.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/execution/tracing/tracers/logger/json_stream.go b/execution/tracing/tracers/logger/json_stream.go index 93cbf4061a4..89c7cb3931a 100644 --- a/execution/tracing/tracers/logger/json_stream.go +++ b/execution/tracing/tracers/logger/json_stream.go @@ -214,8 +214,8 @@ func (l *JsonStreamLogger) OnOpcode(pc uint64, typ byte, gas, cost uint64, scope } else { l.stream.WriteMore() } - l.stream.WriteObjectField(string(l.hexEncodeBuf[0:hex.Encode(l.hexEncodeBuf[:], loc[:])])) - l.stream.WriteString(string(l.hexEncodeBuf[0:hex.Encode(l.hexEncodeBuf[:], value[:])])) + l.stream.WriteObjectField(loc.Hex()) + l.stream.WriteString(common.Hash(value).Hex()) } l.stream.WriteObjectEnd() }