Skip to content

Commit 8860fdb

Browse files
authored
Update doc to add 'cargo-zisk rom-setup' command (#311)
* Update doc: added rom-setup command * Fix rom-setup command flags
1 parent e5d2268 commit 8860fdb

File tree

3 files changed

+42
-11
lines changed

3 files changed

+42
-11
lines changed

book/getting_started/installation.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ You can use the flags `--provingkey`, `--verifykey` or `--nokey` to specify the
125125
2. Build and install the Rust ZisK toolchain:
126126
```bash
127127
cargo-zisk sdk build-toolchain
128-
ZISK_TOOLCHAIN_SOURCE_DIR=. cargo-zisk sdk install-toolchain
129128
```
130129

131130
6. Verify the installation:
@@ -204,8 +203,13 @@ Please note that the process can be long, taking approximately 2–3 hours depen
204203
```
205204
206205
## Uninstall Zisk
207-
To uninstall ZisK, run:
208206
209-
```bash
210-
rm -rf $HOME/.zisk
211-
```
207+
1. Uninstall ZisK toolchain:
208+
```bash
209+
rustup uninstall zisk
210+
```
211+
212+
2. Delete ZisK folder
213+
```bash
214+
rm -rf $HOME/.zisk
215+
```

book/getting_started/quickstart.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Ubuntu 22.04 or higher is required.
1010

1111
> **Note:** macOS is not yet supported, but we are actively working on adding support.
1212
13-
1. Make sure you have [Rust](https://www.rust-lang.org/tools/install) installed.
1413
1. Make sure you have [Rust](https://www.rust-lang.org/tools/install) installed.
1514

1615
2. Install all required dependencies with:
@@ -101,15 +100,21 @@ cargo-zisk run --release -i build/input.bin
101100

102101
## Prove
103102

104-
You can generate and verify a proof using the `cargo-zisk prove` command by providing the ELF file (with the `-e` or `--elf` flag) and the input file (with the `-i` or `--input-data` flag).
103+
Before generating a proof, you need to generate the program setup files. Execute:
104+
105+
```bash
106+
cargo-zisk rom-setup -e target/riscv64ima-polygon-ziskos-elf/release/sha_hasher
107+
```
108+
109+
Once the program setup is complete, you can generate and verify a proof using the `cargo-zisk prove` command by providing the ELF file (with the `-e` or `--elf` flag) and the input file (with the `-i` or `--input` flag).
105110

106111
To generate and verify a proof for the previously built ELF and input files, execute:
107112

108113
```bash
109114
cargo-zisk prove -e target/riscv64ima-polygon-ziskos-elf/release/sha_hasher -i build/input.bin -o proof -a -y
110115
```
111116

112-
This command generates the proof in the `./proof directory`. If everything goes well, you will see a message similar to:
117+
This command generates the proof in the `./proof` directory. If everything goes well, you will see a message similar to:
113118

114119
```
115120
...

book/getting_started/writing_programs.md

+25-3
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,33 @@ bd13089b
224224

225225
## Prove
226226

227+
### Program Setup
228+
229+
Before generating a proof (or verifying the constraints), you need to generate the program setup files. This must be done the first time after building the program ELF file, or any time it changes:
230+
231+
```bash
232+
cargo-zisk rom-setup -e target/riscv64ima-polygon-ziskos-elf/release/sha_hasher -k $HOME/.zisk/provingKey
233+
```
234+
In this command:
235+
236+
* `-e` (`--elf`) specifies the ELF file localtion.
237+
* `-k` (`--proving-key`) specifies the directory containing the proving key. This is optional and defaults to `$HOME/.zisk/provingKey`.
238+
239+
The program setup files will be generated in the `cache` directory located at `$HOME/.zisk`
240+
227241
### Verify Constraints
228-
Before to generate a proof (that can take some time) you can verify that all the constraints are satisfied:
242+
243+
Before generating a proof (which can take some time), you can verify that all constraints are satisfied:
229244

230245
```bash
231246
cargo-zisk verify-constraints -e target/riscv64ima-polygon-ziskos-elf/release/sha_hasher -i build/input.bin -w $HOME/.zisk/bin/libzisk_witness.so -k $HOME/.zisk/provingKey
232247
```
248+
In this command:
249+
250+
* `-e` (`--elf`) specifies the ELF file localtion.
251+
* `-i` (`--input`) specifies the input file location.
252+
* `-w` (`--witness`) specifies the location of the witness library. This is optional and defaults to `$HOME/.zisk/bin/libzisk_witness.so`.
253+
* `-k` (`--proving-key`) specifies the directory containing the proving key. This is optional and defaults to `$HOME/.zisk/provingKey`.
233254

234255
If everything is correct, you will see an output similar to:
235256

@@ -249,8 +270,9 @@ cargo-zisk prove -e target/riscv64ima-polygon-ziskos-elf/release/sha_hasher -i b
249270
In this command:
250271

251272
* `-e` (`--elf`) specifies the ELF file localtion.
252-
* `-i` (`--inputs`) specifies the input file location.
253-
* `-w` (`--witness`) and `-k` (`--proving-key`) are used to specify the location of the witness library and proving key files required for proof generation; they are optional, set by default to the paths found in the `$HOME/.zisk` installation folder.
273+
* `-i` (`--input`) specifies the input file location.
274+
* `-w` (`--witness`) specifies the location of the witness library. This is optional and defaults to `$HOME/.zisk/bin/libzisk_witness.so`.
275+
* `-k` (`--proving-key`) specifies the directory containing the proving key. This is optional and defaults to `$HOME/.zisk/provingKey`.
254276
* `-o` (`--output`) determines the output directory (in this example `proof`).
255277
* `-a` (`--aggregation`) indicates that a final aggregated proof (containing all generated sub-proofs) should be produced.
256278
* `-y` (`--verify-proofs`) instructs the tool to verify the proof immediately after it is generated (verification can also be performed later using the `cargo-zisk verify` command).

0 commit comments

Comments
 (0)