Skip to content

Commit b9dedeb

Browse files
authored
docs: add cost estimator docs (#513)
* docs: add cost estimator docs * docs: fix typo * docs: improve readability of commands
1 parent 18bd0de commit b9dedeb

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

book/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- [Celestia DA](./fault_proofs/experimental/celestia.md)
4141

4242
- [Advanced](./advanced/intro.md)
43+
- [Cost Estimator](./advanced/cost-estimator.md)
4344
- [Reproduce Binaries](./advanced/verify-binaries.md)
4445
- [Node Setup](./advanced/node-setup.md)
4546
- [Kurtosis](./advanced/kurtosis.md)

book/advanced/cost-estimator.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Cost Estimator
2+
3+
The Cost Estimator is a powerful tool that allows you to estimate proving costs for op-succinct without actually generating proofs. This helps you **optimize your proof generation strategy** by identifying potential causes of unexpected costs.
4+
5+
## Overview
6+
7+
The cost estimator simulates the proof generation process and provides detailed metrics including:
8+
- Total instruction count
9+
- Oracle verification costs
10+
- Derivation costs
11+
- Block execution costs
12+
- Blob verification costs
13+
- **SP1 gas usage**
14+
- Transaction counts and EVM gas usage
15+
- Various precompile cycles (BN pair, add, mul, KZG eval, etc.)
16+
17+
## Setup
18+
19+
Before running the cost estimator, you need to set up a .env file in the project root directory with the following RPC endpoints:
20+
21+
```bash
22+
L1_RPC=<YOUR_L1_RPC_ENDPOINT>
23+
L1_BEACON_RPC=<YOUR_L1_BEACON_RPC_ENDPOINT>
24+
L2_RPC=<YOUR_L2_RPC_ENDPOINT>
25+
L2_NODE_RPC=<YOUR_L2_NODE_RPC_ENDPOINT>
26+
```
27+
28+
## Usage
29+
30+
To run the cost estimator, use the following command:
31+
32+
```bash
33+
RUST_LOG=info cargo run --bin cost-estimator -- \
34+
--start <START_BLOCK> \
35+
--end <END_BLOCK> \
36+
--batch-size <BATCH_SIZE>
37+
```
38+
39+
Example:
40+
41+
```bash
42+
RUST_LOG=info cargo run --bin cost-estimator -- \
43+
--start 2000000 \
44+
--end 2001800 \
45+
--batch-size 1800
46+
```
47+
48+
<br>
49+
50+
For the best estimation, use a range bigger than the batcher interval with the batch size equal to the range.
51+
52+
### Output
53+
54+
The execution report is saved in the `execution-reports/{chain_id}/{start_block}-{end_block}-report.csv` directory.

0 commit comments

Comments
 (0)