Skip to content

Commit d3aa87a

Browse files
authored
docs(l2): improve ethrex-replay docs (#3498)
> [!CAUTION] > Merge after #3482 **Motivation** The `ethrex-replay::README.md` file was outdated. **Description** - Removes `ethrex_replay/README.md`. - Creates `docs/ethrex_replay.md`. - Adds some missing targets to `ethrex_replay/Makefile`. Closes None
1 parent adce3a5 commit d3aa87a

File tree

4 files changed

+152
-14
lines changed

4 files changed

+152
-14
lines changed

cmd/ethrex_replay/Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,23 @@
66

77
NETWORK ?= mainnet
88

9+
# Block parameters
910
ifdef BLOCK_NUMBER
1011
REPLAY_BLOCK_ARGS = ${BLOCK_NUMBER}
1112
endif
1213
REPLAY_BLOCK_ARGS += --rpc-url ${RPC_URL} --network ${NETWORK} --bench
1314

14-
ifdef BATCH_NUMBER
15-
REPLAY_BATCH_ARGS = ${BATCH_NUMBER}
15+
# Batch parameters
16+
REPLAY_BATCH_ARGS = ${BATCH_NUMBER} --rpc-url ${RPC_URL} --network ${NETWORK} --bench
17+
18+
# Transaction parameters
19+
REPLAY_TX_ARGS = ${TX_HASH} --rpc-url ${RPC_URL} --network ${NETWORK}
20+
ifdef L2
21+
REPLAY_TX_ARGS += --l2
1622
endif
17-
REPLAY_BATCH_ARGS += --rpc-url ${RPC_URL} --network ${NETWORK} --bench
1823

24+
# Block Composition parameters
25+
REPLAY_BLOCK_COMPOSITION_ARGS = ${START_BLOCK} ${END_BLOCK} --rpc-url ${RPC_URL} --network ${NETWORK}
1926

2027
# Execution only
2128
## Block
@@ -38,6 +45,14 @@ batch-risc0:
3845
batch-risc0-gpu:
3946
cargo r -r --no-default-features --features "risc0,gpu,l2" -- execute batch ${REPLAY_BATCH_ARGS}
4047

48+
## Transaction
49+
transaction:
50+
cargo r -r -- execute transaction ${REPLAY_TX_ARGS}
51+
52+
## Plot Composition
53+
plot:
54+
cargo r -r -- block-composition ${REPLAY_BLOCK_COMPOSITION_ARGS}
55+
4156
# Proving
4257
## Block
4358
prove-sp1:
@@ -62,3 +77,6 @@ prove-batch-risc0:
6277
cargo r -r --no-default-features --features "risc0,l2" -- prove batch ${REPLAY_BATCH_ARGS}
6378
prove-batch-risc0-gpu:
6479
cargo r -r --no-default-features --features "risc0,gpu,l2" -- prove batch ${REPLAY_BATCH_ARGS}
80+
81+
help:
82+
cargo r -r -- --help

cmd/ethrex_replay/README.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# L1 block prover
1+
# ethrex-replay
22

3-
## Usage
4-
5-
1. For now we only support SP1. Install their [toolchain](https://docs.succinct.xyz/docs/sp1/introduction) first (version 5.0.0).
6-
2. Run:
7-
1. `make sp1 RPC_URL=<json rpc url> BLOCK_NUMBER=<number, optional>` for execution without proving
8-
2. `make prove-sp1 RPC_URL=<json rpc url> BLOCK_NUMBER=<number, optional>` for generating a proof.
9-
3. `make prove-sp1-gpu RPC_URL=<json rpc url> BLOCK_NUMBER=<number, optional>` for generating a proof with GPU acceleration.
10-
11-
If `BLOCK_NUMBER` is not defined then the latest block will be selected.
3+
See full documentation [here](../../docs/ethrex_replay/ethrex_replay.md).

cmd/ethrex_replay/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ enum EthrexReplayCommand {
319319
about = "Proves blocks, ranges of blocks, or individual transactions."
320320
)]
321321
Prove(SubcommandProve),
322-
#[command(about = "Proves blocks, ranges of blocks, or individual transactions.")]
322+
#[command(about = "Plots the composition of a range of blocks.")]
323323
BlockComposition {
324324
#[arg(help = "Starting block. (Inclusive)")]
325325
start: usize,

docs/ethrex_replay/ethrex_replay.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# ethrex-replay
2+
3+
A tool for executing and proving Ethereum blocks, transactions, and L2 batches — inspired by [starknet-replay](https://github.com/lambdaclass/starknet-replay).
4+
5+
## Getting Started
6+
7+
> **Note:** All commands must be run from the `ethrex/cmd/ethrex_replay` directory.
8+
9+
### Dependencies
10+
11+
#### [RISC0](https://dev.risczero.com/api/zkvm/install)
12+
13+
```sh
14+
curl -L https://risczero.com/install | bash
15+
rzup install cargo-risczero 1.2.0
16+
```
17+
18+
#### [SP1](https://docs.succinct.xyz/docs/sp1/introduction)
19+
20+
```sh
21+
curl -L https://sp1up.succinct.xyz | bash
22+
sp1up --version 5.0.0
23+
```
24+
25+
### Environment Variables
26+
27+
Before running any command, set the following environment variables depending on the operation:
28+
29+
```sh
30+
export RPC_URL=<RPC_URL>
31+
export BLOCK_NUMBER=<BLOCK_NUMBER>
32+
export BATCH_NUMBER=<BATCH_NUMBER>
33+
export TX_HASH=<TRANSACTION_HASH>
34+
export START_BLOCK=<START_BLOCK>
35+
export END_BLOCK=<END_BLOCK>
36+
export NETWORK=<mainnet|cancun|holesky|hoodi|sepolia|chainId>
37+
export L2=true
38+
```
39+
40+
#### Variable Descriptions
41+
42+
- `RPC_URL`: Ethereum JSON-RPC endpoint used to fetch on-chain data.
43+
- `BLOCK_NUMBER`: Block number to replay. If unset, the latest block will be used.
44+
- `BATCH_NUMBER`: L2 batch number to execute or prove.
45+
- `TX_HASH`: Hash of the transaction to replay.
46+
- `START_BLOCK` / `END_BLOCK`: Defines the block range to analyze and plot.
47+
- `NETWORK`: Logical network name or chain ID. Defaults to `mainnet`.
48+
- `L2`: Set to `true` to run transactions in L2 mode.
49+
50+
> You only need to set the variables required by the command you're running.
51+
52+
---
53+
54+
## Running Examples
55+
56+
### Execute a single block (no proving)
57+
58+
Required: `RPC_URL`.
59+
Optionally: `BLOCK_NUMBER`, `NETWORK`
60+
61+
```sh
62+
make sp1 # SP1 (CPU)
63+
make sp1-gpu # SP1 (GPU)
64+
make risc0 # RISC0 (CPU)
65+
make risc0-gpu # RISC0 (GPU)
66+
```
67+
68+
### Prove a single block
69+
70+
Required: `RPC_URL`.
71+
Optionally: `BLOCK_NUMBER`, `NETWORK`.
72+
73+
```sh
74+
make prove-sp1
75+
make prove-sp1-gpu
76+
make prove-risc0
77+
make prove-risc0-gpu
78+
```
79+
80+
### Execute an L2 batch (no proving)
81+
82+
Required: `RPC_URL`, `BATCH_NUMBER`, `NETWORK`.
83+
84+
```sh
85+
make batch-sp1
86+
make batch-sp1-gpu
87+
make batch-risc0
88+
make batch-risc0-gpu
89+
```
90+
91+
### Prove an L2 batch
92+
93+
Required: `RPC_URL`, `BATCH_NUMBER`, `NETWORK`.
94+
95+
```sh
96+
make prove-batch-sp1
97+
make prove-batch-sp1-gpu
98+
make prove-batch-risc0
99+
make prove-batch-risc0-gpu
100+
```
101+
102+
### Execute a transaction
103+
104+
Required: `RPC_URL`, `TX_HASH`, `NETWORK`.
105+
Optionally: `L2=true` (if the transaction is L2-specific)
106+
107+
```sh
108+
make transaction
109+
```
110+
111+
### Plot block composition
112+
113+
Required: `RPC_URL`, `START_BLOCK`, `END_BLOCK`.
114+
Optionally: `NETWORK`
115+
116+
```sh
117+
make plot
118+
```
119+
120+
---
121+
122+
## Check All Available Commands
123+
124+
Run:
125+
126+
```sh
127+
make help
128+
```

0 commit comments

Comments
 (0)