Skip to content

Commit

Permalink
docs: use v2 / v3 (#1490)
Browse files Browse the repository at this point in the history
Co-authored-by: mattstam <[email protected]>
  • Loading branch information
ctian1 and mattstam authored Sep 13, 2024
1 parent 6f67afd commit 2480345
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 38 deletions.
23 changes: 12 additions & 11 deletions book/developers/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This is likely due to two different versions of `alloy_sol_types` being used. To

```toml
[dependencies]
sp1-sdk = { version = "1.1.0", default-features = false }
sp1-sdk = { version = "2.0.0", default-features = false }
```

This will configure out the `network` feature which will remove the dependency on `alloy_sol_types` and configure out the `NetworkProver`.
Expand Down Expand Up @@ -100,22 +100,23 @@ C++ toolchain be setting this variable manually:
export CC_riscv32im_succinct_zkvm_elf=/path/to/toolchain
```

## Compilation Errors with [`sp1-lib::syscall_verify_sp1_proof`](https://docs.rs/sp1-lib/latest/sp1_lib/fn.syscall_verify_sp1_proof.html)
## Compilation Errors with [`sp1-lib::syscall_verify_sp1_proof`](https://docs.rs/sp1-lib/latest/sp1_lib/fn.syscall_verify_sp1_proof.html)

If you are using the [`sp1-lib::syscall_verify_sp1_proof`](https://docs.rs/sp1-lib/latest/sp1_lib/fn.syscall_verify_sp1_proof.html) function, you may encounter compilation errors when building your program.

```bash
[sp1] = note: rust-lld: error: undefined symbol: syscall_verify_sp1_proof
[sp1] >>> referenced by sp1_lib.b593533d149f0f6e-cgu.0
[sp1] >>> sp1_lib-8f5deb4c47d01871.sp1_lib.b593533d149f0f6e-cgu.0.rcgu.o:(sp1_lib::verify::verify_sp1_proof::h5c1bb38f11b3fe71) in ...
[sp1]
[sp1]
[sp1]
[sp1]
[sp1] error: could not compile `package-name` (bin "package-name") due to 1 previous error
```
```

To resolve this, ensure that you're importing both `sp1-lib` and `sp1-zkvm` with the verify feature enabled.

To resolve this, ensure that you're importing both `sp1-lib` and `sp1-zkvm` with the verify feature enabled.
```toml
[dependencies]
sp1-lib = { version = "<VERSION>", features = ["verify"] }
sp1-zkvm = { version = "<VERSION>", features = ["verify"] }
```
```toml
[dependencies]
sp1-lib = { version = "<VERSION>", features = ["verify"] }
sp1-zkvm = { version = "<VERSION>", features = ["verify"] }
```
2 changes: 1 addition & 1 deletion book/generating-proofs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUSTFLAGS='-C target-cpu=native' cargo run --release
Currently there is support for AVX512 and NEON SIMD instructions. For NEON, you must also enable the `sp1-sdk` feature `neon` in your script crate's `Cargo.toml` file.

```toml
sp1-sdk = { version = "1.1.0", features = ["neon"] }
sp1-sdk = { version = "2.0.0", features = ["neon"] }
```

## Performance
Expand Down
7 changes: 3 additions & 4 deletions book/generating-proofs/proof-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ There are a few different types of proofs that can be generated by the SP1 zkVM.

The `ProverClient` follows a "builder" pattern that allows you to configure the proof type and other options after creating a `ProverClient` and calling `prove` on it.

For a full list of options, see the following [docs](https://docs.rs/sp1-sdk/1.1.0/sp1_sdk/action/struct.Prove.html).
For a full list of options, see the following [docs](https://docs.rs/sp1-sdk/1.2.0/sp1_sdk/action/struct.Prove.html).

## Core (Default)

The default prover mode generates a list of STARK proofs that in aggregate have size proportional to
the size of the execution. Use this in settings where you don't care about **verification cost / proof size**.
the size of the execution. Use this in settings where you don't care about **verification cost / proof size**.

```rust,noplayground
let client = ProverClient::new();
Expand All @@ -19,7 +19,7 @@ client.prove(&pk, stdin).run().unwrap();
## Compressed

The compressed prover mode generates STARK proofs that have constant size. Use this in settings where you
care about **verification cost / proof size**. This is useful for applications where you want to recursively verify SP1 proofs within SP1 (see the [proof aggregation](../writing-programs/proof-aggregation.md) section).
care about **verification cost / proof size**. This is useful for applications where you want to recursively verify SP1 proofs within SP1 (see the [proof aggregation](../writing-programs/proof-aggregation.md) section).

```rust,noplayground
let client = ProverClient::new();
Expand All @@ -32,7 +32,6 @@ client.prove(&pk, stdin).compressed().run().unwrap();
WARNING: The PLONK prover requires around 64GB of RAM and is only guaranteed to work on official releases of SP1. We recommend using the prover network to generate PLONK proofs.
</div>


The PLONK prover mode generates a SNARK proof with extremely small proof size and low verification cost.
This mode is necessary for generating proofs that can be verified onchain for around ~300k gas.

Expand Down
5 changes: 3 additions & 2 deletions book/generating-proofs/prover-network.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Prover Network Beta

> **Currently, the supported version of SP1 on the prover network is `v1.1.0`.**
> **Currently, the supported version of SP1 on the prover network is `v2.0.0`.**
Succinct [has been building](https://blog.succinct.xyz/succinct-network/) the Succinct Prover Network, a distributed network of provers that can generate proofs of any size quickly and reliably. It's currently in private beta, but you can get access by following the steps below.

To get started, **[FILL OUT THIS FORM](https://forms.gle/rTUvhstS8PFfv9B3A)** to gain access to the Succinct
Network. Completing this form requires you to complete the [key setup](./prover-network/key-setup.md) steps below.
Network. Completing this form requires you to complete the [key
setup](./prover-network/key-setup.md) steps below.
2 changes: 1 addition & 1 deletion book/generating-proofs/prover-network/usage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prover Network: Usage

> **Currently, the supported version of SP1 on the prover network is `v1.1.0`.**
> **See [Supported Versions](../versions.md) for the currently supported versions of SP1 on the Prover Network.**
## Sending a proof request

Expand Down
15 changes: 8 additions & 7 deletions book/generating-proofs/prover-network/versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@

The prover network currently only supports specific versions of SP1:

| Environment | RPC URL | Supported Version |
| ----------- | -------------------------- | ----------------- |
| Production | `https://rpc.succinct.xyz` | `v1.2.X` |
| Version | Description |
| ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| v2.X.X | Audited, production ready version. |
| v3.X.X | Pre-release version with enhanced performance, currently being audited. **Recommended for benchmarking or testing, not recommended for production use.** |

Where `X` denotes that any patch version is supported (e.g. `v1.2.0`, `v1.2.1`).
`X` denotes that any minor and patch version is supported (e.g. `v2.1.0`, `v2.1.1`).

If you submit a proof request to the prover network and your are not using the supported version, you will receive an error message.
If you submit a proof request to the prover network and you are not using a supported version, you will receive an error message.

## Changing versions

You must switch to a supported version before submitting a proof. To do so, replace the `sp1-zkvm` version in your progam's `Cargo.toml`:

```toml
[dependencies]
sp1-zkvm = "1.1.0"
sp1-zkvm = "2.0.0"
```

replace the `sp1-sdk` version in your script's `Cargo.toml`:

```toml
[dependencies]
sp1-sdk = "1.1.0"
sp1-sdk = "2.0.0"
```

Re-build your program and script, and then try again.
2 changes: 1 addition & 1 deletion book/generating-proofs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ name = "script"
edition = "2021"
[dependencies]
sp1-sdk = "1.1.0"
sp1-sdk = "2.0.0"
```

The `sp1-sdk` crate includes the necessary utilities to generate, save, and verify proofs.
2 changes: 1 addition & 1 deletion book/onchain-verification/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ You can run the above script with `RUST_LOG=info cargo run --bin plonk_bn254 --r
If you would like to run the PLONK prover directly without Docker, you must have Go 1.22 installed and enable the `native-plonk` feature in `sp1-sdk`. This path is not recommended and may require additional native dependencies.

```toml
sp1-sdk = { version = "1.1.0", features = ["native-plonk"] }
sp1-sdk = { version = "2.0.0", features = ["native-plonk"] }
```
10 changes: 4 additions & 6 deletions book/writing-programs/compiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Under the hood, this CLI command calls `cargo build` with the `riscv32im-succinc

You can pass additional arguments to the `cargo prove build` command to customize the build process, like configuring what features are enabled, customizing the output directory and more. To see all available options, run `cargo prove build --help`. Many of these options mirror the options available in the `cargo build` command.


## Production Builds

For production builds of programs, you can build your program inside a Docker container which will generate a **reproducible ELF** on all platforms. To do so, just use the `--docker` flag and optionally the `--tag` flag with the release version you want to use (defaults to `latest`). For example:
Expand Down Expand Up @@ -62,24 +61,23 @@ The path passed in to `build_program` should point to the directory containing t

```toml
[build-dependencies]
sp1-build = "1.2.0"
sp1-build = "2.0.0"
```

You will see output like the following from the build script if the program has changed, indicating that the program was rebuilt:

````
```
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/src
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/Cargo.toml
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/Cargo.lock
[fibonacci-script 0.1.0] cargo:warning=fibonacci-program built at 2024-03-02 22:01:26
[fibonacci-script 0.1.0] [sp1] Compiling fibonacci-program v0.1.0 (/Users/umaroy/Documents/fibonacci/program)
[fibonacci-script 0.1.0] [sp1] Finished release [optimized] target(s) in 0.15s
warning: [email protected]: fibonacci-program built at 2024-03-02 22:01:26
````
```

The above output was generated by running `RUST_LOG=info cargo run --release -vv` for the `script` folder of the Fibonacci example.


### Advanced Build Options

To configure the build process when using the `sp1-build` crate, you can pass a [`BuildArgs`](https://docs.rs/sp1-build/1.2.0/sp1_build/struct.BuildArgs.html) struct to to the [`build_program_with_args`](https://docs.rs/sp1-build/1.2.0/sp1_build/fn.build_program_with_args.html) function. The build arguments are the same as the ones available from the `cargo prove build` command.
Expand All @@ -99,4 +97,4 @@ fn main() {
}
```

**Note:** If you want reproducible builds with the `build.rs` approach, you should use the `docker` flag and the `build_program_with_args` function, as shown in the example above.
**Note:** If you want reproducible builds with the `build.rs` approach, you should use the `docker` flag and the `build_program_with_args` function, as shown in the example above.
6 changes: 3 additions & 3 deletions book/writing-programs/cycle-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note that to use the macro, you must add the `sp1-derive` crate to your dependen

```toml
[dependencies]
sp1-derive = "1.1.0"
sp1-derive = "2.0.0"
```

In the script for proof generation, setup the logger with `utils::setup_logger()` and run the script with `RUST_LOG=info cargo run --release`. You should see the following output:
Expand Down Expand Up @@ -43,6 +43,7 @@ stdout: result: 2940
Note that we elegantly handle nested cycle tracking, as you can see above.

### Get Tracked Cycle Counts

To include tracked cycle counts in the `ExecutionReport` when using `ProverClient::execute`, use the following annotations:

```rust,noplayground
Expand All @@ -65,8 +66,7 @@ First, we need to generate a trace file of the program counter at each cycle whi
TRACE_FILE=trace.log RUST_LOG=info cargo run --release
```

When the `TRACE_FILE` environment variable is set, as SP1's RISC-V runtime is executing, it will write a log of the program counter to the file specified by `TRACE_FILE`.

When the `TRACE_FILE` environment variable is set, as SP1's RISC-V runtime is executing, it will write a log of the program counter to the file specified by `TRACE_FILE`.

Next, we can use the `cargo prove` CLI with the `trace` command to analyze the trace file and generate a table of instruction counts. This can be done with the following command:

Expand Down
2 changes: 1 addition & 1 deletion book/writing-programs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ name = "program"
edition = "2021"
[dependencies]
sp1-zkvm = "1.1.0"
sp1-zkvm = "2.0.0"
```

The `sp1-zkvm` crate includes necessary utilities for your program, including handling inputs and outputs,
Expand Down

0 comments on commit 2480345

Please sign in to comment.