Skip to content

[SharovBot] fix: add 0x prefix to structLog storage keys and values#20732

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

[SharovBot] fix: add 0x prefix to structLog storage keys and values#20732
erigon-copilot[bot] wants to merge 1 commit into
release/3.4from
fix/structlog-storage-0x-prefix-release-3.4

Conversation

@erigon-copilot
Copy link
Copy Markdown
Contributor

[SharovBot]

Problem

debug_traceBlockByNumber and debug_traceCall were returning storage keys/values in structLogs without the 0x prefix:

"storage": {
  "2fa8c5322c1048470ad77c09da3654fc909cba75d0344927ddd1da93527c2044": "0000000000000000000000000000000000000000000000000000000000000000"
}

go-ethereum returns them with the 0x prefix:

"storage": {
  "0x2fa8c5322c1048470ad77c09da3654fc909cba75d0344927ddd1da93527c2044": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

This caused two RPC integration test failures on release/3.4 across all 10 recent commits:

  • debug_traceBlockByNumber/test_42
  • debug_traceCall/test_43

Fix

Add 0x prefix to storage keys and values in the three code paths that format structLog storage:

  • execution/tracing/tracers/logger/json_stream.go — streaming path (used by debug_traceCall and debug_traceBlockByNumber)
  • execution/tracing/tracers/logger/logger.go — StructLogger format path
  • rpc/ethapi/api.go — ethapi format path

Testing

Verified by:

  • go build ./... passes
  • Diff output matches go-ethereum reference for storage key/value format

debug_traceBlockByNumber and debug_traceCall were returning storage
keys/values in structLogs without the 0x prefix, e.g.:
  "2fa8c5322c...": "0000..."

go-ethereum returns them with the 0x prefix:
  "0x2fa8c5322c...": "0x0000..."

This caused two RPC integration test failures on release/3.4
(debug_traceBlockByNumber/test_42 and debug_traceCall/test_43)
across all commits.

Fix the three code paths that format storage in structLogs:
- execution/tracing/tracers/logger/json_stream.go (streaming path used
  by debug_traceCall and debug_traceBlockByNumber)
- execution/tracing/tracers/logger/logger.go (StructLogger format path)
- rpc/ethapi/api.go (ethapi format path)

Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com>
@erigon-copilot
Copy link
Copy Markdown
Contributor Author

[SharovBot]

Closing in favor of #20647 which covers the same fix (logger.go + api.go storage 0x prefix) and already passed CI on April 18. #20647 is the active PR for this issue.

@erigon-copilot erigon-copilot Bot closed this Apr 22, 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.

0 participants