Skip to content

Commit

Permalink
website: fix out-of-date tracing docs (#28406)
Browse files Browse the repository at this point in the history
This update covers this PRs:
- #26414
- #27183
- #26291
- #26048
  • Loading branch information
s1na authored Oct 23, 2023
1 parent 3f59d0c commit 367f987
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 45 deletions.
3 changes: 1 addition & 2 deletions docs/developers/evm-tracing/custom-tracer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`):
Expand Down
68 changes: 40 additions & 28 deletions docs/interacting-with-geth/rpc/ns-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 31 additions & 15 deletions docs/interacting-with-geth/rpc/ns-eth.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:**

Expand Down

0 comments on commit 367f987

Please sign in to comment.