docs(tracer): add disableCode,disableStorage

Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
jsvisa 2024-10-30 09:58:14 +08:00
parent 28196555af
commit 22e233da6e

View file

@ -216,6 +216,8 @@ The prestate tracer has two modes: `prestate` and `diff`. The `prestate` mode re
#### prestateTracer config {#prestate-tracer-config} #### prestateTracer config {#prestate-tracer-config}
- `diffMode`: `BOOL`. Setting this to true will enable diff mode (default = false). - `diffMode`: `BOOL`. Setting this to true will enable diff mode (default = false).
- `disableCode`: `BOOL`. Setting this to true will disable code capture (default = false).
- `disableStorage`: `BOOL`. Setting this to true will disable storage capture (default = false).
In `diff` mode the result object will contain a `pre` and a `post` object: In `diff` mode the result object will contain a `pre` and a `post` object:
@ -288,6 +290,43 @@ Return (same call with `{diffMode: True}`):
} }
``` ```
Example of `disableStorage` and `disableCode` mode:
```js
debug.traceCall(
{
from: '0x35a9f94af726f07b5162df7e828cc9dc8439e7d0',
to: '0xc8ba32cab1757528daf49033e3673fae77dcf05d',
data: '0xd1a2eab2000000000000000000000000000000000000000000000000000000000024aea100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000204895cd480cc8412691a880028a25aec86786f1ed2aa5562bc400000000000000c6403c14f35be1da6f433eadbb6e9178a47fbc7c6c1d568d2f2b876e929089c8d8db646304fd001a187dc8a600000000000000000000000000000000'
},
'latest',
{ tracer: 'prestateTracer', tracerConfig: { disableStorage: true } }
);
```
Return:
```terminal
{
0x0000000000000000000000000000000000000002: {
balance: "0x0"
},
0x008b3b2f992c0e14edaa6e2c662bec549caa8df1: {
balance: "0x2638035a26d133809"
},
0x35a9f94af726f07b5162df7e828cc9dc8439e7d0: {
balance: "0x7a48734599f7284",
nonce: 1133
},
0xc8ba32cab1757528daf49033e3673fae77dcf05d: {
balance: "0x0",
nonce: 1
}
}
```
It will return the same result as the first example, but without the storage slots and code.
### noopTracer {#noop-tracer} ### noopTracer {#noop-tracer}
This tracer is noop. It returns an empty object and is only meant for testing the setup. This tracer is noop. It returns an empty object and is only meant for testing the setup.