Skip to content

[SharovBot] fix: add 0x prefix to structLogs storage keys/values in debug_traceCall#20753

Closed
erigon-copilot[bot] wants to merge 1 commit into
release/3.4from
agent-fix/debug-trace-storage-0x-prefix
Closed

[SharovBot] fix: add 0x prefix to structLogs storage keys/values in debug_traceCall#20753
erigon-copilot[bot] wants to merge 1 commit into
release/3.4from
agent-fix/debug-trace-storage-0x-prefix

Conversation

@erigon-copilot
Copy link
Copy Markdown
Contributor

[SharovBot]

Summary

Fixes consistently failing mainnet-rpc-integ-tests-latest on release/3.4 — specifically debug_traceCall/test_43 which was reporting storage key/value mismatches.

Root Cause

The EVM struct log serialization was returning storage slot keys and values without the 0x hex prefix, causing mismatches with the reference node:

Expected: { "0x2fa8c5322c1048470ad77c09da3654fc909cba75...": "0x0000..." }
Got:      { "2fa8c5322c1048470ad77c09da3654fc909cba75...": "0000..." }

Files Changed

  • rpc/ethapi/api.go: FormatLogs() — used fmt.Sprintf("%x", i) instead of i.Hex()
  • execution/tracing/tracers/logger/logger.go: duplicate FormatLogs() — same fix
  • execution/tracing/tracers/logger/json_stream.go: streaming logger used raw hex.Encode() without 0x prefix instead of common.Hash.Hex()

Fix

Replace all three occurrences with common.Hash.Hex() which includes the 0x prefix consistently.

Testing

  • All existing unit tests pass: go test ./execution/tracing/tracers/... ./rpc/ethapi/...
  • go build ./... compiles clean ✅
  • Addresses debug_traceCall/test_43 failure in mainnet-rpc-integ-tests-latest

…ebug_traceCall

The EVM struct log serialization in debug_traceCall was returning storage
slot keys and values without the 0x hex prefix, causing mismatches with
reference node implementations.

Affected files:
- rpc/ethapi/api.go: FormatLogs() used fmt.Sprintf("%x") instead of .Hex()
- execution/tracing/tracers/logger/logger.go: same FormatLogs() duplicate
- execution/tracing/tracers/logger/json_stream.go: WriteObjectField/WriteString
  used raw hex.Encode without 0x prefix instead of common.Hash.Hex()

Fix: use common.Hash.Hex() which includes the 0x prefix consistently.

Fixes mainnet-rpc-integ-tests-latest debug_traceCall/test_43 failure on release/3.4.

Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
Copy link
Copy Markdown
Member

@yperbasis yperbasis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cherry pick PR #20478 instead

@yperbasis
Copy link
Copy Markdown
Member

Closing in favour of #20749

@yperbasis yperbasis closed this Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant