Skip to content

Commit 7267fbd

Browse files
add README for stwo_run_and_prove
1 parent a09cfc0 commit 7267fbd

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
This workspace contains multiple CLI binaries. Start here, then follow the links to each binary’s README for full usage.
44

5+
56
## Binaries
67

78
### `cairo_program_runner` (crate: `cairo-program-runner`)
@@ -16,6 +17,7 @@ Docs: `crates/cairo-program-runner/README.md`
1617
Quick start:
1718
cargo run -p cairo-program-runner --bin cairo_program_runner -- --help
1819

20+
1921
### `vm_runner` / `stwo_vm_runner` (crate: `vm_runner`)
2022

2123
Runs a compiled Cairo program in proof-mode config and adapts the result to `stwo_cairo_adapter::ProverInput`. Writes execution resources, and optionally prover input.
@@ -25,6 +27,17 @@ Docs: `crates/vm_runner/README.md`
2527
Quick start:
2628
cargo run -p vm_runner -- --help
2729

30+
31+
### `stwo_run_and_prove` / (crate: `stwo_run_and_prove`)
32+
33+
Runs a compiled cairo program and generates a Stwo proof for it. Optionally verifies the proof, and saves the program output and data for debugging.
34+
35+
Docs: `crates/stwo_run_and_prove/README.md`
36+
37+
Quick start:
38+
cargo run -p stwo_run_and_prove -- --help
39+
40+
2841
## Build
2942

3043
cargo build --release
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# stwo_run_and_prove
2+
3+
Runs a compiled Cairo program and generates a Stwo proof for it. Optionally verifies the proof.
4+
Saves the proof to the given path with the requested format, and optionally saves the program output and data for debugging.
5+
6+
Entry point: `crates/stwo_run_and_prove/src/main.rs`
7+
8+
9+
## Build & run
10+
11+
cargo run -p stwo_run_and_prove -- --help
12+
13+
14+
## Basic usage
15+
16+
Required arguments:
17+
- `--program <PathBuf>`: Absolute path to the compiled Cairo program.
18+
- `--proof_path <PathBuf>`: Absolute path where the generated proof will be saved.
19+
20+
Basic Example:
21+
cargo run -p stwo_run_and_prove -- \
22+
--program path/to/compiled_program.json \
23+
--proof_path proof.json
24+
25+
Optional arguments:
26+
- `--program_input <PathBuf>`: Absolute path to the program input file.
27+
- `--program_output <PathBuf>`: Absolute path where the program's output will be saved.
28+
- `--prover_params_json <PathBuf>`: Absolute path to the JSON file containing the prover parameters.
29+
- `--proof_format <ProofFormat>`: Proof format (Json or CairoSerde. default: CairoSerde).
30+
- `--verify`: Verifies the generated proof.
31+
- `--save_debug_data`: Saves the ProverInput to a file in `debug_data_dir` for both success and failure.
32+
- `--debug_data_dir <PathBuf>`: Absolute path to the output directory where the ProverInput will be saved in the
33+
case of a proving error, or when the save_debug_data flag is enabled.
34+
35+
Example with verification and debug data:
36+
cargo run -p stwo_run_and_prove -- \
37+
--program path/to/compiled_program.json \
38+
--program_input path/to/program_input.json \
39+
--proof_path path/to/proof.json \
40+
--verify \
41+
--debug_data_dir path/to/debug_output \
42+
--save_debug_data
43+
44+
45+
## What it does
46+
47+
1. Runs the given Cairo program with cairo-vm.
48+
2. Calls `stwo_cairo_adapter::adapter::adapt(&cairo_runner)` to produce `ProverInput`.
49+
3. Proves the program, and optionally verifies it.
50+
4. Saves the proof, and optionally the program's output and the debug data, to the given paths.
51+
52+
53+
## Outputs
54+
55+
- Proof (`--proof_path`): Stwo proof file in the specified format.
56+
- Program output (`--program_output`): JSON array of program output felts (if specified).
57+
- Debug data: ProverInput JSON saved to `debug_data_dir` (when `--save_debug_data` is enabled or on proving failure).

crates/stwo_run_and_prove/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct Args {
5353
verify: bool,
5454
#[clap(
5555
long = "program_output",
56-
help = "Optional absolute path for the program output."
56+
help = "Optional absolute path where the program's output will be saved."
5757
)]
5858
program_output: Option<PathBuf>,
5959
#[clap(

0 commit comments

Comments
 (0)