feat(debug): align debug_trace* opcode tracer with execution-apis#762#12058
Closed
0xDevNinja wants to merge 1 commit into
Closed
feat(debug): align debug_trace* opcode tracer with execution-apis#762#120580xDevNinja wants to merge 1 commit into
0xDevNinja wants to merge 1 commit into
Conversation
Bring the default opcode (struct) logger output for debug_traceTransaction, debug_traceBlockByNumber and debug_traceBlockByHash in line with the standardized format from execution-apis#762, across both the object-building and the direct-streaming struct loggers: - omit the error field entirely when no error occurred (was always error: null) - attach the storage snapshot only to SLOAD/SSTORE entries and omit it when empty, instead of copying a cumulative snapshot onto every opcode entry - encode memory words as 0x-prefixed bytes32 - encode storage keys and values as 0x-prefixed bytes32 Closes NethermindEth#12040
Contributor
Author
|
Closing in favor of #12056, which already covers the same execution-apis#762 wire-format alignment and additionally fixes the op-level storage capture gating. No need for a duplicate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12040
Changes
Aligns the default opcode (struct) logger output of
debug_traceTransaction,debug_traceBlockByNumberanddebug_traceBlockByHashwith the standardized format from execution-apis#762. The same four fixes are applied to both struct loggers — the object-buildingGethLikeTxMemoryTracerand the direct-streamingGethLikeTxDirectStreamingTracer— so the streamed and in-memory responses stay identical:errorabsent when no error occurred — was always serialized as"error": null. TheGethTxTraceEntry.Errorattribute now usesWhenWritingNull, and the streaming logger no longer writes a nullerror.storageonly onSLOAD/SSTOREentries, omitted when empty — previously a cumulative snapshot was copied onto every opcode entry, emitting"storage": {}on non-storage ops. The cumulative per-frame snapshot is now attached to an entry only when that opcode reads or writes storage, and omitted when there is nothing to report.0x-prefixedbytes32—TraceMemory.ToHexWordList()and the streaming memory path (including the zero-word padding) now prefix each word with0x.0x-prefixedbytes32— the storage snapshot keys and values are now0x-prefixed.Already compliant and unchanged: stack encoding, top-level field names (
gas/failed/returnValue/structLogs), integergas/gasCost,opopcode-name string, and the block-trace{ txHash, result }pairing.Verified the exact wire format against the conformance fixtures shipped in #762 (
trace-block-memory-encoding,trace-block-storage-encoding,trace-block-storage-snapshot-timing).Notes / scope
IsTracingStorageflag (unchanged), so this PR does not change what data the struct logger collects, only how the emitted fields are shaped.debug_traceBlockByHash/debug_traceBlockByNumberreturns[]for genesis block instead of an error #12038/add error in debug_traceBlock* if block is genesis #12039) and the memory-trace size options.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Updated the existing
debug_trace*expectation fixtures (DebugRpcModuleTests) and the geth tracer unit tests (GethLikeTxMemoryTracerTests,GethLikeTxTraceConverterTests) to the new format. AddedStreaming_tracer_emits_spec_aligned_wire_format, which drives the streaming struct logger over a real execution and asserts the absence oferror/emptystorageand0x-prefixed memory words. All trace test suites pass.Documentation
Requires documentation update
Requires explanation in Release Notes
The
debug_trace*default struct-logger output now matches execution-apis#762: theerrorfield is omitted when no error occurred,storageis emitted only on SLOAD/SSTORE entries (no more empty{}), and memory words and storage keys/values are0x-prefixed.