Skip to content
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

Clarify EVM tracing #403

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions docs/build/EVM/evm-debug-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d \
"jsonrpc":"2.0",
"id":1,
"method":"debug_traceTransaction",
"params": ["0x04978f83e778d715eb074352091b2159c0689b5ae2da2554e8fe8e609ab463bf"]
"params": ["0xc74f3219cf6b9763ee5037bab4aa8ebe5eafe85122b00a64c2ce82912c7d3960"]
}'
```

Expand All @@ -85,11 +85,10 @@ The node responds with the step-by-step replayed transaction information.
For the `trace_filter` call, you can make the following JSON RPC request in your terminal (in this case, the filter is from block 20000 to 25000, only for transactions where the recipient is 0x4E0078423a39EfBC1F8B5104540aC2650a756577, it will start with a zero offset and provide the first 20 traces):

```
curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d \
'{
curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d '{
"jsonrpc":"2.0",
"id":1,
"method":"trace_filter", "params":[{"fromBlock":"0x4E20","toBlock":"0x5014","toAddress":["0x4E0078423a39EfBC1F8B5104540aC2650a756577"],"after":0,"count":20}]
"method":"trace_filter","params":[{"fromBlock":"4142700","toBlock":"4142800","toAddress":["0xb1dD8BABf551cD058F3B253846EB6FA2a5cabc50"],"after":0,"count":20}]
}'
```

Expand All @@ -110,6 +109,6 @@ curl http://127.0.0.1:9944 -H "Content-Type:application/json;charset=utf-8" -d \
'{
"jsonrpc":"2.0",
"id":1,
"method":"txpool_status", "params":[],"after":0,"count":20}]
"method":"txpool_status", "params":[]
}'
```
32 changes: 21 additions & 11 deletions docs/build/nodes/evm-tracing-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ Tracing node setup in general is equal to Archive Node setup (INSERT_LINK). Exce

:::info

EVM tracing node binary is different because includes additional tracing features. You can easily build it from source code using `cargo build --release --features evm-tracing` command or download from [latest release](https://github.com/AstarNetwork/Astar/releases/latest), executable EVM tracing binary is included in the compressed file `evm-tracing-artifacts.tar.gz`.
EVM tracing node binary is different because includes additional tracing features. You can easily build it from source code using `cargo build --release --features evm-tracing` command or download the `evm-tracing-artifacts` from [latest release](https://github.com/AstarNetwork/Astar/releases/latest), executable EVM tracing binary is included in the compressed file `evm-tracing-artifacts.tar.gz`.

:::

:::important

EVM RPC calls are disabled by default, and require additional flag to be enabled. Please refer to this page (INSERT_LINK) for more info.
EVM RPC calls are disabled by default, and require the `--enable-evm-rpc` additional flag to be enabled. Please refer to this page (INSERT_LINK) for more info.

:::

### Runtime overriding

Tracing runtimes has additional debug API that makes possible deep (and slow) transaction debugging. For this reason it's not part of production runtimes. So, for using tracing features current runtime must be overrided by special `tracing` runtime according to current on-chain runtime version.
Tracing runtimes has additional debug API that makes possible deep (and slow) transaction debugging. For this reason it's not part of production runtimes. So, for using tracing features, runtime must be overrided by special `tracing` runtime.

For example, if current rutime is `astar-52` then `astar-runtime-52-substitute-tracing.wasm` blob should be used for overriding. Usually tracing runtime published in release assets, please check [latest release here](https://github.com/AstarNetwork/Astar/releases/latest).
For example, if current rutime is `astar-52` then `astar-runtime-52-substitute-tracing.wasm` blob should be used for overriding and debug recent transactions. Tracing runtime is published in release assets as `evm-tracing-artifacts`, please check [latest release here](https://github.com/AstarNetwork/Astar/releases/latest).

For runtime override please create folder somewhere node can access it, by default it could be `/var/lib/astar/wasm`. And then copy overriding runtime into this folder.
For runtime override please create folder somewhere node can access it, by default it could be `/var/lib/astar/wasm`. And then copy overriding runtimes into this folder.
This folder is cumulative, this means you can place all previous runtimes at the same place to be able to trace historical data.

```
mkdir /var/lib/astar/wasm
Expand All @@ -48,6 +49,13 @@ chown -hR astar /var/lib/astar/wasm

When wasm blob located correctly the node launch string should be addicted by `--wasm-runtime-overrides=/var/lib/astar/wasm` flag. Then service should be restarted, if all go well then node will catch up tracing runtime and substitute on-chain version by it.

:::important

Tracing data at a certain block requires to override the runtime version of this block.
To use tracing on an ancient blocks, you need to add the runtime that was in place at this block.

:::

## Service parameters

The service file for a tracing node will look like this
Expand All @@ -68,17 +76,18 @@ User=astar
Group=astar

ExecStart=/usr/local/bin/astar-collator \
--pruning archive \
--chain astar \
--state-pruning archive \
--blocks-pruning archive \
--rpc-cors all \
--name {NODE_NAME} \
--chain shibuya \
--base-path /var/lib/astar \
--state-pruning archive \
--blocks-pruning archive \
--rpc-methods Safe \
--rpc-max-request-size 10 \
--rpc-max-response-size 10 \
--enable-evm-rpc \
--rpc-max-response-size 50 \
--enable-evm-rpc \
--ethapi=txpool,debug,trace \
--wasm-runtime-overrides /var/lib/astar/wasm \
--telemetry-url 'wss://telemetry.polkadot.io/submit/ 0' \
Expand All @@ -102,10 +111,11 @@ User=astar
Group=astar

ExecStart=/usr/local/bin/astar-collator \
--pruning archive \
--chain shiden \
--state-pruning archive \
--blocks-pruning archive \
--rpc-cors all \
--name {NODE_NAME} \
--chain shibuya \
--base-path /var/lib/astar \
--state-pruning archive \
--blocks-pruning archive \
Expand Down
Loading