From e3b3af4349453938dbb71b9f66385302bfc6356f Mon Sep 17 00:00:00 2001 From: HighGoal1991 Date: Mon, 23 Oct 2023 15:42:30 +0200 Subject: [PATCH] website: fix out-of-date tracing docs (#28406) This update covers this PRs: - https://github.com/ethereum/go-ethereum/pull/26414 - https://github.com/ethereum/go-ethereum/pull/27183 - https://github.com/ethereum/go-ethereum/pull/26291 - https://github.com/ethereum/go-ethereum/pull/26048 --- docs/developers/evm-tracing/custom-tracer.md | 3 +- docs/interacting-with-geth/rpc/ns-debug.md | 68 ++++++++++++-------- docs/interacting-with-geth/rpc/ns-eth.md | 46 ++++++++----- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/docs/developers/evm-tracing/custom-tracer.md b/docs/developers/evm-tracing/custom-tracer.md index 3c6497f18..eccf43c5d 100644 --- a/docs/developers/evm-tracing/custom-tracer.md +++ b/docs/developers/evm-tracing/custom-tracer.md @@ -216,11 +216,10 @@ If the step function throws an exception or executes an illegal operation at any - `gas` - Number, gas budget of the transaction - `gasUsed` - Number, amount of gas used in executing the transaction (excludes txdata costs) - `gasPrice` - Number, gas price configured in the transaction being executed -- `intrinsicGas` - Number, intrinsic gas for the transaction being executed - `value` - big.Int, amount to be transferred in wei - `block` - Number, block number - `output` - Buffer, value returned from EVM -- `time` - String, execution runtime +- `error` - String, non-empty if there was an EVM error And these fields are only available for tracing mined transactions (i.e. not available when doing `debug_traceCall`): diff --git a/docs/interacting-with-geth/rpc/ns-debug.md b/docs/interacting-with-geth/rpc/ns-debug.md index b17f5ceb3..e45da3aa0 100644 --- a/docs/interacting-with-geth/rpc/ns-debug.md +++ b/docs/interacting-with-geth/rpc/ns-debug.md @@ -494,36 +494,48 @@ References: ```js > debug.traceBlock("0xblock_rlp") -{ - gas: 85301, - returnValue: "", - structLogs: [{ - depth: 1, - error: "", - gas: 162106, - gasCost: 3, - memory: null, - op: "PUSH1", - pc: 0, - stack: [], - storage: {} +[ + { + txHash: "0xabba...", + result: { + gas: 85301, + returnValue: "", + structLogs: [{ + depth: 1, + error: "", + gas: 162106, + gasCost: 3, + memory: null, + op: "PUSH1", + pc: 0, + stack: [], + storage: {} + }, + /* snip */ + { + depth: 1, + error: "", + gas: 100000, + gasCost: 0, + memory: ["0000000000000000000000000000000000000000000000000000000000000006", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000060"], + op: "STOP", + pc: 120, + stack: ["00000000000000000000000000000000000000000000000000000000d67cbec9"], + storage: { + 0000000000000000000000000000000000000000000000000000000000000004: "8241fa522772837f0d05511f20caa6da1d5a3209000000000000000400000001", + 0000000000000000000000000000000000000000000000000000000000000006: "0000000000000000000000000000000000000000000000000000000000000001", + f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f: "00000000000000000000000002e816afc1b5c0f39852131959d946eb3b07b5ad" + } + }] + } }, - /* snip */ { - depth: 1, - error: "", - gas: 100000, - gasCost: 0, - memory: ["0000000000000000000000000000000000000000000000000000000000000006", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000060"], - op: "STOP", - pc: 120, - stack: ["00000000000000000000000000000000000000000000000000000000d67cbec9"], - storage: { - 0000000000000000000000000000000000000000000000000000000000000004: "8241fa522772837f0d05511f20caa6da1d5a3209000000000000000400000001", - 0000000000000000000000000000000000000000000000000000000000000006: "0000000000000000000000000000000000000000000000000000000000000001", - f652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f: "00000000000000000000000002e816afc1b5c0f39852131959d946eb3b07b5ad" - } - }] + txHash: "0xacca...", + result: { + /* snip */ + } + } +] ``` ### debug_traceBlockByNumber diff --git a/docs/interacting-with-geth/rpc/ns-eth.md b/docs/interacting-with-geth/rpc/ns-eth.md index 14bd52e71..b5d447cf1 100644 --- a/docs/interacting-with-geth/rpc/ns-eth.md +++ b/docs/interacting-with-geth/rpc/ns-eth.md @@ -15,7 +15,7 @@ Executes a new message call immediately, without creating a transaction on the b **Parameters:** -The method takes 3 parameters: an unsigned transaction object to execute in read-only mode; the block number to execute the call against; and an optional state override-set to allow executing the call against a modified chain state. +The method takes 4 parameters: an unsigned transaction object to execute in read-only mode; the block number to execute the call against; an optional state override-set to allow executing the call against a modified chain state; and an optional set of overrides for the block context. 1. `Object` - Transaction call object @@ -43,21 +43,37 @@ The method takes 3 parameters: an unsigned transaction object to execute in read - It can be used for smart contract analysis by extending the code deployed on chain with custom methods and invoking them. This avoids having to download and reconstruct the entire state in a sandbox to run custom code against. - It can be used to debug smart contracts in an already deployed large suite of contracts by selectively overriding some code or state and seeing how execution changes. Specialized tooling will probably be necessary. -**Example:** + **Example:** + + ```json + { + "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3": { + "balance": "0xde0b6b3a7640000" + }, + "0xebe8efa441b9302a0d7eaecc277c09d20d684540": { + "code": "0x...", + "state": { + "" + } + } + } + ``` + +4. `Object` - Block override set + + The fields of this optional object customize the block as part of which the call is simulated. The object contains the following fields: + + | Field | Type | Bytes | Optional | Description | + |---------------|----------|-------|----------|----------------------------------------------------------| + | `number` | Quantity | <32 | Yes | Fake block number | + | `difficulty` | Quantity | <32 | Yes | Fake difficulty. Note post-merge difficulty should be 0. | + | `time` | Quantity | <8 | Yes | Fake block timestamp | + | `gasLimit` | Quantity | <8 | Yes | Block gas capacity | + | `coinbase` | String | 20 | Yes | Block fee recipient | + | `random` | Binary | 32 | Yes | Fake PrevRandao value | + | `baseFee` | Quantity | <32 | Yes | Block base fee (see EIP-1559) | + | `blobBaseFee` | Quantity | <32 | Yes | Block blob base fee (see EIP-4844) | -```json -{ - "0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3": { - "balance": "0xde0b6b3a7640000" - }, - "0xebe8efa441b9302a0d7eaecc277c09d20d684540": { - "code": "0x...", - "state": { - "" - } - } -} -``` **Response:**