-
Notifications
You must be signed in to change notification settings - Fork 494
Standardize opcode tracer behavior for debug_traceBlockByNumber and debug_traceTransaction #762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MysticRyuujin
wants to merge
9
commits into
ethereum:main
Choose a base branch
from
MysticRyuujin:opcode-tracer-spec
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2c2abf6
debug, schemas: add opcode tracer spec for debug_traceBlockByNumber a…
MysticRyuujin e7de378
wordlist: add SLOAD and SSTORE for spellcheck
MysticRyuujin dfe4f53
update
MysticRyuujin c91344c
debug: reorder example fields, clarify gasCost description
MysticRyuujin 0131e3f
debug: remove reexec from TraceConfig
MysticRyuujin a4dbaaa
tools: point go-ethereum replace to MysticRyuujin fork fix branch
MysticRyuujin 5bc226d
debug, tools: add debug_traceBlockByHash, clarify timeout behavior, u…
MysticRyuujin e2a1921
debug, schemas: make timeout advisory for streaming clients
MysticRyuujin a87ff44
Merge branch 'main' into opcode-tracer-spec
MysticRyuujin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,319 @@ | ||
| - name: debug_traceBlockByNumber | ||
| summary: Replays a block and returns traces for all transactions. | ||
| description: >- | ||
| Replays the block identified by the given number and returns a trace for | ||
| every transaction in the block. The parent block must be present in the | ||
| client's database. The genesis block (block 0) cannot be traced because | ||
| it has no parent state to replay from; clients MUST return an error for | ||
| this input. | ||
|
|
||
| When no tracer is specified (or the tracer field is absent), the opcode | ||
| (struct) logger is used and each entry conforms to | ||
| OpcodeBlockTransactionTrace, whose result field conforms to | ||
| OpcodeTransactionTrace. | ||
|
|
||
| When a named tracer is specified via the tracer field in TraceConfig (e.g. | ||
| "callTracer", "prestateTracer"), the result field of each entry contains | ||
| tracer-specific output. Defining the output schemas of named tracers is | ||
| outside the scope of this specification. | ||
|
|
||
| The response is an array ordered by transaction index within the block. | ||
| Each entry includes the transaction hash paired with its trace result. | ||
|
MysticRyuujin marked this conversation as resolved.
|
||
| If a timeout is configured and reached before tracing completes, the | ||
| client MUST return an error; no partial results are returned. Clients | ||
| that do not support execution timeouts MAY ignore the timeout field. | ||
| params: | ||
| - name: Block | ||
| required: true | ||
| schema: | ||
| $ref: '#/components/schemas/BlockNumberOrTag' | ||
| - name: TraceConfig | ||
| required: false | ||
| schema: | ||
| $ref: '#/components/schemas/TraceConfig' | ||
| errors: | ||
| - code: 4444 | ||
| message: Pruned history unavailable | ||
|
MysticRyuujin marked this conversation as resolved.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably also an error for "block not found" and parent not found
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as here |
||
| result: | ||
| name: Block trace | ||
| schema: | ||
| title: Array of per-transaction traces | ||
| description: >- | ||
| An array of trace entries ordered by transaction index within the block. | ||
| When no named tracer is set, each entry conforms to | ||
| OpcodeBlockTransactionTrace. When a named tracer is set, the result | ||
| field of each entry contains tracer-specific output not defined by this | ||
| specification, but the txHash field is always present. | ||
| type: array | ||
| items: | ||
| anyOf: | ||
| - title: Opcode tracer entry | ||
| description: Returned when no named tracer is specified. | ||
| $ref: '#/components/schemas/OpcodeBlockTransactionTrace' | ||
| - title: Named tracer entry | ||
| description: >- | ||
| Returned when a named tracer is specified. The result field | ||
| contains tracer-specific output not defined by this specification. | ||
| type: object | ||
| required: | ||
| - txHash | ||
| - result | ||
| properties: | ||
| txHash: | ||
| $ref: '#/components/schemas/hash32' | ||
| result: | ||
| description: >- | ||
| Named tracer output. The schema is unspecified and may be | ||
| any valid JSON value. | ||
| examples: | ||
| - name: debug_traceBlockByNumber example (opcode tracer) | ||
| params: | ||
| - name: Block | ||
| value: '0x3' | ||
| - name: TraceConfig | ||
| value: | ||
| disableStack: false | ||
| disableStorage: false | ||
| enableMemory: false | ||
| enableReturnData: false | ||
| result: | ||
| name: Block trace | ||
| value: | ||
| - txHash: '0xdd8cf045113754c306ba9ac8ac8786235e33bc5c087678084ef260a2a583f127' | ||
| result: | ||
| structLogs: | ||
| - pc: 0 | ||
| op: PUSH1 | ||
| gas: 68612 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - pc: 2 | ||
| op: PUSH1 | ||
| gas: 68609 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - '0x40' | ||
| - pc: 4 | ||
| op: MSTORE | ||
| gas: 68606 | ||
| gasCost: 12 | ||
| depth: 1 | ||
| stack: [] | ||
| gas: 26916 | ||
| failed: false | ||
| returnValue: '0x' | ||
|
|
||
| - name: debug_traceBlockByHash | ||
| summary: Replays a block and returns traces for all transactions. | ||
| description: >- | ||
| Replays the block identified by the given hash and returns a trace for | ||
| every transaction in the block. The parent block must be present in the | ||
| client's database. The genesis block (block 0) cannot be traced because | ||
| it has no parent state to replay from; clients MUST return an error for | ||
| this input. | ||
|
|
||
| When no tracer is specified (or the tracer field is absent), the opcode | ||
| (struct) logger is used and each entry conforms to | ||
| OpcodeBlockTransactionTrace, whose result field conforms to | ||
| OpcodeTransactionTrace. | ||
|
|
||
| When a named tracer is specified via the tracer field in TraceConfig (e.g. | ||
| "callTracer", "prestateTracer"), the result field of each entry contains | ||
| tracer-specific output. Defining the output schemas of named tracers is | ||
| outside the scope of this specification. | ||
|
|
||
| The response is an array ordered by transaction index within the block. | ||
| Each entry includes the transaction hash paired with its trace result. | ||
| If a timeout is configured and reached before tracing completes, the | ||
| client MUST return an error; no partial results are returned. Clients | ||
| that do not support execution timeouts MAY ignore the timeout field. | ||
|
|
||
| Clients MUST return an error if no block with the given hash is found. | ||
| params: | ||
| - name: Block hash | ||
| required: true | ||
| schema: | ||
| $ref: '#/components/schemas/hash32' | ||
| - name: TraceConfig | ||
| required: false | ||
| schema: | ||
| $ref: '#/components/schemas/TraceConfig' | ||
| errors: | ||
| - code: 4444 | ||
| message: Pruned history unavailable | ||
| result: | ||
| name: Block trace | ||
| schema: | ||
| title: Array of per-transaction traces | ||
| description: >- | ||
| An array of trace entries ordered by transaction index within the block. | ||
| When no named tracer is set, each entry conforms to | ||
| OpcodeBlockTransactionTrace. When a named tracer is set, the result | ||
| field of each entry contains tracer-specific output not defined by this | ||
| specification, but the txHash field is always present. | ||
| type: array | ||
| items: | ||
| anyOf: | ||
| - title: Opcode tracer entry | ||
| description: Returned when no named tracer is specified. | ||
| $ref: '#/components/schemas/OpcodeBlockTransactionTrace' | ||
| - title: Named tracer entry | ||
| description: >- | ||
| Returned when a named tracer is specified. The result field | ||
| contains tracer-specific output not defined by this specification. | ||
| type: object | ||
| required: | ||
| - txHash | ||
| - result | ||
| properties: | ||
| txHash: | ||
| $ref: '#/components/schemas/hash32' | ||
| result: | ||
| description: >- | ||
| Named tracer output. The schema is unspecified and may be | ||
| any valid JSON value. | ||
| examples: | ||
| - name: debug_traceBlockByHash example (opcode tracer) | ||
| params: | ||
| - name: Block hash | ||
| value: '0x79ba0368c2c6563a7d263695b583dcc6d1c25d4988daa0105804d38bdd987f2f' | ||
| - name: TraceConfig | ||
| value: | ||
| disableStack: false | ||
| disableStorage: false | ||
| enableMemory: false | ||
| enableReturnData: false | ||
| result: | ||
| name: Block trace | ||
| value: | ||
| - txHash: '0xdd8cf045113754c306ba9ac8ac8786235e33bc5c087678084ef260a2a583f127' | ||
| result: | ||
| structLogs: | ||
| - pc: 0 | ||
| op: PUSH1 | ||
| gas: 68612 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - pc: 2 | ||
| op: PUSH1 | ||
| gas: 68609 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - '0x40' | ||
| - pc: 4 | ||
| op: MSTORE | ||
| gas: 68606 | ||
| gasCost: 12 | ||
| depth: 1 | ||
| stack: [] | ||
| gas: 26916 | ||
| failed: false | ||
| returnValue: '0x' | ||
|
|
||
| - name: debug_traceTransaction | ||
| summary: Replays a transaction and returns its trace. | ||
| description: >- | ||
| Executes the transaction identified by the given hash in the exact manner it | ||
| was executed on the network, replaying all prior transactions in the same | ||
| block as necessary to reconstruct the correct pre-execution state. | ||
|
|
||
| When no tracer is specified (or the tracer field is absent), the opcode | ||
| (struct) logger is used and the result conforms to OpcodeTransactionTrace. | ||
|
|
||
| When a named tracer is specified via the tracer field in TraceConfig (e.g. | ||
| "callTracer", "prestateTracer"), the result contains tracer-specific output. | ||
| Defining the output schemas of named tracers is outside the scope of this | ||
| specification. | ||
| params: | ||
| - name: Transaction hash | ||
| required: true | ||
| schema: | ||
| $ref: '#/components/schemas/hash32' | ||
| - name: TraceConfig | ||
| required: false | ||
| schema: | ||
| $ref: '#/components/schemas/TraceConfig' | ||
| errors: | ||
| - code: 4444 | ||
| message: Pruned history unavailable | ||
| result: | ||
| name: Transaction trace | ||
| schema: | ||
| title: Transaction trace result | ||
| anyOf: | ||
| - title: Opcode tracer result | ||
| description: Returned when no named tracer is specified. | ||
| $ref: '#/components/schemas/OpcodeTransactionTrace' | ||
| - title: Named tracer result | ||
| description: >- | ||
| Returned when a named tracer is specified via the tracer field. | ||
| The format is tracer-specific and not defined by this specification. | ||
| Named tracers may return any JSON value (object, array, integer, etc.). | ||
| examples: | ||
| - name: debug_traceTransaction example (opcode tracer) | ||
| params: | ||
| - name: Transaction hash | ||
| value: '0xdd8cf045113754c306ba9ac8ac8786235e33bc5c087678084ef260a2a583f127' | ||
| - name: TraceConfig | ||
| value: | ||
| disableStack: false | ||
| disableStorage: false | ||
| enableMemory: false | ||
| enableReturnData: false | ||
| result: | ||
| name: Transaction trace | ||
| value: | ||
| structLogs: | ||
| - pc: 0 | ||
| op: PUSH1 | ||
| gas: 68612 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - pc: 2 | ||
| op: PUSH1 | ||
| gas: 68609 | ||
| gasCost: 3 | ||
| depth: 1 | ||
| stack: | ||
| - '0x60' | ||
| - '0x40' | ||
| - pc: 4 | ||
| op: MSTORE | ||
| gas: 68606 | ||
| gasCost: 12 | ||
| depth: 1 | ||
| stack: [] | ||
| gas: 26916 | ||
| failed: false | ||
| returnValue: '0x' | ||
| - name: debug_traceTransaction example (callTracer) | ||
| params: | ||
| - name: Transaction hash | ||
| value: '0xdd8cf045113754c306ba9ac8ac8786235e33bc5c087678084ef260a2a583f127' | ||
| - name: TraceConfig | ||
| value: | ||
| tracer: callTracer | ||
| tracerConfig: | ||
| onlyTopCall: false | ||
| withLog: true | ||
| result: | ||
| name: Transaction trace (callTracer) | ||
| value: | ||
| type: CALL | ||
| from: '0xfe3b557e8fb62b89f4916b721be55ceb828dbd73' | ||
| to: '0x0100000000000000000000000000000000000000' | ||
| value: '0x0' | ||
| gas: '0x1a49e' | ||
| gasUsed: '0x1a49e' | ||
| input: '0x' | ||
| output: '0x' | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.