diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a0c1437034..72abf946de 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -167,48 +167,3 @@ jobs: cargo remove sp1-sdk cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk SP1_DEV=1 RUST_LOG=info cargo run --release - - rsp-low-memory: - name: Example (RSP Low Memory) - strategy: - matrix: - mem_limit: [16, 32, 64] - runs-on: - [ - runs-on, - "ram=${{ matrix.mem_limit}}", - family=c7a, - image=ubuntu22-full-x64, - spot=false, - "run-id=${{ github.run_id }}", - ] - env: - CARGO_NET_GIT_FETCH_WITH_CLI: "true" - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Setup CI - uses: ./.github/actions/setup - - - name: Install SP1 toolchain - run: | - curl -L https://sp1.succinct.xyz | bash - ~/.sp1/bin/sp1up - ~/.sp1/bin/cargo-prove prove --version - - - name: Install SP1 CLI - run: | - cd crates/cli - cargo install --force --locked --path . - cd ~ - - - name: Run script - run: | - cd examples/rsp/program - cargo add sp1-zkvm --path $GITHUB_WORKSPACE/crates/zkvm/entrypoint - cargo prove build - cd ../script - cargo remove sp1-sdk - cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk - SP1_DEV=1 RUST_LOG=info cargo run --release \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index cb89f7b9ee..8630a06b18 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -269,3 +269,47 @@ jobs: --branch-name "${{ github.head_ref || github.ref_name }}" \ --commit-hash "${{ github.sha }}" \ --author "${{ github.event.pull_request.user.login || github.actor }}" + + low-memory: + name: Low Memory + strategy: + matrix: + mem_limit: [16, 32, 64] + runs-on: + [ + runs-on, + "ram=${{ matrix.mem_limit}}", + family=c7a, + image=ubuntu22-full-x64, + "run-id=${{ github.run_id }}", + ] + env: + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Setup CI + uses: ./.github/actions/setup + + - name: Install SP1 toolchain + run: | + curl -L https://sp1.succinct.xyz | bash + ~/.sp1/bin/sp1up + ~/.sp1/bin/cargo-prove prove --version + + - name: Install SP1 CLI + run: | + cd crates/cli + cargo install --force --locked --path . + cd ~ + + - name: Run tendermint script + run: | + cd examples/tendermint/program + cargo add sp1-zkvm --path $GITHUB_WORKSPACE/crates/zkvm/entrypoint + cargo prove build + cd ../script + cargo remove sp1-sdk + cargo add sp1-sdk --path $GITHUB_WORKSPACE/crates/sdk + SP1_DEV=1 RUST_LOG=info cargo run --release \ No newline at end of file diff --git a/.gitignore b/.gitignore index c50ea62a6e..2b4a7389e1 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,6 @@ benchmark.csv # Build Artifacts recursion/gnark-ffi/build -prover/build -prover/*.tar.gz \ No newline at end of file +crates/prover/build +crates/prover/data +crates/prover/*.tar.gz \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 77521540bc..8b22f9ad54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1937,6 +1937,27 @@ dependencies = [ "zeroize", ] +[[package]] +name = "enum-map" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" +dependencies = [ + "enum-map-derive", + "serde", +] + +[[package]] +name = "enum-map-derive" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -5913,7 +5934,7 @@ dependencies = [ [[package]] name = "sp1-build" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "cargo_metadata", @@ -5924,7 +5945,7 @@ dependencies = [ [[package]] name = "sp1-cli" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anstyle", "anyhow", @@ -5959,11 +5980,12 @@ dependencies = [ [[package]] name = "sp1-core-executor" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "bytemuck", "elf", + "enum-map", "eyre", "generic-array 1.1.0", "hashbrown 0.14.5", @@ -5990,11 +6012,12 @@ dependencies = [ "tiny-keccak", "tracing", "typenum", + "vec_map", ] [[package]] name = "sp1-core-machine" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "arrayref", @@ -6061,7 +6084,7 @@ dependencies = [ [[package]] name = "sp1-cuda" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "ctrlc", @@ -6082,7 +6105,7 @@ dependencies = [ [[package]] name = "sp1-curves" -version = "1.2.0" +version = "2.0.0" dependencies = [ "curve25519-dalek", "dashu", @@ -6102,7 +6125,7 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "1.2.0" +version = "2.0.0" dependencies = [ "proc-macro2", "quote", @@ -6111,7 +6134,7 @@ dependencies = [ [[package]] name = "sp1-eval" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "bincode", @@ -6131,14 +6154,14 @@ dependencies = [ [[package]] name = "sp1-helper" -version = "1.2.0" +version = "2.0.0" dependencies = [ "sp1-build", ] [[package]] name = "sp1-lib" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "bincode", @@ -6150,7 +6173,7 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "1.2.0" +version = "2.0.0" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -6162,7 +6185,7 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "bincode", @@ -6200,7 +6223,7 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "ff 0.13.0", @@ -6232,7 +6255,7 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit-v2" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "ff 0.13.0", @@ -6271,7 +6294,7 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "1.2.0" +version = "2.0.0" dependencies = [ "backtrace", "criterion", @@ -6304,7 +6327,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "1.2.0" +version = "2.0.0" dependencies = [ "arrayref", "backtrace", @@ -6341,7 +6364,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core-v2" -version = "1.2.0" +version = "2.0.0" dependencies = [ "arrayref", "backtrace", @@ -6381,7 +6404,7 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "1.2.0" +version = "2.0.0" dependencies = [ "proc-macro2", "quote", @@ -6390,7 +6413,7 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-cli" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "clap", @@ -6399,7 +6422,7 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "1.2.0" +version = "2.0.0" dependencies = [ "anyhow", "bincode", @@ -6424,7 +6447,7 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "1.2.0" +version = "2.0.0" dependencies = [ "itertools 0.13.0", "p3-air", @@ -6454,7 +6477,7 @@ dependencies = [ [[package]] name = "sp1-sdk" -version = "1.2.0" +version = "2.0.0" dependencies = [ "alloy-sol-types", "anyhow", @@ -6469,6 +6492,7 @@ dependencies = [ "hashbrown 0.14.5", "hex", "indicatif", + "itertools 0.13.0", "log", "num-bigint 0.4.6", "p3-baby-bear", @@ -6500,7 +6524,7 @@ dependencies = [ [[package]] name = "sp1-stark" -version = "1.2.0" +version = "2.0.0" dependencies = [ "arrayref", "getrandom 0.2.15", @@ -6525,12 +6549,13 @@ dependencies = [ "sp1-derive", "sp1-primitives", "sp1-zkvm", + "sysinfo", "tracing", ] [[package]] name = "sp1-zkvm" -version = "1.2.0" +version = "2.0.0" dependencies = [ "bincode", "cfg-if", @@ -7447,6 +7472,9 @@ name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +dependencies = [ + "serde", +] [[package]] name = "vergen" diff --git a/Cargo.toml b/Cargo.toml index 07d4d800f4..3d0fd3a064 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.2.0" +version = "2.0.0" edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/succinctlabs/sp1" @@ -48,28 +48,28 @@ debug-assertions = true [workspace.dependencies] # sp1 -sp1-build = { path = "crates/build", version = "1.2.0" } -sp1-cli = { path = "crates/cli", version = "1.2.0", default-features = false } -sp1-core-machine = { path = "crates/core/machine", version = "1.2.0" } -sp1-core-executor = { path = "crates/core/executor", version = "1.2.0" } -sp1-curves = { path = "crates/curves", version = "1.2.0" } -sp1-derive = { path = "crates/derive", version = "1.2.0" } -sp1-eval = { path = "crates/eval", version = "1.2.0" } -sp1-helper = { path = "crates/helper", version = "1.2.0", default-features = false } -sp1-primitives = { path = "crates/primitives", version = "1.2.0" } -sp1-prover = { path = "crates/prover", version = "1.2.0" } -sp1-recursion-compiler = { path = "crates/recursion/compiler", version = "1.2.0" } -sp1-recursion-core = { path = "crates/recursion/core", version = "1.2.0", default-features = false } -sp1-recursion-core-v2 = { path = "crates/recursion/core-v2", version = "1.2.0", default-features = false } -sp1-recursion-derive = { path = "crates/recursion/derive", version = "1.2.0", default-features = false } -sp1-recursion-gnark-ffi = { path = "crates/recursion/gnark-ffi", version = "1.2.0", default-features = false } -sp1-recursion-program = { path = "crates/recursion/program", version = "1.2.0", default-features = false } -sp1-recursion-circuit = { path = "crates/recursion/circuit", version = "1.2.0", default-features = false } -sp1-sdk = { path = "crates/sdk", version = "1.2.0" } -sp1-cuda = { path = "crates/cuda", version = "1.2.0" } -sp1-stark = { path = "crates/stark", version = "1.2.0" } -sp1-lib = { path = "crates/zkvm/lib", version = "1.2.0", default-features = false } -sp1-zkvm = { path = "crates/zkvm/entrypoint", version = "1.2.0", default-features = false } +sp1-build = { path = "crates/build", version = "2.0.0" } +sp1-cli = { path = "crates/cli", version = "2.0.0", default-features = false } +sp1-core-machine = { path = "crates/core/machine", version = "2.0.0" } +sp1-core-executor = { path = "crates/core/executor", version = "2.0.0" } +sp1-curves = { path = "crates/curves", version = "2.0.0" } +sp1-derive = { path = "crates/derive", version = "2.0.0" } +sp1-eval = { path = "crates/eval", version = "2.0.0" } +sp1-helper = { path = "crates/helper", version = "2.0.0", default-features = false } +sp1-primitives = { path = "crates/primitives", version = "2.0.0" } +sp1-prover = { path = "crates/prover", version = "2.0.0" } +sp1-recursion-compiler = { path = "crates/recursion/compiler", version = "2.0.0" } +sp1-recursion-core = { path = "crates/recursion/core", version = "2.0.0", default-features = false } +sp1-recursion-core-v2 = { path = "crates/recursion/core-v2", version = "2.0.0", default-features = false } +sp1-recursion-derive = { path = "crates/recursion/derive", version = "2.0.0", default-features = false } +sp1-recursion-gnark-ffi = { path = "crates/recursion/gnark-ffi", version = "2.0.0", default-features = false } +sp1-recursion-program = { path = "crates/recursion/program", version = "2.0.0", default-features = false } +sp1-recursion-circuit = { path = "crates/recursion/circuit", version = "2.0.0", default-features = false } +sp1-sdk = { path = "crates/sdk", version = "2.0.0" } +sp1-cuda = { path = "crates/cuda", version = "2.0.0" } +sp1-stark = { path = "crates/stark", version = "2.0.0" } +sp1-lib = { path = "crates/zkvm/lib", version = "2.0.0", default-features = false } +sp1-zkvm = { path = "crates/zkvm/entrypoint", version = "2.0.0", default-features = false } # p3 p3-air = "0.1.3-succinct" diff --git a/book/SUMMARY.md b/book/SUMMARY.md index 553a35a415..53f0c71efe 100644 --- a/book/SUMMARY.md +++ b/book/SUMMARY.md @@ -34,7 +34,6 @@ - [Proof Aggregation](./writing-programs/proof-aggregation.md) - # Generating Proofs - [Setup](./generating-proofs/setup.md) @@ -46,13 +45,15 @@ - [Recommended Workflow](./generating-proofs/recommended-workflow.md) - [Prover Network Beta](./generating-proofs/prover-network.md) - - [Key Setup](./generating-proofs/prover-network/key-setup.md) - - [Usage](./generating-proofs/prover-network/usage.md) - - [Supported Versions](./generating-proofs/prover-network/versions.md) + + - [Key Setup](./generating-proofs/prover-network/key-setup.md) + - [Usage](./generating-proofs/prover-network/usage.md) + - [Supported Versions](./generating-proofs/prover-network/versions.md) - [Hardware Acceleration](./generating-proofs/hardware-acceleration.md) - - [AVX](./generating-proofs/hardware-acceleration/avx.md) - - [CUDA](./generating-proofs/hardware-acceleration/cuda.md) + + - [AVX](./generating-proofs/hardware-acceleration/avx.md) + - [CUDA](./generating-proofs/hardware-acceleration/cuda.md) - [FAQ](./generating-proofs/sp1-sdk-faq.md) @@ -64,7 +65,6 @@ - [Contract Addresses](./onchain-verification/contract-addresses.md) - # Developers - [Common Issues](./developers/common-issues.md) @@ -73,6 +73,4 @@ - [RV32IM Specification](./developers/rv32im-specification.md) -- [Building PLONK Artifacts](./developers/building-plonk-artifacts.md) - - +- [Building Circuit Artifacts](./developers/building-circuit-artifacts.md) diff --git a/book/developers/building-plonk-artifacts.md b/book/developers/building-circuit-artifacts.md similarity index 72% rename from book/developers/building-plonk-artifacts.md rename to book/developers/building-circuit-artifacts.md index 8f7eb5ad16..9e936d3ff3 100644 --- a/book/developers/building-plonk-artifacts.md +++ b/book/developers/building-circuit-artifacts.md @@ -1,6 +1,6 @@ # Building Circuit Artifacts -To build the production PLONK and Groth16 Bn254 artifacts from scratch, you can use the `Makefile` inside the `prover` directory. +To build the production Groth16 and PLONK Bn254 artifacts from scratch, you can use the `Makefile` inside the `prover` directory. ```shell,noplayground cd prover diff --git a/book/developers/common-issues.md b/book/developers/common-issues.md index 06556b82dd..f26f3ba0ae 100644 --- a/book/developers/common-issues.md +++ b/book/developers/common-issues.md @@ -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`. @@ -100,7 +100,7 @@ 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. @@ -108,14 +108,15 @@ If you are using the [`sp1-lib::syscall_verify_sp1_proof`](https://docs.rs/sp1-l [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 = "", features = ["verify"] } - sp1-zkvm = { version = "", features = ["verify"] } - ``` \ No newline at end of file +```toml +[dependencies] +sp1-lib = { version = "", features = ["verify"] } +sp1-zkvm = { version = "", features = ["verify"] } +``` diff --git a/book/generating-proofs/advanced.md b/book/generating-proofs/advanced.md index 2d17439012..4b1f30c544 100644 --- a/book/generating-proofs/advanced.md +++ b/book/generating-proofs/advanced.md @@ -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 diff --git a/book/generating-proofs/basics.md b/book/generating-proofs/basics.md index 06a3383ff0..faeb0cbfec 100644 --- a/book/generating-proofs/basics.md +++ b/book/generating-proofs/basics.md @@ -10,10 +10,10 @@ To make this more concrete, let's walk through a simple example of generating a {{#include ../../examples/fibonacci/script/src/main.rs}} ``` -You can run the above script in the `script` directory with `RUST_LOG=info cargo run --release`. Note that running the above script will generate a proof locally. +You can run the above script in the `script` directory with `RUST_LOG=info cargo run --release`. Note that running the above script will generate a proof locally.
-WARNING: Local proving often is much slower than the prover network and for certain proof types (e.g. PLONK) requires a significant amount of RAM and will likely not work on a laptop. +WARNING: Local proving often is much slower than the prover network and for certain proof types (e.g. Groth16, PLONK) require a significant amount of RAM and will likely not work on a laptop.
-We recommend using the [prover network](./prover-network.md) to generate proofs. Read more about the [recommended workflow](./recommended-workflow.md) for developing with SP1. \ No newline at end of file +We recommend using the [prover network](./prover-network.md) to generate proofs. Read more about the [recommended workflow](./recommended-workflow.md) for developing with SP1. diff --git a/book/generating-proofs/proof-types.md b/book/generating-proofs/proof-types.md index 70513f8faa..d6542d73bc 100644 --- a/book/generating-proofs/proof-types.md +++ b/book/generating-proofs/proof-types.md @@ -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(); @@ -19,22 +19,39 @@ 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(); client.prove(&pk, stdin).compressed().run().unwrap(); ``` -## PLONK +## Groth16 (testnet only) + +
+WARNING: Groth16 proofs are currently only verifiable on testnets & are not production-ready +
-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. +WARNING: The Groth16 prover requires around 64GB of RAM and are only guaranteed to work on official releases of SP1. We recommend using the prover network to generate these proofs.
+The Groth16 prover mode generate a SNARK proof with extremely small proof size and low verification cost. +This mode generates proofs that can be verified onchain for around ~270k gas. + +```rust,noplayground +let client = ProverClient::new(); +client.prove(&pk, stdin).groth16().run().unwrap(); +``` + +## PLONK + +
+WARNING: The PLONK prover requires around 64GB of RAM and are only guaranteed to work on official releases of SP1. We recommend using the prover network to generate these proofs. +
-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. +The Groth16 and PLONK prover modes generate a SNARK proof with extremely small proof size and low verification cost. +This mode generates proofs that can be verified onchain for around ~300k gas. ```rust,noplayground let client = ProverClient::new(); diff --git a/book/generating-proofs/prover-network.md b/book/generating-proofs/prover-network.md index 593a9f41aa..f5b61d2204 100644 --- a/book/generating-proofs/prover-network.md +++ b/book/generating-proofs/prover-network.md @@ -1,8 +1,9 @@ # Prover Network Beta -> **Currently, the supported version of SP1 on the prover network is `v1.1.0`.** +> **See [Supported Versions](./prover-network/versions.md) for the currently supported versions of SP1 on the Prover Network.** 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. \ No newline at end of file +Network. Completing this form requires you to complete the [key +setup](./prover-network/key-setup.md) steps below. diff --git a/book/generating-proofs/prover-network/usage.md b/book/generating-proofs/prover-network/usage.md index c334228d4c..6d1ce02fe3 100644 --- a/book/generating-proofs/prover-network/usage.md +++ b/book/generating-proofs/prover-network/usage.md @@ -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 diff --git a/book/generating-proofs/prover-network/versions.md b/book/generating-proofs/prover-network/versions.md index 633fbe6e24..271a09078b 100644 --- a/book/generating-proofs/prover-network/versions.md +++ b/book/generating-proofs/prover-network/versions.md @@ -2,13 +2,14 @@ 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 @@ -16,14 +17,14 @@ You must switch to a supported version before submitting a proof. To do so, repl ```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. diff --git a/book/generating-proofs/recommended-workflow.md b/book/generating-proofs/recommended-workflow.md index 1f2af07972..9f9acfa034 100644 --- a/book/generating-proofs/recommended-workflow.md +++ b/book/generating-proofs/recommended-workflow.md @@ -2,7 +2,7 @@ We recommend the following workflow for developing with SP1. -## Step 1: Iterate on your program with execution only +## Step 1: Iterate on your program with execution only While iterating on your SP1 program, you should **only execute** the program with the RISC-V runtime. This will allow you to verify the correctness of your program and test the `SP1Stdin` as well as the `SP1PublicValues` that are returned, without having to generate a proof (which can be slow and/or expensive). If the execution of your program succeeds, then proof generation should succeed as well! @@ -14,7 +14,7 @@ Note that printing out the total number of executed cycles and the full executio **Crate Setup:** We recommend that your program crate that defines the `main` function (around which you wrap the `sp1_zkvm::entrypoint!` macro) should be kept minimal. Most of your business logic should be in a separate crate (in the same repo/workspace) that can be tested independently and that is not tied to the SP1 zkVM. This will allow you to unit test your program logic without having to worry about the `zkvm` compilation target. This will also allow you to efficient reuse types between your program crate and your crate that generates proofs. -## Step 2: Generate proofs +## Step 2: Generate proofs After you have iterated on your program and finalized that it works correctly, you can generate proofs for your program for final end to end testing or production use. @@ -28,7 +28,7 @@ There are a few things to keep in mind when using the prover network. #### Benchmarking latency on the prover network -The prover network currently parallelizes proof generation across multiple machines. This means the latency of proof generation does not scale linearly with the number of cycles of your program, but rather with the number of cycles of your program divided by the number of currently available machines on the prover network. +The prover network currently parallelizes proof generation across multiple machines. This means the latency of proof generation does not scale linearly with the number of cycles of your program, but rather with the number of cycles of your program divided by the number of currently available machines on the prover network. Our prover network currently has limited capacity because it is still in beta. If you have an extremely latency sensitive use-case and you want to figure out the **minimal latency possible** for your program, you should [reach out to us](https://partner.succinct.xyz/) and we can onboard you to our reserved capacity cluster that has a dedicated instances that can significantly reduce latency. @@ -40,13 +40,13 @@ Note that **latency is not the same as cost**, because we parallelize proof gene #### Benchmarking on small vs. large programs -In SP1, there is a fixed overhead for proving that is independent of your program's cycle count. This means that benchmarking on *small programs* is not representative of the performance of larger programs. To get an idea of the scale of programs for real-world workloads, you can refer to our [benchmarking blog post](https://blog.succinct.xyz/sp1-production-benchmarks) and also some numbers below: +In SP1, there is a fixed overhead for proving that is independent of your program's cycle count. This means that benchmarking on _small programs_ is not representative of the performance of larger programs. To get an idea of the scale of programs for real-world workloads, you can refer to our [benchmarking blog post](https://blog.succinct.xyz/sp1-production-benchmarks) and also some numbers below: -* An average Ethereum block can be between 100-500M cycles (including merkle proof verification for storage and execution of transactions) with our `keccak` and `secp256k1` precompiles. -* For a Tendermint light client, the average cycle count can be between 10M and 50M cycles (including our ed25519 precompiles). -* We consider programs with <2M cycles to be "small" and by default, the fixed overhead of proving will dominate the proof latency. If latency is incredibly important for your use-case, we can specialize the prover network for your program if you reach out to us. +- An average Ethereum block can be between 100-500M cycles (including merkle proof verification for storage and execution of transactions) with our `keccak` and `secp256k1` precompiles. +- For a Tendermint light client, the average cycle count can be between 10M and 50M cycles (including our ed25519 precompiles). +- We consider programs with <2M cycles to be "small" and by default, the fixed overhead of proving will dominate the proof latency. If latency is incredibly important for your use-case, we can specialize the prover network for your program if you reach out to us. -Note that if you generate PLONK proofs on the prover network, you will encounter a fixed overhead of 90 seconds for the STARK -> SNARK wrapping step. We're actively working on reducing this overhead in our next release. +Note that if you generate Groth16 or PLONK proofs on the prover network, you will encounter a fixed overhead for the STARK -> SNARK wrapping step. We're actively working on reducing this overhead in future releases. #### On-Demand vs. Reserved Capacity @@ -54,4 +54,4 @@ The prover network is currently in beta and has limited capacity. For high volum ### Generating proofs locally -If you want to generate proofs locally, you can use the `sp1_sdk` crate to generate proofs locally as outlined in the [Basics](./basics.md) section. By default, the `ProverClient` will generate proofs locally using your CPU. Check out the hardware requirements for locally proving [here](../getting-started/hardware-requirements.md#local-proving). \ No newline at end of file +If you want to generate proofs locally, you can use the `sp1_sdk` crate to generate proofs locally as outlined in the [Basics](./basics.md) section. By default, the `ProverClient` will generate proofs locally using your CPU. Check out the hardware requirements for locally proving [here](../getting-started/hardware-requirements.md#local-proving). diff --git a/book/generating-proofs/setup.md b/book/generating-proofs/setup.md index 9a8561cea0..88db15fb8e 100644 --- a/book/generating-proofs/setup.md +++ b/book/generating-proofs/setup.md @@ -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. diff --git a/book/getting-started/hardware-requirements.md b/book/getting-started/hardware-requirements.md index b567f897ab..8e149fb023 100644 --- a/book/getting-started/hardware-requirements.md +++ b/book/getting-started/hardware-requirements.md @@ -4,6 +4,7 @@ We recommend that developers who want to use SP1 for non-trivial programs generate proofs on our prover network. The prover network generates SP1 proofs across multiple machines, reducing latency and also runs SP1 on optimized hardware instances that result in faster + cheaper proof generation times. We recommend that for any production benchmarking, you use the prover network to estimate latency and costs of proof generation. + ## Local Proving @@ -12,16 +13,16 @@ If you want to generate SP1 proofs locally, this section has an overview of the **The most important requirement is CPU for performance/latency and RAM to prevent running out of memory.** -| | Mock / Network | Core / Compress | PLONK (EVM) | -|----------------|------------------------------|------------------------------------|----------------------------| -| CPU | 1+, single-core perf matters | 16+, more is better | 32+, more is better | -| Memory | 8GB+, more is better | 32GB+, more if you have more cores | 64GB+ (for PLONK) | -| Disk | 20GB+ | 20GB+ | 100GB+ (for trusted setup) | -| EVM Compatible | ✅ | ❌ | ✅ | +| | Mock / Network | Core / Compress | Groth16 and PLONK (EVM) | +| -------------- | ---------------------------- | ---------------------------------- | ----------------------- | +| CPU | 1+, single-core perf matters | 16+, more is better | 32+, more is better | +| Memory | 8GB+, more is better | 32GB+, more if you have more cores | 64GB+, more is better | +| Disk | 20GB+ | 20GB+ | 12GB+ | +| EVM Compatible | ✅ | ❌ | ✅ | ### CPU -The execution & trace generation of the zkVM is mostly CPU bound, having a high single-core +The execution & trace generation of the zkVM is mostly CPU bound, having a high single-core performance is recommended to accelerate these steps. The rest of the prover is mostly bound by hashing/field operations which can be parallelized with multiple cores. @@ -30,13 +31,12 @@ which can be parallelized with multiple cores. Our prover requires keeping large matrices (i.e., traces) in memory to generate the proofs. Certain steps of the prover have a minimum memory requirement, meaning that if you have less than this amount of memory, the process will OOM. -This effect is most noticeable when using the PLONK prover, which requires around 128GB of RAM to generate a proof. We use PLONK to avoid -having to perform a trusted setup, which other SNARKs like Groth16 require. We have future optimizations planned to reduce -the memory requirements of the PLONK prover substantially. +This effect is most noticeable when using the Groth16 or PLONK provers, which requires around 128GB +of RAM to generate a proof. ### Disk -Disk is required to install the SP1 zkVM toolchain and to install the trused setup artifacts, if you plan to locally build the PLONK prover. - -Furthermore, disk is used to checkpoint the state of the program execution, which is required to generate the proofs. +Disk is required to install the SP1 zkVM toolchain and to install the circuit artifacts, if you +plan to locally build the Groth16 or PLONK provers. +Furthermore, disk is used to checkpoint the state of the program execution, which is required to generate the proofs. diff --git a/book/onchain-verification/contract-addresses.md b/book/onchain-verification/contract-addresses.md index 63a647277d..fe3aa5c9a7 100644 --- a/book/onchain-verification/contract-addresses.md +++ b/book/onchain-verification/contract-addresses.md @@ -1,20 +1,24 @@ # Contract Addresses -When using SP1, we recommend using our deployed verifiers. Each contract is a [SP1VerifierGateway](https://github.com/succinctlabs/sp1-contracts/blob/main/contracts/src/ISP1VerifierGateway.sol) which can automatically routes your SP1 proof to the correct verifier based on the prover version. - -| Chain ID | Chain | Gateway | -| -------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | -| 1 | Mainnet | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 11155111 | Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 17000 | Holesky | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://holesky.etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 42161 | Arbitrum One | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://arbiscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 421614 | Arbitrum Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.arbiscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 534351 | Scroll Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.scrollscan.com/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 534352 | Scroll | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://scrollscan.com/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 8453 | Base | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://basescan.org/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | -| 84532 | Base Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.basescan.org/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | - -**Currently officially supported version of SP1 is v1.1.0.** If you'd like official support for a verifier on a different chain, please ask in the [SP1 Telegram](https://t.me/+AzG4ws-kD24yMGYx). +To verify SP1 proofs on-chain, we recommend using our deployed verifier gateways. For the chains listed below, an [SP1VerifierGateway](https://github.com/succinctlabs/sp1-contracts/blob/main/contracts/src/ISP1VerifierGateway.sol) can automatically route your SP1 proof to the correct verifier based on the SP1 version. + +| Chain ID | Chain | Gateway | +| -------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Mainnet | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 11155111 | Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 17000 | Holesky | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://holesky.etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 42161 | Arbitrum One | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://arbiscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 421614 | Arbitrum Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.arbiscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 8453 | Base | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://basescan.org/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 84532 | Base Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.basescan.org/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 10 | Optimism | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://optimistic.etherscan.io/address/0x3b6041173b80e77f038f3f2c0f9744f04837185e) | +| 11155420 | Optimism Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](hhttps://sepolia-optimism.etherscan.io/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 534351 | Scroll Sepolia | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://sepolia.scrollscan.com/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | +| 534352 | Scroll | [0x3B6041173B80E77f038f3F2C0f9744f04837185e](https://scrollscan.com/address/0x3B6041173B80E77f038f3F2C0f9744f04837185e) | + +A complete reference for all of the SP1Verifier contract addresses can be also be found in the [SP1 Contracts Repo](https://github.com/succinctlabs/sp1-contracts/blob/main/contracts/deployments). + +Whenever a verifier for a new SP1 version is deployed, the gateway contract will be updated to support it with [addRoute()](https://github.com/succinctlabs/sp1-contracts/blob/main/contracts/src/ISP1VerifierGateway.sol#L65). If a verifier for an SP1 version has an issue, the route will be frozen with [freezeRoute()](https://github.com/succinctlabs/sp1-contracts/blob/main/contracts/src/ISP1VerifierGateway.sol#L71). ## ISP1Verifier Interface diff --git a/book/onchain-verification/getting-started.md b/book/onchain-verification/getting-started.md index 110553e7e8..93051b9da0 100644 --- a/book/onchain-verification/getting-started.md +++ b/book/onchain-verification/getting-started.md @@ -12,20 +12,22 @@ Refer to the section on [Contract Addresses](./contract-addresses.md) for the ad By default, the proofs generated by SP1 are not verifiable onchain, as they are non-constant size and STARK verification on Ethereum is very expensive. To generate a proof that can be verified onchain, we use performant STARK recursion to combine SP1 shard proofs into a single STARK proof and then wrap that in a SNARK proof. Our `ProverClient` has a prover option for this called `plonk`. Behind the scenes, this function will first generate a normal SP1 proof, then recursively combine all of them into a single proof using the STARK recursion protocol. Finally, the proof is wrapped in a SNARK proof using PLONK. -> WARNING: The PLONK prover is only guaranteed to work on official releases of SP1. To use PLONK proving & verification locally, ensure that you have Docker installed and have at least 128GB of RAM. +> WARNING: The Groth16 and PLONK provers are only guaranteed to work on official releases of SP1. To +> use Groth16 or PLONK proving & verification locally, ensure that you have Docker installed and have +> at least 128GB of RAM. ### Example ```rust,noplayground -{{#include ../../examples/fibonacci/script/bin/plonk_bn254.rs}} +{{#include ../../examples/fibonacci/script/bin/groth16_bn254.rs}} ``` -You can run the above script with `RUST_LOG=info cargo run --bin plonk_bn254 --release` in `examples/fibonacci/script`. +You can run the above script with `RUST_LOG=info cargo run --bin groth16_bn254 --release` in `examples/fibonacci/script`. -#### Using PLONK without Docker (Advanced) +#### Using Groth16 and PLONK without Docker (Advanced) -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. +If you would like to run the Groth16 or PLONK prover directly without Docker, you must have Go 1.22 installed and enable the `native-gnark` 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-gnark"] } ``` diff --git a/book/writing-programs/compiling.md b/book/writing-programs/compiling.md index 29a33cedd7..f1acd49b0d 100644 --- a/book/writing-programs/compiling.md +++ b/book/writing-programs/compiling.md @@ -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: @@ -62,12 +61,12 @@ 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 @@ -75,11 +74,10 @@ You will see output like the following from the build script if the program has [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: fibonacci-script@0.1.0: 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. @@ -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. \ No newline at end of file +**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. diff --git a/book/writing-programs/cycle-tracking.md b/book/writing-programs/cycle-tracking.md index 176249b45e..c560f28ae5 100644 --- a/book/writing-programs/cycle-tracking.md +++ b/book/writing-programs/cycle-tracking.md @@ -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: @@ -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 @@ -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: diff --git a/book/writing-programs/precompiles.md b/book/writing-programs/precompiles.md index f96be3e6ff..004ede9f1f 100644 --- a/book/writing-programs/precompiles.md +++ b/book/writing-programs/precompiles.md @@ -7,7 +7,7 @@ Inside the zkVM, precompiles are exposed as system calls executed through the `e Each precompile has a unique system call number and implements an interface for the computation. SP1 also has been designed specifically to make it easy for external contributors to create and extend the zkVM with their own precompiles. -To learn more about this, you can look at implementations of existing precompiles in the [precompiles](https://github.com/succinctlabs/sp1/tree/main/core/src/syscall/precompiles) folder. More documentation on this will be coming soon. +To learn more about this, you can look at implementations of existing precompiles in the [precompiles](https://github.com/succinctlabs/sp1/tree/main/crates/core/executor/src/events/precompiles) folder. More documentation on this will be coming soon. **To use precompiles, we typically recommend you interact with them through [patches](./patched-crates.md), which are crates modified to use these precompiles under the hood, without requiring you to call system calls directly.** @@ -19,5 +19,5 @@ If you are an advanced user you can interact with the precompiles directly using Here is a list of all available system calls & precompiles. ```rust,noplayground -{{#include ../../zkvm/lib/src/lib.rs}} -``` \ No newline at end of file +{{#include ../../crates/zkvm/lib/src/lib.rs}} +``` diff --git a/book/writing-programs/setup.md b/book/writing-programs/setup.md index 0346b3b7ad..aa3f4a2cca 100644 --- a/book/writing-programs/setup.md +++ b/book/writing-programs/setup.md @@ -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, diff --git a/crates/core/executor/Cargo.toml b/crates/core/executor/Cargo.toml index 4834fbcf6d..0e48407583 100644 --- a/crates/core/executor/Cargo.toml +++ b/crates/core/executor/Cargo.toml @@ -43,6 +43,8 @@ log = "0.4.22" hex = "0.4.3" bytemuck = "1.16.3" tiny-keccak = { version = "2.0.2", features = ["keccak"] } +vec_map = { version = "0.8.2", features = ["serde"] } +enum-map = { version = "2.7.3", features = ["serde"] } [dev-dependencies] sp1-zkvm = { workspace = true } diff --git a/crates/core/executor/src/executor.rs b/crates/core/executor/src/executor.rs index 10eaaae2c4..991ba3cb0c 100644 --- a/crates/core/executor/src/executor.rs +++ b/crates/core/executor/src/executor.rs @@ -4,8 +4,7 @@ use std::{ sync::Arc, }; -use hashbrown::{hash_map::Entry, HashMap}; -use nohash_hasher::BuildNoHashHasher; +use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use sp1_stark::SP1CoreOpts; use thiserror::Error; @@ -18,6 +17,7 @@ use crate::{ MemoryWriteRecord, }, hook::{HookEnv, HookRegistry}, + memory::{Entry, PagedMemory}, record::{ExecutionRecord, MemoryAccessRecord}, report::ExecutionReport, state::{ExecutionState, ForkState}, @@ -100,7 +100,7 @@ pub struct Executor<'a> { /// Memory addresses that were touched in this batch of shards. Used to minimize the size of /// checkpoints. - pub memory_checkpoint: HashMap, BuildNoHashHasher>, + pub memory_checkpoint: PagedMemory>, } /// The different modes the executor can run in. @@ -216,7 +216,7 @@ impl<'a> Executor<'a> { hook_registry, opts, max_cycles: context.max_cycles, - memory_checkpoint: HashMap::default(), + memory_checkpoint: PagedMemory::new_preallocated(), } } @@ -255,7 +255,7 @@ impl<'a> Executor<'a> { let mut registers = [0; 32]; for i in 0..32 { let addr = Register::from_u32(i as u32) as u32; - let record = self.state.memory.get(&addr); + let record = self.state.memory.get(addr); // Only add the previous memory state to checkpoint map if we're in checkpoint mode, // or if we're in unconstrained mode. In unconstrained mode, the mode is always @@ -283,7 +283,7 @@ impl<'a> Executor<'a> { #[must_use] pub fn register(&mut self, register: Register) -> u32 { let addr = register as u32; - let record = self.state.memory.get(&addr); + let record = self.state.memory.get(addr); if self.executor_mode == ExecutorMode::Checkpoint || self.unconstrained { match record { @@ -306,7 +306,7 @@ impl<'a> Executor<'a> { #[must_use] pub fn word(&mut self, addr: u32) -> u32 { #[allow(clippy::single_match_else)] - let record = self.state.memory.get(&addr); + let record = self.state.memory.get(addr); if self.executor_mode == ExecutorMode::Checkpoint || self.unconstrained { match record { @@ -696,23 +696,19 @@ impl<'a> Executor<'a> { if self.executor_mode == ExecutorMode::Trace { self.memory_accesses = MemoryAccessRecord::default(); } - let lookup_id = if self.executor_mode == ExecutorMode::Simple { - LookupId::default() - } else { + let lookup_id = if self.executor_mode == ExecutorMode::Trace { create_alu_lookup_id() - }; - let syscall_lookup_id = if self.executor_mode == ExecutorMode::Simple { - LookupId::default() } else { + LookupId::default() + }; + let syscall_lookup_id = if self.executor_mode == ExecutorMode::Trace { create_alu_lookup_id() + } else { + LookupId::default() }; if self.print_report && !self.unconstrained { - self.report - .opcode_counts - .entry(instruction.opcode) - .and_modify(|c| *c += 1) - .or_insert(1); + self.report.opcode_counts[instruction.opcode] += 1; } match instruction.opcode { @@ -930,7 +926,7 @@ impl<'a> Executor<'a> { let syscall = SyscallCode::from_u32(syscall_id); if self.print_report && !self.unconstrained { - self.report.syscall_counts.entry(syscall).and_modify(|c| *c += 1).or_insert(1); + self.report.syscall_counts[syscall] += 1; } // `hint_slice` is allowed in unconstrained mode since it is used to write the hint. @@ -1174,7 +1170,6 @@ impl<'a> Executor<'a> { pub fn execute_state(&mut self) -> Result<(ExecutionState, bool), ExecutionError> { self.memory_checkpoint.clear(); self.executor_mode = ExecutorMode::Checkpoint; - self.print_report = true; // Take memory out of state before cloning it so that memory is not cloned. let memory = std::mem::take(&mut self.state.memory); @@ -1194,7 +1189,7 @@ impl<'a> Executor<'a> { if let Some(record) = record { checkpoint.memory.insert(addr, record); } else { - checkpoint.memory.remove(&addr); + checkpoint.memory.remove(addr); } }); } else { @@ -1212,8 +1207,8 @@ impl<'a> Executor<'a> { self.state.channel = 0; tracing::debug!("loading memory image"); - for (addr, value) in &self.program.memory_image { - self.state.memory.insert(*addr, MemoryRecord { value: *value, shard: 0, timestamp: 0 }); + for (&addr, value) in &self.program.memory_image { + self.state.memory.insert(addr, MemoryRecord { value: *value, shard: 0, timestamp: 0 }); } } @@ -1351,7 +1346,7 @@ impl<'a> Executor<'a> { // We handle the addr = 0 case separately, as we constrain it to be 0 in the first row // of the memory finalize table so it must be first in the array of events. - let addr_0_record = self.state.memory.get(&0u32); + let addr_0_record = self.state.memory.get(0); let addr_0_final_record = match addr_0_record { Some(record) => record, @@ -1365,19 +1360,22 @@ impl<'a> Executor<'a> { MemoryInitializeFinalizeEvent::initialize(0, 0, addr_0_record.is_some()); memory_initialize_events.push(addr_0_initialize_event); - self.report.touched_memory_addresses = self.state.memory.len() as u64; + // Count the number of touched memory addresses manually, since `PagedMemory` doesn't + // already know its length. + self.report.touched_memory_addresses = 0; for addr in self.state.memory.keys() { - if *addr == 0 { + self.report.touched_memory_addresses += 1; + if addr == 0 { // Handled above. continue; } // Program memory is initialized in the MemoryProgram chip and doesn't require any // events, so we only send init events for other memory addresses. - if !self.record.program.memory_image.contains_key(addr) { - let initial_value = self.state.uninitialized_memory.get(addr).unwrap_or(&0); + if !self.record.program.memory_image.contains_key(&addr) { + let initial_value = self.state.uninitialized_memory.get(&addr).unwrap_or(&0); memory_initialize_events.push(MemoryInitializeFinalizeEvent::initialize( - *addr, + addr, *initial_value, true, )); @@ -1385,7 +1383,7 @@ impl<'a> Executor<'a> { let record = *self.state.memory.get(addr).unwrap(); memory_finalize_events - .push(MemoryInitializeFinalizeEvent::finalize_from_record(*addr, &record)); + .push(MemoryInitializeFinalizeEvent::finalize_from_record(addr, &record)); } } diff --git a/crates/core/executor/src/lib.rs b/crates/core/executor/src/lib.rs index eb9b850246..b6e8ae9c86 100644 --- a/crates/core/executor/src/lib.rs +++ b/crates/core/executor/src/lib.rs @@ -26,6 +26,7 @@ mod executor; mod hook; mod instruction; mod io; +mod memory; mod opcode; mod program; #[cfg(any(test, feature = "programs"))] diff --git a/crates/core/executor/src/memory.rs b/crates/core/executor/src/memory.rs new file mode 100644 index 0000000000..4a1c2c9418 --- /dev/null +++ b/crates/core/executor/src/memory.rs @@ -0,0 +1,300 @@ +use std::mem::{replace, size_of}; + +use serde::{Deserialize, Serialize}; +use vec_map::VecMap; + +/// A page of memory. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Page(VecMap); + +impl Page { + /// Create a `Page` with capacity `PAGE_LEN`. + pub fn with_capacity(capacity: usize) -> Self { + Self(VecMap::with_capacity(capacity)) + } +} + +impl Default for Page { + fn default() -> Self { + Self(VecMap::default()) + } +} + +/// Paged memory. Balances both memory locality and total memory usage. +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct PagedMemory { + /// The internal page table. + pub page_table: VecMap>, +} + +impl PagedMemory { + /// The base 2 logarithm of the (maximum) page size in bytes. + const LOG_PAGE_SIZE: usize = 12; + /// The base 2 logarithm of the length of each page, considered as an array of `Option`. + const LOG_PAGE_LEN: usize = + Self::LOG_PAGE_SIZE - size_of::>().next_power_of_two().ilog2() as usize; + /// The length of each page, considered as an array of `Option`. + const PAGE_LEN: usize = 1 << Self::LOG_PAGE_LEN; + /// The mask for retrieving the lowest bits necessary to index within a page. + const PAGE_MASK: usize = Self::PAGE_LEN - 1; + /// The maximum number of pages. Used for the length of the page table. + const MAX_PAGE_COUNT: usize = + 1 << (u32::BITS as usize - Self::LOG_PAGE_LEN - Self::NUM_IGNORED_LOWER_BITS); + /// The number of lower bits to ignore, since addresses (except registers) are a multiple of 4. + const NUM_IGNORED_LOWER_BITS: usize = 2; + /// The number of registers in the virtual machine. + const NUM_REGISTERS: usize = 32; + /// The offset subtracted from the main address space to make it contiguous. + const ADDR_COMPRESS_OFFSET: usize = + Self::NUM_REGISTERS - (Self::NUM_REGISTERS >> Self::NUM_IGNORED_LOWER_BITS); + + /// Create a `PagedMemory` with capacity `MAX_PAGE_COUNT`. + pub fn new_preallocated() -> Self { + Self { page_table: VecMap::with_capacity(Self::MAX_PAGE_COUNT) } + } + + /// Get a reference to the memory value at the given address, if it exists. + pub fn get(&self, addr: u32) -> Option<&V> { + let (upper, lower) = Self::indices(addr); + self.page_table.get(upper)?.0.get(lower) + } + + /// Get a mutable reference to the memory value at the given address, if it exists. + pub fn get_mut(&mut self, addr: u32) -> Option<&mut V> { + let (upper, lower) = Self::indices(addr); + self.page_table.get_mut(upper)?.0.get_mut(lower) + } + + /// Insert a value at the given address. Returns the previous value, if any. + pub fn insert(&mut self, addr: u32, value: V) -> Option { + let (upper, lower) = Self::indices(addr); + self.page_table + .entry(upper) + .or_insert_with(PagedMemory::::new_page) + .0 + .insert(lower, value) + } + + /// Remove the value at the given address if it exists, returning it. + pub fn remove(&mut self, addr: u32) -> Option { + let (upper, lower) = Self::indices(addr); + match self.page_table.entry(upper) { + vec_map::Entry::Vacant(_) => None, + vec_map::Entry::Occupied(mut entry) => { + let res = entry.get_mut().0.remove(lower); + if entry.get().0.is_empty() { + entry.remove(); + } + res + } + } + } + + /// Gets the memory entry for the given address. + pub fn entry(&mut self, addr: u32) -> Entry<'_, V> { + let (upper, lower) = Self::indices(addr); + let page_table_entry = self.page_table.entry(upper); + if let vec_map::Entry::Occupied(occ_entry) = page_table_entry { + if occ_entry.get().0.contains_key(lower) { + Entry::Occupied(OccupiedEntry { lower, page_table_occupied_entry: occ_entry }) + } else { + Entry::Vacant(VacantEntry { + lower, + page_table_entry: vec_map::Entry::Occupied(occ_entry), + }) + } + } else { + Entry::Vacant(VacantEntry { lower, page_table_entry }) + } + } + + /// Returns an iterator over the occupied addresses. + pub fn keys(&self) -> impl Iterator + '_ { + self.page_table.iter().flat_map(|(upper, page)| { + let upper = upper << Self::LOG_PAGE_LEN; + page.0.iter().map(move |(lower, _)| Self::decompress_addr(upper + lower)) + }) + } + + /// Clears the page table. Drops all `Page`s, but retains the memory used by the table itself. + pub fn clear(&mut self) { + self.page_table.clear(); + } + + /// Break apart an address into an upper and lower index. + #[inline] + const fn indices(addr: u32) -> (usize, usize) { + let index = Self::compress_addr(addr); + (index >> Self::LOG_PAGE_LEN, index & Self::PAGE_MASK) + } + + /// Compress an address from the sparse address space to a contiguous space. + #[inline] + const fn compress_addr(addr: u32) -> usize { + let addr = addr as usize; + if addr < Self::NUM_REGISTERS { + addr + } else { + (addr >> Self::NUM_IGNORED_LOWER_BITS) + Self::ADDR_COMPRESS_OFFSET + } + } + + /// Decompress an address from a contiguous space to the sparse address space. + #[inline] + const fn decompress_addr(addr: usize) -> u32 { + if addr < Self::NUM_REGISTERS { + addr as u32 + } else { + ((addr - Self::ADDR_COMPRESS_OFFSET) << Self::NUM_IGNORED_LOWER_BITS) as u32 + } + } + + #[inline] + fn new_page() -> Page { + Page::with_capacity(Self::PAGE_LEN) + } +} + +impl Default for PagedMemory { + fn default() -> Self { + Self { page_table: VecMap::default() } + } +} + +/// An entry of `PagedMemory`, for in-place manipulation. +pub enum Entry<'a, V> { + Vacant(VacantEntry<'a, V>), + Occupied(OccupiedEntry<'a, V>), +} + +impl<'a, V> Entry<'a, V> { + /// Ensures a value is in the entry, inserting the provided value if necessary. + /// Returns a mutable reference to the value. + pub fn or_insert(self, default: V) -> &'a mut V { + match self { + Entry::Vacant(entry) => entry.insert(default), + Entry::Occupied(entry) => entry.into_mut(), + } + } + + /// Ensures a value is in the entry, computing a value if necessary. + /// Returns a mutable reference to the value. + pub fn or_insert_with V>(self, default: F) -> &'a mut V { + match self { + Entry::Vacant(entry) => entry.insert(default()), + Entry::Occupied(entry) => entry.into_mut(), + } + } +} + +/// A vacant entry of `PagedMemory`, for in-place manipulation. +pub struct VacantEntry<'a, V> { + lower: usize, + page_table_entry: vec_map::Entry<'a, Page>, +} + +impl<'a, V> VacantEntry<'a, V> { + /// Insert a value into the `VacantEntry`, returning a mutable reference to it. + pub fn insert(self, value: V) -> &'a mut V { + // By construction, the slot in the page is `None`. + match self.page_table_entry.or_insert_with(PagedMemory::::new_page).0.entry(self.lower) { + vec_map::Entry::Vacant(entry) => entry.insert(value), + vec_map::Entry::Occupied(_) => { + panic!("entry with lower bits {:#x} should be vacant", self.lower) + } + } + } +} + +/// A vacant entry of `PagedMemory`, for in-place manipulation. +pub struct OccupiedEntry<'a, V> { + lower: usize, + page_table_occupied_entry: vec_map::OccupiedEntry<'a, Page>, +} + +impl<'a, V> OccupiedEntry<'a, V> { + /// Get a reference to the value in the `OccupiedEntry`. + pub fn get(&self) -> &V { + self.page_table_occupied_entry.get().0.get(self.lower).unwrap() + } + + /// Get a mutable reference to the value in the `OccupiedEntry`. + pub fn get_mut(&mut self) -> &mut V { + self.page_table_occupied_entry.get_mut().0.get_mut(self.lower).unwrap() + } + + /// Insert a value in the `OccupiedEntry`, returning the previous value. + pub fn insert(&mut self, value: V) -> V { + replace(self.get_mut(), value) + } + + /// Converts the `OccupiedEntry` the into a mutable reference to the associated value. + pub fn into_mut(self) -> &'a mut V { + self.page_table_occupied_entry.into_mut().0.get_mut(self.lower).unwrap() + } + + /// Removes the value from the `OccupiedEntry` and returns it. + pub fn remove(mut self) -> V { + let res = self.page_table_occupied_entry.get_mut().0.remove(self.lower).unwrap(); + if self.page_table_occupied_entry.get().0.is_empty() { + self.page_table_occupied_entry.remove(); + } + res + } +} + +impl FromIterator<(u32, V)> for PagedMemory { + fn from_iter>(iter: T) -> Self { + let mut mmu = Self::default(); + for (k, v) in iter { + mmu.insert(k, v); + } + mmu + } +} + +impl IntoIterator for PagedMemory { + type Item = (u32, V); + + type IntoIter = IntoIter; + + fn into_iter(self) -> Self::IntoIter { + IntoIter { upper: 0, upper_iter: self.page_table.into_iter(), lower_iter: None } + } +} + +pub struct IntoIter { + upper: usize, + upper_iter: vec_map::IntoIter>, + lower_iter: Option>, +} + +impl Iterator for IntoIter { + type Item = (u32, V); + + fn next(&mut self) -> Option { + loop { + // Populate the lower iterator. + let it = match &mut self.lower_iter { + Some(it) => it, + None => { + // Exit if the upper iterator has finished. + let (upper, page) = self.upper_iter.next()?; + self.upper = upper; + self.lower_iter.insert(page.0.into_iter()) + } + }; + // Yield the next item. + if let Some((lower, record)) = it.next() { + return Some(( + PagedMemory::::decompress_addr( + (self.upper << PagedMemory::::LOG_PAGE_LEN) + lower, + ), + record, + )); + } + // If no next item in the lower iterator, it must be finished. + self.lower_iter = None; + } + } +} diff --git a/crates/core/executor/src/opcode.rs b/crates/core/executor/src/opcode.rs index 868f516d49..e51d3f05ad 100644 --- a/crates/core/executor/src/opcode.rs +++ b/crates/core/executor/src/opcode.rs @@ -2,6 +2,7 @@ use std::fmt::Display; +use enum_map::Enum; use p3_field::Field; use serde::{Deserialize, Serialize}; @@ -20,7 +21,9 @@ use serde::{Deserialize, Serialize}; /// Refer to the "RV32I Reference Card" [here](https://github.com/johnwinans/rvalp/releases) for /// more details. #[allow(non_camel_case_types)] -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord, Enum, +)] pub enum Opcode { /// rd ← rs1 + rs2, pc ← pc + 4 ADD = 0, diff --git a/crates/core/executor/src/report.rs b/crates/core/executor/src/report.rs index 3e4b29458a..7459d2d91b 100644 --- a/crates/core/executor/src/report.rs +++ b/crates/core/executor/src/report.rs @@ -1,19 +1,20 @@ use std::{ - collections::{hash_map::Entry, HashMap}, fmt::{Display, Formatter, Result as FmtResult}, - hash::Hash, ops::{Add, AddAssign}, }; +use enum_map::{EnumArray, EnumMap}; +use hashbrown::HashMap; + use crate::{events::sorted_table_lines, syscalls::SyscallCode, Opcode}; /// An execution report. #[derive(Default, Debug, Clone, PartialEq, Eq)] pub struct ExecutionReport { /// The opcode counts. - pub opcode_counts: HashMap, + pub opcode_counts: Box>, /// The syscall counts. - pub syscall_counts: HashMap, + pub syscall_counts: Box>, /// The cycle tracker counts. pub cycle_tracker: HashMap, /// The unique memory address counts. @@ -35,24 +36,20 @@ impl ExecutionReport { } /// Combines two `HashMap`s together. If a key is in both maps, the values are added together. -fn hashmap_add_assign(lhs: &mut HashMap, rhs: HashMap) +fn counts_add_assign(lhs: &mut EnumMap, rhs: EnumMap) where - K: Eq + Hash, + K: EnumArray, V: AddAssign, { for (k, v) in rhs { - // Can't use `.and_modify(...).or_insert(...)` because we want to use `v` in both places. - match lhs.entry(k) { - Entry::Occupied(e) => *e.into_mut() += v, - Entry::Vacant(e) => drop(e.insert(v)), - } + lhs[k] += v; } } impl AddAssign for ExecutionReport { fn add_assign(&mut self, rhs: Self) { - hashmap_add_assign(&mut self.opcode_counts, rhs.opcode_counts); - hashmap_add_assign(&mut self.syscall_counts, rhs.syscall_counts); + counts_add_assign(&mut self.opcode_counts, *rhs.opcode_counts); + counts_add_assign(&mut self.syscall_counts, *rhs.syscall_counts); self.touched_memory_addresses += rhs.touched_memory_addresses; } } @@ -69,12 +66,12 @@ impl Add for ExecutionReport { impl Display for ExecutionReport { fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult { writeln!(f, "opcode counts ({} total instructions):", self.total_instruction_count())?; - for line in sorted_table_lines(&self.opcode_counts) { + for line in sorted_table_lines(self.opcode_counts.as_ref()) { writeln!(f, " {line}")?; } writeln!(f, "syscall counts ({} total syscall instructions):", self.total_syscall_count())?; - for line in sorted_table_lines(&self.syscall_counts) { + for line in sorted_table_lines(self.syscall_counts.as_ref()) { writeln!(f, " {line}")?; } diff --git a/crates/core/executor/src/state.rs b/crates/core/executor/src/state.rs index 8334df0134..70dbd08404 100644 --- a/crates/core/executor/src/state.rs +++ b/crates/core/executor/src/state.rs @@ -6,11 +6,11 @@ use std::{ use hashbrown::HashMap; use nohash_hasher::BuildNoHashHasher; use serde::{Deserialize, Serialize}; -use serde_with::serde_as; use sp1_stark::{baby_bear_poseidon2::BabyBearPoseidon2, ShardProof, StarkVerifyingKey}; use crate::{ events::MemoryRecord, + memory::PagedMemory, record::{ExecutionRecord, MemoryAccessRecord}, syscalls::SyscallCode, utils::{deserialize_hashmap_as_vec, serialize_hashmap_as_vec}, @@ -18,7 +18,6 @@ use crate::{ }; /// Holds data describing the current state of a program's execution. -#[serde_as] #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct ExecutionState { /// The global clock keeps track of how many instrutions have been executed through all shards. @@ -31,7 +30,7 @@ pub struct ExecutionState { /// executed in this shard. pub clk: u32, - /// The channel alternates between 0 and [crate::bytes::NUM_BYTE_LOOKUP_CHANNELS], + /// The channel alternates between 0 and [`crate::bytes::NUM_BYTE_LOOKUP_CHANNELS`], /// used to controll byte lookup multiplicity. pub channel: u8, @@ -40,14 +39,10 @@ pub struct ExecutionState { /// The memory which instructions operate over. Values contain the memory value and last shard /// + timestamp that each memory address was accessed. - #[serde( - serialize_with = "serialize_hashmap_as_vec", - deserialize_with = "deserialize_hashmap_as_vec" - )] - pub memory: HashMap>, + pub memory: PagedMemory, /// Uninitialized memory addresses that have a specific value they should be initialized with. - /// SyscallHintRead uses this to write hint data into uninitialized memory. + /// `SyscallHintRead` uses this to write hint data into uninitialized memory. #[serde( serialize_with = "serialize_hashmap_as_vec", deserialize_with = "deserialize_hashmap_as_vec" @@ -57,7 +52,7 @@ pub struct ExecutionState { /// A stream of input values (global to the entire program). pub input_stream: Vec>, - /// A ptr to the current position in the input stream incremented by HINT_READ opcode. + /// A ptr to the current position in the input stream incremented by `HINT_READ` opcode. pub input_stream_ptr: usize, /// A stream of proofs inputted to the program. @@ -70,7 +65,7 @@ pub struct ExecutionState { pub public_values_stream: Vec, /// A ptr to the current position in the public values stream, incremented when reading from - /// public_values_stream. + /// `public_values_stream`. pub public_values_stream_ptr: usize, /// Keeps track of how many times a certain syscall has been called. @@ -88,7 +83,7 @@ impl ExecutionState { clk: 0, channel: 0, pc: pc_start, - memory: HashMap::default(), + memory: PagedMemory::new_preallocated(), uninitialized_memory: HashMap::default(), input_stream: Vec::new(), input_stream_ptr: 0, @@ -112,7 +107,7 @@ pub struct ForkState { /// The original `pc` value at the fork point. pub pc: u32, /// All memory changes since the fork point. - pub memory_diff: HashMap, BuildNoHashHasher>, + pub memory_diff: HashMap>, /// The original memory access record at the fork point. pub op_record: MemoryAccessRecord, /// The original execution record at the fork point. diff --git a/crates/core/executor/src/syscalls/code.rs b/crates/core/executor/src/syscalls/code.rs index 929d7003c2..ece5a06e99 100644 --- a/crates/core/executor/src/syscalls/code.rs +++ b/crates/core/executor/src/syscalls/code.rs @@ -1,3 +1,4 @@ +use enum_map::Enum; use serde::{Deserialize, Serialize}; use strum_macros::EnumIter; @@ -18,7 +19,7 @@ use strum_macros::EnumIter; /// memory accesses is bounded. /// - Byte 3: Currently unused. #[derive( - Debug, Copy, Clone, PartialEq, Eq, Hash, EnumIter, Ord, PartialOrd, Serialize, Deserialize, + Debug, Copy, Clone, PartialEq, Eq, Hash, EnumIter, Ord, PartialOrd, Serialize, Deserialize, Enum, )] #[allow(non_camel_case_types)] #[allow(clippy::upper_case_acronyms)] diff --git a/crates/core/executor/src/syscalls/unconstrained.rs b/crates/core/executor/src/syscalls/unconstrained.rs index 091748fb0c..2a957c56d7 100644 --- a/crates/core/executor/src/syscalls/unconstrained.rs +++ b/crates/core/executor/src/syscalls/unconstrained.rs @@ -42,7 +42,7 @@ impl Syscall for ExitUnconstrainedSyscall { ctx.rt.state.memory.insert(addr, value); } None => { - ctx.rt.state.memory.remove(&addr); + ctx.rt.state.memory.remove(addr); } } } diff --git a/crates/core/machine/src/io.rs b/crates/core/machine/src/io.rs index ee6c652f73..6f5475cf22 100644 --- a/crates/core/machine/src/io.rs +++ b/crates/core/machine/src/io.rs @@ -113,13 +113,20 @@ impl SP1PublicValues { self.buffer.write_slice(slice); } + /// Hash the public values. + pub fn hash(&self) -> Vec { + let mut hasher = Sha256::new(); + hasher.update(self.buffer.data.as_slice()); + hasher.finalize().to_vec() + } + /// Hash the public values, mask the top 3 bits and return a BigUint. Matches the implementation /// of `hashPublicValues` in the Solidity verifier. /// /// ```solidity /// sha256(publicValues) & bytes32(uint256((1 << 253) - 1)); /// ``` - pub fn hash(&self) -> BigUint { + pub fn hash_bn254(&self) -> BigUint { // Hash the public values. let mut hasher = Sha256::new(); hasher.update(self.buffer.data.as_slice()); @@ -188,7 +195,7 @@ mod tests { let mut public_values = SP1PublicValues::new(); public_values.write_slice(&test_bytes); - let hash = public_values.hash(); + let hash = public_values.hash_bn254(); let expected_hash = "1ce987d0a7fcc2636fe87e69295ba12b1cc46c256b369ae7401c51b805ee91bd"; let expected_hash_biguint = BigUint::from_bytes_be(&hex::decode(expected_hash).unwrap()); diff --git a/crates/core/machine/src/lib.rs b/crates/core/machine/src/lib.rs index bb11135186..6fd698c897 100644 --- a/crates/core/machine/src/lib.rs +++ b/crates/core/machine/src/lib.rs @@ -30,4 +30,4 @@ pub mod utils; /// This string should be updated whenever any step in verifying an SP1 proof changes, including /// core, recursion, and plonk-bn254. This string is used to download SP1 artifacts and the gnark /// docker image. -pub const SP1_CIRCUIT_VERSION: &str = "v1.2.0"; +pub const SP1_CIRCUIT_VERSION: &str = "v2.0.0"; diff --git a/crates/core/machine/src/riscv/cost.rs b/crates/core/machine/src/riscv/cost.rs index 685e683711..0da65a34cc 100644 --- a/crates/core/machine/src/riscv/cost.rs +++ b/crates/core/machine/src/riscv/cost.rs @@ -33,151 +33,133 @@ impl CostEstimator for ExecutionReport { total_area += (cpu_events as u64) * costs[&RiscvAirDiscriminants::Cpu]; total_chips += 1; - let sha_extend_events = *self.syscall_counts.get(&SyscallCode::SHA_EXTEND).unwrap_or(&0); + let sha_extend_events = self.syscall_counts[SyscallCode::SHA_EXTEND]; total_area += (sha_extend_events as u64) * costs[&RiscvAirDiscriminants::Sha256Extend]; total_chips += 1; - let sha_compress_events = - *self.syscall_counts.get(&SyscallCode::SHA_COMPRESS).unwrap_or(&0); + let sha_compress_events = self.syscall_counts[SyscallCode::SHA_COMPRESS]; total_area += (sha_compress_events as u64) * costs[&RiscvAirDiscriminants::Sha256Compress]; total_chips += 1; - let ed_add_events = *self.syscall_counts.get(&SyscallCode::ED_ADD).unwrap_or(&0); + let ed_add_events = self.syscall_counts[SyscallCode::ED_ADD]; total_area += (ed_add_events as u64) * costs[&RiscvAirDiscriminants::Ed25519Add]; total_chips += 1; - let ed_decompress_events = - *self.syscall_counts.get(&SyscallCode::ED_DECOMPRESS).unwrap_or(&0); + let ed_decompress_events = self.syscall_counts[SyscallCode::ED_DECOMPRESS]; total_area += (ed_decompress_events as u64) * costs[&RiscvAirDiscriminants::Ed25519Decompress]; total_chips += 1; - let k256_decompress_events = - *self.syscall_counts.get(&SyscallCode::SECP256K1_DECOMPRESS).unwrap_or(&0); + let k256_decompress_events = self.syscall_counts[SyscallCode::SECP256K1_DECOMPRESS]; total_area += (k256_decompress_events as u64) * costs[&RiscvAirDiscriminants::K256Decompress]; total_chips += 1; - let secp256k1_add_events = - *self.syscall_counts.get(&SyscallCode::SECP256K1_ADD).unwrap_or(&0); + let secp256k1_add_events = self.syscall_counts[SyscallCode::SECP256K1_ADD]; total_area += (secp256k1_add_events as u64) * costs[&RiscvAirDiscriminants::Secp256k1Add]; total_chips += 1; - let secp256k1_double_events = - *self.syscall_counts.get(&SyscallCode::SECP256K1_DOUBLE).unwrap_or(&0); + let secp256k1_double_events = self.syscall_counts[SyscallCode::SECP256K1_DOUBLE]; total_area += (secp256k1_double_events as u64) * costs[&RiscvAirDiscriminants::Secp256k1Double]; total_chips += 1; - let keccak256_permute_events = - *self.syscall_counts.get(&SyscallCode::KECCAK_PERMUTE).unwrap_or(&0); + let keccak256_permute_events = self.syscall_counts[SyscallCode::KECCAK_PERMUTE]; total_area += (keccak256_permute_events as u64) * costs[&RiscvAirDiscriminants::KeccakP]; total_chips += 1; - let bn254_add_events = *self.syscall_counts.get(&SyscallCode::BN254_ADD).unwrap_or(&0); + let bn254_add_events = self.syscall_counts[SyscallCode::BN254_ADD]; total_area += (bn254_add_events as u64) * costs[&RiscvAirDiscriminants::Bn254Add]; total_chips += 1; - let bn254_double_events = - *self.syscall_counts.get(&SyscallCode::BN254_DOUBLE).unwrap_or(&0); + let bn254_double_events = self.syscall_counts[SyscallCode::BN254_DOUBLE]; total_area += (bn254_double_events as u64) * costs[&RiscvAirDiscriminants::Bn254Double]; total_chips += 1; - let bls12381_add_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_ADD).unwrap_or(&0); + let bls12381_add_events = self.syscall_counts[SyscallCode::BLS12381_ADD]; total_area += (bls12381_add_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Add]; total_chips += 1; - let bls12381_double_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_DOUBLE).unwrap_or(&0); + let bls12381_double_events = self.syscall_counts[SyscallCode::BLS12381_DOUBLE]; total_area += (bls12381_double_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Double]; total_chips += 1; - let uint256_mul_events = *self.syscall_counts.get(&SyscallCode::UINT256_MUL).unwrap_or(&0); + let uint256_mul_events = self.syscall_counts[SyscallCode::UINT256_MUL]; total_area += (uint256_mul_events as u64) * costs[&RiscvAirDiscriminants::Uint256Mul]; total_chips += 1; - let bls12381_fp_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_FP_ADD).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BLS12381_FP_SUB).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BLS12381_FP_MUL).unwrap_or(&0); + let bls12381_fp_events = self.syscall_counts[SyscallCode::BLS12381_FP_ADD] + + self.syscall_counts[SyscallCode::BLS12381_FP_SUB] + + self.syscall_counts[SyscallCode::BLS12381_FP_MUL]; total_area += (bls12381_fp_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Fp]; total_chips += 1; - let bls12381_fp2_addsub_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_FP2_ADD).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BLS12381_FP2_SUB).unwrap_or(&0); + let bls12381_fp2_addsub_events = self.syscall_counts[SyscallCode::BLS12381_FP2_ADD] + + self.syscall_counts[SyscallCode::BLS12381_FP2_SUB]; total_area += (bls12381_fp2_addsub_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Fp2AddSub]; total_chips += 1; - let bls12381_fp2_mul_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_FP2_MUL).unwrap_or(&0); + let bls12381_fp2_mul_events = self.syscall_counts[SyscallCode::BLS12381_FP2_MUL]; total_area += (bls12381_fp2_mul_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Fp2Mul]; total_chips += 1; - let bn254_fp_events = *self.syscall_counts.get(&SyscallCode::BN254_FP_ADD).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BN254_FP_SUB).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BN254_FP_MUL).unwrap_or(&0); + let bn254_fp_events = self.syscall_counts[SyscallCode::BN254_FP_ADD] + + self.syscall_counts[SyscallCode::BN254_FP_SUB] + + self.syscall_counts[SyscallCode::BN254_FP_MUL]; total_area += (bn254_fp_events as u64) * costs[&RiscvAirDiscriminants::Bn254Fp]; total_chips += 1; - let bn254_fp2_addsub_events = - *self.syscall_counts.get(&SyscallCode::BN254_FP2_ADD).unwrap_or(&0) - + *self.syscall_counts.get(&SyscallCode::BN254_FP2_SUB).unwrap_or(&0); + let bn254_fp2_addsub_events = self.syscall_counts[SyscallCode::BN254_FP2_ADD] + + self.syscall_counts[SyscallCode::BN254_FP2_SUB]; total_area += (bn254_fp2_addsub_events as u64) * costs[&RiscvAirDiscriminants::Bn254Fp2AddSub]; total_chips += 1; - let bn254_fp2_mul_events = - *self.syscall_counts.get(&SyscallCode::BN254_FP2_MUL).unwrap_or(&0); + let bn254_fp2_mul_events = self.syscall_counts[SyscallCode::BN254_FP2_MUL]; total_area += (bn254_fp2_mul_events as u64) * costs[&RiscvAirDiscriminants::Bn254Fp2Mul]; total_chips += 1; - let bls12381_decompress_events = - *self.syscall_counts.get(&SyscallCode::BLS12381_DECOMPRESS).unwrap_or(&0); + let bls12381_decompress_events = self.syscall_counts[SyscallCode::BLS12381_DECOMPRESS]; total_area += (bls12381_decompress_events as u64) * costs[&RiscvAirDiscriminants::Bls12381Decompress]; total_chips += 1; - let divrem_events = *self.opcode_counts.get(&Opcode::DIV).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::REM).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::DIVU).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::REMU).unwrap_or(&0); + let divrem_events = self.opcode_counts[Opcode::DIV] + + self.opcode_counts[Opcode::REM] + + self.opcode_counts[Opcode::DIVU] + + self.opcode_counts[Opcode::REMU]; total_area += (divrem_events as u64) * costs[&RiscvAirDiscriminants::DivRem]; total_chips += 1; - let addsub_events = *self.opcode_counts.get(&Opcode::ADD).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::SUB).unwrap_or(&0); + let addsub_events = self.opcode_counts[Opcode::ADD] + self.opcode_counts[Opcode::SUB]; total_area += (addsub_events as u64) * costs[&RiscvAirDiscriminants::Add]; total_chips += 1; - let bitwise_events = *self.opcode_counts.get(&Opcode::AND).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::OR).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::XOR).unwrap_or(&0); + let bitwise_events = self.opcode_counts[Opcode::AND] + + self.opcode_counts[Opcode::OR] + + self.opcode_counts[Opcode::XOR]; total_area += (bitwise_events as u64) * costs[&RiscvAirDiscriminants::Bitwise]; total_chips += 1; - let mul_events = *self.opcode_counts.get(&Opcode::MUL).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::MULH).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::MULHU).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::MULHSU).unwrap_or(&0); + let mul_events = self.opcode_counts[Opcode::MUL] + + self.opcode_counts[Opcode::MULH] + + self.opcode_counts[Opcode::MULHU] + + self.opcode_counts[Opcode::MULHSU]; total_area += (mul_events as u64) * costs[&RiscvAirDiscriminants::Mul]; total_chips += 1; - let shift_right_events = *self.opcode_counts.get(&Opcode::SRL).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::SRA).unwrap_or(&0); + let shift_right_events = self.opcode_counts[Opcode::SRL] + self.opcode_counts[Opcode::SRA]; total_area += (shift_right_events as u64) * costs[&RiscvAirDiscriminants::ShiftRight]; total_chips += 1; - let shift_left_events = *self.opcode_counts.get(&Opcode::SLL).unwrap_or(&0); + let shift_left_events = self.opcode_counts[Opcode::SLL]; total_area += (shift_left_events as u64) * costs[&RiscvAirDiscriminants::ShiftLeft]; total_chips += 1; - let lt_events = *self.opcode_counts.get(&Opcode::SLT).unwrap_or(&0) - + *self.opcode_counts.get(&Opcode::SLTU).unwrap_or(&0); + let lt_events = self.opcode_counts[Opcode::SLT] + self.opcode_counts[Opcode::SLTU]; total_area += (lt_events as u64) * costs[&RiscvAirDiscriminants::Lt]; total_chips += 1; diff --git a/crates/core/machine/src/utils/prove.rs b/crates/core/machine/src/utils/prove.rs index adedbd6065..5f12c7dd70 100644 --- a/crates/core/machine/src/utils/prove.rs +++ b/crates/core/machine/src/utils/prove.rs @@ -545,11 +545,11 @@ where // Print the opcode and syscall count tables like `du`: sorted by count (descending) and // with the count in the first column. tracing::info!("execution report (opcode counts):"); - for line in sorted_table_lines(&report_aggregate.opcode_counts) { + for line in sorted_table_lines(report_aggregate.opcode_counts.as_ref()) { tracing::info!(" {line}"); } tracing::info!("execution report (syscall counts):"); - for line in sorted_table_lines(&report_aggregate.syscall_counts) { + for line in sorted_table_lines(report_aggregate.syscall_counts.as_ref()) { tracing::info!(" {line}"); } diff --git a/crates/eval/src/lib.rs b/crates/eval/src/lib.rs index 88c6faf573..06f85a0a68 100644 --- a/crates/eval/src/lib.rs +++ b/crates/eval/src/lib.rs @@ -188,7 +188,7 @@ fn run_evaluation( cycles, exec_khz: calculate_khz(cycles, exec_duration), core_khz: calculate_khz(cycles, core_duration), - compressed_khz: calculate_khz(cycles, compress_duration), + compressed_khz: calculate_khz(cycles, compress_duration + core_duration), time: total_duration.as_secs_f64(), success: true, } diff --git a/crates/prover/src/verify.rs b/crates/prover/src/verify.rs index f9c0817ca3..99cf818d01 100644 --- a/crates/prover/src/verify.rs +++ b/crates/prover/src/verify.rs @@ -441,7 +441,7 @@ pub fn verify_plonk_bn254_public_inputs( return Err(PlonkVerificationError::InvalidVerificationKey.into()); } - let public_values_hash = public_values.hash(); + let public_values_hash = public_values.hash_bn254(); if public_values_hash != expected_public_values_hash { return Err(PlonkVerificationError::InvalidPublicValues.into()); } @@ -464,7 +464,7 @@ pub fn verify_groth16_bn254_public_inputs( return Err(Groth16VerificationError::InvalidVerificationKey.into()); } - let public_values_hash = public_values.hash(); + let public_values_hash = public_values.hash_bn254(); if public_values_hash != expected_public_values_hash { return Err(Groth16VerificationError::InvalidPublicValues.into()); } diff --git a/crates/recursion/core-v2/src/chips/poseidon2_wide/air.rs b/crates/recursion/core-v2/src/chips/poseidon2_wide/air.rs index 393910bdac..528105ac60 100644 --- a/crates/recursion/core-v2/src/chips/poseidon2_wide/air.rs +++ b/crates/recursion/core-v2/src/chips/poseidon2_wide/air.rs @@ -111,7 +111,7 @@ impl Poseidon2WideChip { let calculated_sbox_deg_3 = add_rc[i].clone() * add_rc[i].clone() * add_rc[i].clone(); if let Some(external_sbox) = local_row.external_rounds_sbox() { - // builder.assert_eq(external_sbox[r][i].into(), calculated_sbox_deg_3); + builder.assert_eq(external_sbox[r][i].into(), calculated_sbox_deg_3); sbox_deg_3[i] = external_sbox[r][i].into(); } else { sbox_deg_3[i] = calculated_sbox_deg_3; diff --git a/crates/recursion/gnark-ffi/assets/SP1VerifierGroth16.txt b/crates/recursion/gnark-ffi/assets/SP1VerifierGroth16.txt new file mode 100644 index 0000000000..b0d4b5953b --- /dev/null +++ b/crates/recursion/gnark-ffi/assets/SP1VerifierGroth16.txt @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import {ISP1Verifier, ISP1VerifierWithHash} from "../ISP1Verifier.sol"; +import {Groth16Verifier} from "./Groth16Verifier.sol"; + +/// @title SP1 Verifier +/// @author Succinct Labs +/// @notice This contracts implements a solidity verifier for SP1. +contract SP1Verifier is Groth16Verifier, ISP1VerifierWithHash { + /// @notice Thrown when the verifier selector from this proof does not match the one in this + /// verifier. This indicates that this proof was sent to the wrong verifier. + /// @param received The verifier selector from the first 4 bytes of the proof. + /// @param expected The verifier selector from the first 4 bytes of the VERIFIER_HASH(). + error WrongVerifierSelector(bytes4 received, bytes4 expected); + + /// @notice Thrown when the proof is invalid. + error InvalidProof(); + + function VERSION() external pure returns (string memory) { + return "{SP1_CIRCUIT_VERSION}"; + } + + /// @inheritdoc ISP1VerifierWithHash + function VERIFIER_HASH() public pure returns (bytes32) { + return {VERIFIER_HASH}; + } + + /// @notice Hashes the public values to a field elements inside Bn254. + /// @param publicValues The public values. + function hashPublicValues( + bytes calldata publicValues + ) public pure returns (bytes32) { + return sha256(publicValues) & bytes32(uint256((1 << 253) - 1)); + } + + /// @notice Verifies a proof with given public values and vkey. + /// @param programVKey The verification key for the RISC-V program. + /// @param publicValues The public values encoded as bytes. + /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes. + function verifyProof( + bytes32 programVKey, + bytes calldata publicValues, + bytes calldata proofBytes + ) external view { + bytes4 receivedSelector = bytes4(proofBytes[:4]); + bytes4 expectedSelector = bytes4(VERIFIER_HASH()); + if (receivedSelector != expectedSelector) { + revert WrongVerifierSelector(receivedSelector, expectedSelector); + } + + bytes32 publicValuesDigest = hashPublicValues(publicValues); + uint256[2] memory inputs; + inputs[0] = uint256(programVKey); + inputs[1] = uint256(publicValuesDigest); + uint256[8] memory proof = abi.decode(proofBytes[4:], (uint256[8])); + this.Verify(proof, inputs); + } +} \ No newline at end of file diff --git a/crates/recursion/gnark-ffi/assets/SP1Verifier.txt b/crates/recursion/gnark-ffi/assets/SP1VerifierPlonk.txt similarity index 94% rename from crates/recursion/gnark-ffi/assets/SP1Verifier.txt rename to crates/recursion/gnark-ffi/assets/SP1VerifierPlonk.txt index a18f01b819..3c464708e7 100644 --- a/crates/recursion/gnark-ffi/assets/SP1Verifier.txt +++ b/crates/recursion/gnark-ffi/assets/SP1VerifierPlonk.txt @@ -2,12 +2,12 @@ pragma solidity ^0.8.20; import {ISP1Verifier, ISP1VerifierWithHash} from "../ISP1Verifier.sol"; -import {{PROOF_SYSTEM}Verifier} from "./{PROOF_SYSTEM}Verifier.sol"; +import {PlonkVerifier} from "./PlonkVerifier.sol"; /// @title SP1 Verifier /// @author Succinct Labs /// @notice This contracts implements a solidity verifier for SP1. -contract SP1Verifier is {PROOF_SYSTEM}Verifier, ISP1VerifierWithHash { +contract SP1Verifier is PlonkVerifier, ISP1VerifierWithHash { /// @notice Thrown when the verifier selector from this proof does not match the one in this /// verifier. This indicates that this proof was sent to the wrong verifier. /// @param received The verifier selector from the first 4 bytes of the proof. diff --git a/crates/recursion/gnark-ffi/go/sp1/babybear/babybear.go b/crates/recursion/gnark-ffi/go/sp1/babybear/babybear.go index 2df5facf2a..31baba23e8 100644 --- a/crates/recursion/gnark-ffi/go/sp1/babybear/babybear.go +++ b/crates/recursion/gnark-ffi/go/sp1/babybear/babybear.go @@ -50,26 +50,21 @@ func NewChip(api frontend.API) *Chip { func Zero() Variable { return Variable{ Value: frontend.Variable("0"), - NbBits: 0, + NbBits: 32, } } func One() Variable { return Variable{ Value: frontend.Variable("1"), - NbBits: 1, + NbBits: 32, } } func NewF(value string) Variable { - if value == "0" { - return Zero() - } else if value == "1" { - return One() - } return Variable{ Value: frontend.Variable(value), - NbBits: 31, + NbBits: 32, } } diff --git a/crates/recursion/gnark-ffi/src/groth16_bn254.rs b/crates/recursion/gnark-ffi/src/groth16_bn254.rs index 2ea1f299f0..063ca25ccd 100644 --- a/crates/recursion/gnark-ffi/src/groth16_bn254.rs +++ b/crates/recursion/gnark-ffi/src/groth16_bn254.rs @@ -1,6 +1,6 @@ use std::{ fs::File, - io::Write, + io::{Read, Write}, path::{Path, PathBuf}, }; @@ -76,12 +76,15 @@ impl Groth16Bn254Prover { // Write the corresponding asset files to the build dir. let sp1_verifier_path = build_dir.join("SP1VerifierGroth16.sol"); let vkey_hash = Self::get_vkey_hash(&build_dir); - let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt") + let sp1_verifier_str = include_str!("../assets/SP1VerifierGroth16.txt") .replace("{SP1_CIRCUIT_VERSION}", SP1_CIRCUIT_VERSION) .replace("{VERIFIER_HASH}", format!("0x{}", hex::encode(vkey_hash)).as_str()) .replace("{PROOF_SYSTEM}", "Groth16"); let mut sp1_verifier_file = File::create(sp1_verifier_path).unwrap(); sp1_verifier_file.write_all(sp1_verifier_str.as_bytes()).unwrap(); + + let groth16_verifier_path = build_dir.join("Groth16Verifier.sol"); + Self::modify_groth16_verifier(&groth16_verifier_path); } /// Generates a Groth16 proof given a witness. @@ -120,6 +123,20 @@ impl Groth16Bn254Prover { ) .expect("failed to verify proof") } + + /// Modify the Groth16Verifier so that it works with the SP1Verifier. + fn modify_groth16_verifier(file_path: &Path) { + let mut content = String::new(); + File::open(file_path).unwrap().read_to_string(&mut content).unwrap(); + + content = content + .replace("pragma solidity ^0.8.0;", "pragma solidity ^0.8.20;") + .replace("contract Verifier {", "contract Groth16Verifier {") + .replace("function verifyProof(", "function Verify("); + + let mut file = File::create(file_path).unwrap(); + file.write_all(content.as_bytes()).unwrap(); + } } impl Default for Groth16Bn254Prover { diff --git a/crates/recursion/gnark-ffi/src/plonk_bn254.rs b/crates/recursion/gnark-ffi/src/plonk_bn254.rs index d719d1ae80..b901eecc05 100644 --- a/crates/recursion/gnark-ffi/src/plonk_bn254.rs +++ b/crates/recursion/gnark-ffi/src/plonk_bn254.rs @@ -1,6 +1,6 @@ use std::{ fs::File, - io::Write, + io::{Read, Write}, path::{Path, PathBuf}, }; @@ -75,12 +75,15 @@ impl PlonkBn254Prover { // Write the corresponding asset files to the build dir. let sp1_verifier_path = build_dir.join("SP1VerifierPlonk.sol"); let vkey_hash = Self::get_vkey_hash(&build_dir); - let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt") + let sp1_verifier_str = include_str!("../assets/SP1VerifierPlonk.txt") .replace("{SP1_CIRCUIT_VERSION}", SP1_CIRCUIT_VERSION) .replace("{VERIFIER_HASH}", format!("0x{}", hex::encode(vkey_hash)).as_str()) .replace("{PROOF_SYSTEM}", "Plonk"); let mut sp1_verifier_file = File::create(sp1_verifier_path).unwrap(); sp1_verifier_file.write_all(sp1_verifier_str.as_bytes()).unwrap(); + + let plonk_verifier_path = build_dir.join("PlonkVerifier.sol"); + Self::modify_plonk_verifier(&plonk_verifier_path); } /// Generates a PLONK proof given a witness. @@ -119,6 +122,17 @@ impl PlonkBn254Prover { ) .expect("failed to verify proof") } + + /// Modify the PlonkVerifier so that it works with the SP1Verifier. + fn modify_plonk_verifier(file_path: &Path) { + let mut content = String::new(); + File::open(file_path).unwrap().read_to_string(&mut content).unwrap(); + + content = content.replace("pragma solidity ^0.8.19;", "pragma solidity ^0.8.20;"); + + let mut file = File::create(file_path).unwrap(); + file.write_all(content.as_bytes()).unwrap(); + } } impl Default for PlonkBn254Prover { diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 1d296f94bf..ada8973cea 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -53,6 +53,7 @@ sysinfo = "0.30.13" sp1-core-executor = { workspace = true } sp1-stark = { workspace = true } getrandom = { version = "0.2.15", features = ["custom", "js"] } +itertools = "0.13.0" [features] default = ["network"] diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index da73835c01..e4721a0efa 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -39,7 +39,9 @@ use {std::future::Future, tokio::task::block_in_place}; pub use provers::{CpuProver, MockProver, Prover}; pub use sp1_core_executor::{ExecutionReport, HookEnv, SP1Context, SP1ContextBuilder}; -pub use sp1_core_machine::{io::SP1Stdin, riscv::cost::CostEstimator, SP1_CIRCUIT_VERSION}; +pub use sp1_core_machine::{ + io::SP1PublicValues, io::SP1Stdin, riscv::cost::CostEstimator, SP1_CIRCUIT_VERSION, +}; pub use sp1_prover::{ CoreSC, HashableKey, InnerSC, OuterSC, PlonkBn254Proof, SP1Prover, SP1ProvingKey, SP1VerifyingKey, @@ -291,6 +293,8 @@ pub fn block_on(fut: impl Future) -> T { #[cfg(test)] mod tests { + use sp1_prover::init::SP1PublicValues; + use crate::{utils, CostEstimator, ProverClient, SP1Stdin}; #[test] @@ -327,6 +331,48 @@ mod tests { client.execute(elf, stdin).max_cycles(1).run().unwrap(); } + #[test] + fn test_e2e_core() { + utils::setup_logger(); + let client = ProverClient::local(); + let elf = + include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let (pk, vk) = client.setup(elf); + let mut stdin = SP1Stdin::new(); + stdin.write(&10usize); + + // Generate proof & verify. + let mut proof = client.prove(&pk, stdin).run().unwrap(); + client.verify(&proof, &vk).unwrap(); + + // Test invalid public values. + proof.public_values = SP1PublicValues::from(&[255, 4, 84]); + if client.verify(&proof, &vk).is_ok() { + panic!("verified proof with invalid public values") + } + } + + #[test] + fn test_e2e_compressed() { + utils::setup_logger(); + let client = ProverClient::local(); + let elf = + include_bytes!("../../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); + let (pk, vk) = client.setup(elf); + let mut stdin = SP1Stdin::new(); + stdin.write(&10usize); + + // Generate proof & verify. + let mut proof = client.prove(&pk, stdin).compressed().run().unwrap(); + client.verify(&proof, &vk).unwrap(); + + // Test invalid public values. + proof.public_values = SP1PublicValues::from(&[255, 4, 84]); + if client.verify(&proof, &vk).is_ok() { + panic!("verified proof with invalid public values") + } + } + #[test] fn test_e2e_prove_plonk() { utils::setup_logger(); @@ -336,8 +382,16 @@ mod tests { let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); - let proof = client.prove(&pk, stdin).plonk().run().unwrap(); + + // Generate proof & verify. + let mut proof = client.prove(&pk, stdin).plonk().run().unwrap(); client.verify(&proof, &vk).unwrap(); + + // Test invalid public values. + proof.public_values = SP1PublicValues::from(&[255, 4, 84]); + if client.verify(&proof, &vk).is_ok() { + panic!("verified proof with invalid public values") + } } #[test] diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index faacf41991..936d55fdb8 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -114,14 +114,16 @@ impl NetworkClient { Ok((res, proof)) } - /// Get all the proof requests for a given status. + /// Get all the proof requests for a given status. Also filter by circuit version if provided. pub async fn get_proof_requests( &self, status: ProofStatus, + circuit_version: Option<&str>, ) -> Result { - self.with_error_handling( - self.rpc.get_proof_requests(GetProofRequestsRequest { status: status.into() }), - ) + self.with_error_handling(self.rpc.get_proof_requests(GetProofRequestsRequest { + status: status.into(), + circuit_version: circuit_version.map(|v| v.to_owned()), + })) .await } @@ -131,15 +133,17 @@ impl NetworkClient { elf: &[u8], stdin: &SP1Stdin, mode: ProofMode, - version: &str, + circuit_version: &str, ) -> Result { let start = SystemTime::now(); let since_the_epoch = start.duration_since(UNIX_EPOCH).expect("Invalid start time"); let deadline = since_the_epoch.as_secs() + TIMEOUT.as_secs(); let nonce = self.get_nonce().await?; - let create_proof_signature = - self.auth.sign_create_proof_message(nonce, deadline, mode.into(), version).await?; + let create_proof_signature = self + .auth + .sign_create_proof_message(nonce, deadline, mode.into(), circuit_version) + .await?; let res = self .with_error_handling(self.rpc.create_proof(CreateProofRequest { @@ -147,7 +151,7 @@ impl NetworkClient { nonce, deadline, mode: mode.into(), - version: version.to_string(), + circuit_version: circuit_version.to_string(), })) .await?; diff --git a/crates/sdk/src/network/prover.rs b/crates/sdk/src/network/prover.rs index 0b0759fcca..d7561a123f 100644 --- a/crates/sdk/src/network/prover.rs +++ b/crates/sdk/src/network/prover.rs @@ -61,8 +61,7 @@ impl NetworkProver { log::info!("Skipping simulation"); } - let version = SP1_CIRCUIT_VERSION; - let proof_id = client.create_proof(elf, &stdin, mode, version).await?; + let proof_id = client.create_proof(elf, &stdin, mode, SP1_CIRCUIT_VERSION).await?; log::info!("Created {}", proof_id); if NetworkClient::rpc_url() == DEFAULT_PROVER_NETWORK_RPC { diff --git a/crates/sdk/src/proto/network.rs b/crates/sdk/src/proto/network.rs index 4c3dd84771..a0e0d883e5 100644 --- a/crates/sdk/src/proto/network.rs +++ b/crates/sdk/src/proto/network.rs @@ -16,9 +16,9 @@ pub struct CreateProofRequest { /// The deadline for the proof request, signifying the latest time a fulfillment would be valid. #[prost(uint64, tag = "4")] pub deadline: u64, - /// The client version used, in the form of an 8-character git commit hash. + /// The SP1 circuit version to use for the proof. #[prost(string, tag = "5")] - pub version: ::prost::alloc::string::String, + pub circuit_version: ::prost::alloc::string::String, } /// The response for creating a proof. #[derive(serde::Serialize, serde::Deserialize)] @@ -229,9 +229,12 @@ pub struct GetProofStatusResponse { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct GetProofRequestsRequest { - /// The status of the proof requests to get. + /// The status of the proof requests to filter for. #[prost(enumeration = "ProofStatus", tag = "1")] pub status: i32, + /// The SP1 circuit version of the proof requests to filter for. + #[prost(string, optional, tag = "2")] + pub circuit_version: ::core::option::Option<::prost::alloc::string::String>, } /// A proof request. #[derive(serde::Serialize, serde::Deserialize)] @@ -247,6 +250,9 @@ pub struct RequestedProof { /// Proof requester's address. #[prost(bytes = "vec", tag = "3")] pub requester: ::prost::alloc::vec::Vec, + /// The SP1 circuit version to use for the proof. + #[prost(string, tag = "4")] + pub circuit_version: ::prost::alloc::string::String, } /// The response for getting proof requests by a given status. #[derive(serde::Serialize, serde::Deserialize)] @@ -493,6 +499,7 @@ impl UnclaimReason { } } } +pub use twirp; pub const SERVICE_FQN: &str = "/network.NetworkService"; #[twirp::async_trait::async_trait] pub trait NetworkService { diff --git a/crates/sdk/src/provers/mock.rs b/crates/sdk/src/provers/mock.rs index d4d2467045..b774cd005b 100644 --- a/crates/sdk/src/provers/mock.rs +++ b/crates/sdk/src/provers/mock.rs @@ -97,7 +97,7 @@ impl Prover for MockProver { proof: SP1Proof::Plonk(PlonkBn254Proof { public_inputs: [ pk.vk.hash_bn254().as_canonical_biguint().to_string(), - public_values.hash().to_string(), + public_values.hash_bn254().to_string(), ], encoded_proof: "".to_string(), raw_proof: "".to_string(), @@ -114,7 +114,7 @@ impl Prover for MockProver { proof: SP1Proof::Groth16(Groth16Bn254Proof { public_inputs: [ pk.vk.hash_bn254().as_canonical_biguint().to_string(), - public_values.hash().to_string(), + public_values.hash_bn254().to_string(), ], encoded_proof: "".to_string(), raw_proof: "".to_string(), diff --git a/crates/sdk/src/provers/mod.rs b/crates/sdk/src/provers/mod.rs index 34152d8460..ecc62ff4ce 100644 --- a/crates/sdk/src/provers/mod.rs +++ b/crates/sdk/src/provers/mod.rs @@ -8,6 +8,11 @@ pub use cpu::CpuProver; pub use cuda::CudaProver; pub use mock::MockProver; +use itertools::Itertools; +use p3_field::PrimeField32; +use std::borrow::Borrow; +use std::time::Duration; + use anyhow::Result; use sp1_core_executor::SP1Context; use sp1_core_machine::{io::SP1Stdin, SP1_CIRCUIT_VERSION}; @@ -15,8 +20,7 @@ use sp1_prover::{ components::SP1ProverComponents, CoreSC, InnerSC, SP1CoreProofData, SP1Prover, SP1ProvingKey, SP1ReduceProof, SP1VerifyingKey, }; -use sp1_stark::{MachineVerificationError, SP1ProverOpts}; -use std::time::Duration; +use sp1_stark::{air::PublicValues, MachineVerificationError, SP1ProverOpts, Word}; use strum_macros::EnumString; use thiserror::Error; @@ -44,6 +48,8 @@ pub struct ProofOpts { #[derive(Error, Debug)] pub enum SP1VerificationError { + #[error("Invalid public values")] + InvalidPublicValues, #[error("Version mismatch")] VersionMismatch(String), #[error("Core machine verification error: {0}")] @@ -90,14 +96,53 @@ pub trait Prover: Send + Sync { return Err(SP1VerificationError::VersionMismatch(bundle.sp1_version.clone())); } match &bundle.proof { - SP1Proof::Core(proof) => self - .sp1_prover() - .verify(&SP1CoreProofData(proof.clone()), vkey) - .map_err(SP1VerificationError::Core), - SP1Proof::Compressed(proof) => self - .sp1_prover() - .verify_compressed(&SP1ReduceProof { proof: proof.clone() }, vkey) - .map_err(SP1VerificationError::Recursion), + SP1Proof::Core(proof) => { + let public_values: &PublicValues, _> = + proof.last().unwrap().public_values.as_slice().borrow(); + + // Get the commited value digest bytes. + let commited_value_digest_bytes = public_values + .committed_value_digest + .iter() + .flat_map(|w| w.0.iter().map(|x| x.as_canonical_u32() as u8)) + .collect_vec(); + + // Make sure the commited value digest matches the public values hash. + for (a, b) in commited_value_digest_bytes.iter().zip_eq(bundle.public_values.hash()) + { + if *a != b { + return Err(SP1VerificationError::InvalidPublicValues); + } + } + + // Verify the core proof. + self.sp1_prover() + .verify(&SP1CoreProofData(proof.clone()), vkey) + .map_err(SP1VerificationError::Core) + } + SP1Proof::Compressed(proof) => { + let public_values: &PublicValues, _> = + proof.public_values.as_slice().borrow(); + + // Get the commited value digest bytes. + let commited_value_digest_bytes = public_values + .committed_value_digest + .iter() + .flat_map(|w| w.0.iter().map(|x| x.as_canonical_u32() as u8)) + .collect_vec(); + + // Make sure the commited value digest matches the public values hash. + for (a, b) in commited_value_digest_bytes.iter().zip_eq(bundle.public_values.hash()) + { + if *a != b { + return Err(SP1VerificationError::InvalidPublicValues); + } + } + + self.sp1_prover() + .verify_compressed(&SP1ReduceProof { proof: proof.clone() }, vkey) + .map_err(SP1VerificationError::Recursion) + } SP1Proof::Plonk(proof) => self .sp1_prover() .verify_plonk_bn254( diff --git a/crates/stark/Cargo.toml b/crates/stark/Cargo.toml index e00ab29903..0d5e773441 100644 --- a/crates/stark/Cargo.toml +++ b/crates/stark/Cargo.toml @@ -38,6 +38,7 @@ tracing = "0.1.40" rayon-scan = "0.1.1" arrayref = "0.3.8" getrandom = { version = "0.2.15", features = ["custom"] } +sysinfo = "0.30.13" [dev-dependencies] diff --git a/crates/stark/src/opts.rs b/crates/stark/src/opts.rs index 2c234579ad..db5ced80fa 100644 --- a/crates/stark/src/opts.rs +++ b/crates/stark/src/opts.rs @@ -1,9 +1,10 @@ use std::env; use serde::{Deserialize, Serialize}; +use sysinfo::System; -const DEFAULT_SHARD_SIZE: usize = 1 << 22; -const DEFAULT_SHARD_BATCH_SIZE: usize = 16; +const MAX_SHARD_SIZE: usize = 1 << 22; +const MAX_SHARD_BATCH_SIZE: usize = 8; const DEFAULT_TRACE_GEN_WORKERS: usize = 1; const DEFAULT_CHECKPOINTS_CHANNEL_CAPACITY: usize = 128; const DEFAULT_RECORDS_AND_TRACES_CHANNEL_CAPACITY: usize = 1; @@ -42,19 +43,56 @@ pub struct SP1CoreOpts { pub records_and_traces_channel_capacity: usize, } +/// Calculate the default shard size using an empirically determined formula. +/// +/// For super memory constrained machines, we need to set shard size to 2^18. +/// Otherwise, we use a linear formula derived from experimental results. +/// The data comes from benchmarking the maximum physical memory usage +/// of [rsp](https://github.com/succinctlabs/rsp) on a variety of shard sizes and +/// shard batch sizes, and performing linear regression on the results. +#[allow(clippy::cast_precision_loss)] +fn shard_size(total_available_mem: u64) -> usize { + let log_shard_size = match total_available_mem { + 0..=14 => 18, + m => (((m as f64).log2() * 0.619) + 17.2).floor() as usize, + }; + std::cmp::min(1 << log_shard_size, MAX_SHARD_SIZE) +} + +/// Calculate the default shard batch size using an empirically determined formula. +/// +/// For memory constrained machines, we need to set shard batch size to either 1 or 2. +/// For machines with a very large amount of memory, we can use batch size 8. Empirically, +/// going above 8 doesn't result in a significant speedup. +/// For most machines, we can just use batch size 4. +fn shard_batch_size(total_available_mem: u64) -> usize { + match total_available_mem { + 0..=16 => 1, + 17..=48 => 2, + 256.. => MAX_SHARD_BATCH_SIZE, + _ => 4, + } +} + impl Default for SP1CoreOpts { fn default() -> Self { let split_threshold = env::var("SPLIT_THRESHOLD") .map(|s| s.parse::().unwrap_or(DEFERRED_SPLIT_THRESHOLD)) .unwrap_or(DEFERRED_SPLIT_THRESHOLD); + + let sys = System::new_all(); + let total_available_mem = sys.total_memory() / (1024 * 1024 * 1024); + let default_shard_size = shard_size(total_available_mem); + let default_shard_batch_size = shard_batch_size(total_available_mem); + Self { shard_size: env::var("SHARD_SIZE").map_or_else( - |_| DEFAULT_SHARD_SIZE, - |s| s.parse::().unwrap_or(DEFAULT_SHARD_SIZE), + |_| default_shard_size, + |s| s.parse::().unwrap_or(default_shard_size), ), shard_batch_size: env::var("SHARD_BATCH_SIZE").map_or_else( - |_| DEFAULT_SHARD_BATCH_SIZE, - |s| s.parse::().unwrap_or(DEFAULT_SHARD_BATCH_SIZE), + |_| default_shard_batch_size, + |s| s.parse::().unwrap_or(default_shard_batch_size), ), split_opts: SplitOpts::new(split_threshold), reconstruct_commitments: true, @@ -81,7 +119,9 @@ impl SP1CoreOpts { pub fn recursion() -> Self { let mut opts = Self::default(); opts.reconstruct_commitments = false; - opts.shard_size = DEFAULT_SHARD_SIZE; + + // Recursion only supports 1 << 22 shard size. + opts.shard_size = MAX_SHARD_SIZE; opts } } diff --git a/examples/Cargo.lock b/examples/Cargo.lock index ef7a4b5410..ac3fe60b6d 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -86,105 +86,6 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "alloy-chains" -version = "0.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07629a5d0645d29f68d2fb6f4d0cf15c89ec0965be915f303967180929743f" -dependencies = [ - "alloy-rlp", - "num_enum 0.7.3", - "serde", - "strum", -] - -[[package]] -name = "alloy-consensus" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c309895995eaa4bfcc345f5515a39c7df9447798645cc8bf462b6c5bf1dc96" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "c-kzg", - "serde", -] - -[[package]] -name = "alloy-eips" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9431c99a3b3fe606ede4b3d4043bdfbcb780c45b8d8d226c3804e2b75cfbe68" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "c-kzg", - "k256", - "once_cell", - "serde", - "sha2 0.10.8", -] - -[[package]] -name = "alloy-genesis" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79614dfe86144328da11098edcc7bc1a3f25ad8d3134a9eb9e857e06f0d9840d" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", -] - -[[package]] -name = "alloy-json-rpc" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57e2865c4c3bb4cdad3f0d9ec1ab5c0c657ba69a375651bd35e32fb6c180ccc2" -dependencies = [ - "alloy-primitives", - "alloy-sol-types", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "alloy-network" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e701fc87ef9a3139154b0b4ccb935b565d27ffd9de020fe541bf2dec5ae4ede" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-json-rpc", - "alloy-network-primitives", - "alloy-primitives", - "alloy-rpc-types-eth", - "alloy-serde", - "alloy-signer", - "alloy-sol-types", - "async-trait", - "auto_impl", - "futures-utils-wasm", - "thiserror", -] - -[[package]] -name = "alloy-network-primitives" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec9d5a0f9170b10988b6774498a022845e13eda94318440d17709d50687f67f9" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", -] - [[package]] name = "alloy-primitives" version = "0.7.7" @@ -196,7 +97,6 @@ dependencies = [ "cfg-if", "const-hex", "derive_more", - "getrandom", "hex-literal", "itoa", "k256", @@ -208,137 +108,16 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-provider" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9c0ab10b93de601a6396fc7ff2ea10d3b28c46f079338fa562107ebf9857c8" -dependencies = [ - "alloy-chains", - "alloy-consensus", - "alloy-eips", - "alloy-json-rpc", - "alloy-network", - "alloy-network-primitives", - "alloy-primitives", - "alloy-rpc-client", - "alloy-rpc-types-eth", - "alloy-transport", - "alloy-transport-http", - "async-stream", - "async-trait", - "auto_impl", - "dashmap", - "futures", - "futures-utils-wasm", - "lru", - "pin-project", - "reqwest 0.12.7", - "serde", - "serde_json", - "tokio", - "tracing", - "url", -] - [[package]] name = "alloy-rlp" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ - "alloy-rlp-derive", "arrayvec", "bytes", ] -[[package]] -name = "alloy-rlp-derive" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "alloy-rpc-client" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b38e3ffdb285df5d9f60cb988d336d9b8e3505acb78750c3bc60336a7af41d3" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "alloy-transport-http", - "futures", - "pin-project", - "reqwest 0.12.7", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-rpc-types" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c31a3750b8f5a350d17354e46a52b0f2f19ec5f2006d816935af599dedc521" -dependencies = [ - "alloy-rpc-types-eth", - "alloy-serde", - "serde", -] - -[[package]] -name = "alloy-rpc-types-eth" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81e18424d962d7700a882fe423714bd5b9dde74c7a7589d4255ea64068773aef" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-network-primitives", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "alloy-sol-types", - "itertools 0.13.0", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-serde" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33feda6a53e6079895aed1d08dcb98a1377b000d80d16370fbbdb8155d547ef" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-signer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740a25b92e849ed7b0fa013951fe2f64be9af1ad5abe805037b44fb7770c5c47" -dependencies = [ - "alloy-primitives", - "async-trait", - "auto_impl", - "elliptic-curve", - "k256", - "thiserror", -] - [[package]] name = "alloy-sol-macro" version = "0.7.7" @@ -398,56 +177,6 @@ dependencies = [ "serde", ] -[[package]] -name = "alloy-transport" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0590afbdacf2f8cca49d025a2466f3b6584a016a8b28f532f29f8da1007bae" -dependencies = [ - "alloy-json-rpc", - "base64 0.22.1", - "futures-util", - "futures-utils-wasm", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-transport-http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2437d145d80ea1aecde8574d2058cceb8b3c9cba05f6aea8e67907c660d46698" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "reqwest 0.12.7", - "serde_json", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-trie" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03704f265cbbb943b117ecb5055fd46e8f41e7dc8a58b1aed20bcd40ace38c15" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "derive_more", - "hashbrown 0.14.5", - "nybbles", - "serde", - "smallvec", - "tracing", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -663,28 +392,6 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "async-trait" version = "0.1.81" @@ -713,16 +420,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "aurora-engine-modexp" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aef7712851e524f35fbbb74fa6599c5cd8692056a1c36f9ca0d2001b670e7e5" -dependencies = [ - "hex", - "num", -] - [[package]] name = "auto_impl" version = "1.2.0" @@ -905,9 +602,6 @@ name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -dependencies = [ - "serde", -] [[package]] name = "bitvec" @@ -917,7 +611,6 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", - "serde", "tap", "wyz", ] @@ -982,36 +675,11 @@ checksum = "a3c196a77437e7cc2fb515ce413a6401291578b5afc8ecb29a3c7ab957f05941" dependencies = [ "ff 0.12.1", "group 0.12.1", - "pairing 0.22.0", - "rand_core", - "subtle", -] - -[[package]] -name = "bls12_381" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc6d6292be3a19e6379786dac800f551e5865a5bb51ebbe3064ab80433f403" -dependencies = [ - "ff 0.13.0", - "group 0.13.0", - "pairing 0.23.0", + "pairing", "rand_core", "subtle", ] -[[package]] -name = "blst" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" -dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", -] - [[package]] name = "bs58" version = "0.5.1" @@ -1055,21 +723,6 @@ dependencies = [ "serde", ] -[[package]] -name = "c-kzg" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "once_cell", - "serde", -] - [[package]] name = "camino" version = "1.1.9" @@ -1330,15 +983,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -1364,21 +1008,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1442,27 +1071,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "csv" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" -dependencies = [ - "memchr", -] - [[package]] name = "ctr" version = "0.9.2" @@ -1564,19 +1172,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "dashu" version = "0.4.2" @@ -1703,7 +1298,7 @@ version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ - "convert_case 0.4.0", + "convert_case", "proc-macro2", "quote", "rustc_version 0.4.0", @@ -1752,12 +1347,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "dotenv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" - [[package]] name = "downcast-rs" version = "1.2.1" @@ -1770,12 +1359,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - [[package]] name = "ecdsa" version = "0.16.9" @@ -1890,26 +1473,20 @@ dependencies = [ ] [[package]] -name = "enr" -version = "0.12.1" +name = "enum-map" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "972070166c68827e64bd1ebc8159dd8e32d9bc2da7ebe8f20b61308f7974ad30" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ - "alloy-rlp", - "base64 0.21.7", - "bytes", - "hex", - "log", - "rand", - "sha3", - "zeroize", + "enum-map-derive", + "serde", ] [[package]] -name = "enumn" -version = "0.1.14" +name = "enum-map-derive" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", @@ -2152,7 +1729,7 @@ dependencies = [ "base64 0.21.7", "bytes", "const-hex", - "enr 0.10.0", + "enr", "ethers-core", "futures-core", "futures-timer", @@ -2445,12 +2022,6 @@ dependencies = [ "slab", ] -[[package]] -name = "futures-utils-wasm" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" - [[package]] name = "fxhash" version = "0.2.1" @@ -2670,9 +2241,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-literal" @@ -3125,7 +2693,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a575df5f985fe1cd5b2b05664ff6accfc46559032b954529fd225a2168d27b0f" dependencies = [ "bitvec", - "bls12_381 0.7.1", + "bls12_381", "ff 0.12.1", "group 0.12.1", "rand_core", @@ -3165,21 +2733,6 @@ dependencies = [ "sha3-asm", ] -[[package]] -name = "kzg-rs" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9920cd4460ce3cbca19c62f3bb9a9611562478a4dc9d2c556f4a7d049c5b6b" -dependencies = [ - "bls12_381 0.8.0", - "glob", - "hex", - "once_cell", - "serde", - "serde_derive", - "serde_yaml", -] - [[package]] name = "lazy_static" version = "1.5.0" @@ -3280,15 +2833,6 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -[[package]] -name = "lru" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "matchers" version = "0.1.0" @@ -3316,16 +2860,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" -[[package]] -name = "metrics" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884adb57038347dfbaf2d5065887b6cf4312330dc8e94bc30a1a839bd79d3261" -dependencies = [ - "ahash", - "portable-atomic", -] - [[package]] name = "mime" version = "0.3.17" @@ -3359,27 +2893,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "modular-bitfield" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" -dependencies = [ - "modular-bitfield-impl", - "static_assertions", -] - -[[package]] -name = "modular-bitfield-impl" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "native-tls" version = "0.2.12" @@ -3645,19 +3158,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -[[package]] -name = "nybbles" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f06be0417d97f81fe4e5c86d7d01b392655a9cac9c19a848aa033e18937b23" -dependencies = [ - "alloy-rlp", - "const-hex", - "proptest", - "serde", - "smallvec", -] - [[package]] name = "object" version = "0.36.3" @@ -3679,36 +3179,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" -[[package]] -name = "op-alloy-consensus" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e41c4537e76555df708c8372ec2c4254da9631eb129c2530f2baea00d645b422" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "derive_more", - "serde", -] - -[[package]] -name = "op-alloy-rpc-types" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9978c3d449abb03526d378988ae6d51b049ef36205cc97bf284574df9f578021" -dependencies = [ - "alloy-network", - "alloy-primitives", - "alloy-rpc-types-eth", - "alloy-serde", - "op-alloy-consensus", - "serde", - "serde_json", -] - [[package]] name = "opaque-debug" version = "0.3.1" @@ -3796,18 +3266,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2 0.10.8", -] - [[package]] name = "p3-air" version = "0.1.3-succinct" @@ -4088,15 +3546,6 @@ dependencies = [ "group 0.12.1", ] -[[package]] -name = "pairing" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" -dependencies = [ - "group 0.13.0", -] - [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -4106,7 +3555,6 @@ dependencies = [ "arrayvec", "bitvec", "byte-slice-cast", - "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive", "serde", @@ -4370,15 +3818,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "primitive-types" version = "0.12.2" @@ -4748,574 +4187,76 @@ dependencies = [ "tokio", "tokio-native-tls", "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "reqwest" -version = "0.12.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" -dependencies = [ - "base64 0.22.1", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2 0.4.6", - "http 1.1.0", - "http-body 1.0.1", - "http-body-util", - "hyper 1.4.1", - "hyper-rustls", - "hyper-tls 0.6.0", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pemfile 2.1.3", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 1.0.1", - "system-configuration 0.6.0", - "tokio", - "tokio-native-tls", - "tokio-rustls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "webpki-roots", - "windows-registry", -] - -[[package]] -name = "reqwest-middleware" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" -dependencies = [ - "anyhow", - "async-trait", - "http 1.1.0", - "reqwest 0.12.7", - "serde", - "thiserror", - "tower-service", -] - -[[package]] -name = "reth-blockchain-tree-api" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-consensus", - "reth-execution-errors", - "reth-primitives", - "reth-storage-errors", - "thiserror", -] - -[[package]] -name = "reth-chainspec" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-chains", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-trie", - "auto_impl", - "derive_more", - "once_cell", - "op-alloy-rpc-types", - "reth-ethereum-forks", - "reth-network-peers", - "reth-primitives-traits", - "reth-trie-common", - "serde", - "serde_json", -] - -[[package]] -name = "reth-codecs" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-trie", - "bytes", - "modular-bitfield", - "reth-codecs-derive", - "serde", -] - -[[package]] -name = "reth-codecs-derive" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "convert_case 0.6.0", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "reth-consensus" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "auto_impl", - "reth-primitives", - "thiserror-no-std", -] - -[[package]] -name = "reth-consensus-common" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-chainspec", - "reth-consensus", - "reth-primitives", -] - -[[package]] -name = "reth-db-api" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "bytes", - "derive_more", - "metrics", - "modular-bitfield", - "parity-scale-codec", - "reth-codecs", - "reth-primitives", - "reth-primitives-traits", - "reth-prune-types", - "reth-stages-types", - "reth-storage-errors", - "reth-trie-common", - "serde", -] - -[[package]] -name = "reth-errors" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-blockchain-tree-api", - "reth-consensus", - "reth-execution-errors", - "reth-fs-util", - "reth-storage-errors", - "thiserror", -] - -[[package]] -name = "reth-ethereum-consensus" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-chainspec", - "reth-consensus", - "reth-consensus-common", - "reth-primitives", - "tracing", -] - -[[package]] -name = "reth-ethereum-forks" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-chains", - "alloy-primitives", - "alloy-rlp", - "auto_impl", - "crc", - "dyn-clone", - "once_cell", - "rustc-hash 2.0.0", - "serde", - "thiserror-no-std", -] - -[[package]] -name = "reth-evm" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-eips", - "auto_impl", - "futures-util", - "reth-chainspec", - "reth-execution-errors", - "reth-execution-types", - "reth-primitives", - "reth-prune-types", - "reth-storage-errors", - "revm", - "revm-primitives", -] - -[[package]] -name = "reth-evm-ethereum" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-eips", - "alloy-sol-types", - "reth-chainspec", - "reth-ethereum-consensus", - "reth-ethereum-forks", - "reth-evm", - "reth-execution-types", - "reth-primitives", - "reth-prune-types", - "reth-revm", - "revm-primitives", -] - -[[package]] -name = "reth-evm-optimism" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-chainspec", - "reth-ethereum-forks", - "reth-evm", - "reth-execution-errors", - "reth-execution-types", - "reth-optimism-consensus", - "reth-primitives", - "reth-prune-types", - "reth-revm", - "revm", - "revm-primitives", - "thiserror", - "tracing", -] - -[[package]] -name = "reth-execution-errors" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "nybbles", - "reth-consensus", - "reth-prune-types", - "reth-storage-errors", - "revm-primitives", - "thiserror-no-std", -] - -[[package]] -name = "reth-execution-types" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-chainspec", - "reth-execution-errors", - "reth-primitives", - "reth-trie", - "revm", -] - -[[package]] -name = "reth-fs-util" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "reth-network-peers" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "enr 0.12.1", - "serde_with", - "thiserror", - "url", -] - -[[package]] -name = "reth-optimism-consensus" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "reth-chainspec", - "reth-consensus", - "reth-consensus-common", - "reth-primitives", - "tracing", -] - -[[package]] -name = "reth-primitives" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types", - "bytes", - "derive_more", - "k256", - "once_cell", - "rayon", - "reth-chainspec", - "reth-ethereum-forks", - "reth-primitives-traits", - "reth-static-file-types", - "reth-trie-common", - "revm-primitives", - "secp256k1", - "serde", - "thiserror", -] - -[[package]] -name = "reth-primitives-traits" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types-eth", - "byteorder", - "bytes", - "derive_more", - "modular-bitfield", - "reth-codecs", - "revm-primitives", - "roaring", - "serde", -] - -[[package]] -name = "reth-prune-types" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-primitives", - "bytes", - "derive_more", - "modular-bitfield", - "reth-codecs", - "serde", - "thiserror", -] - -[[package]] -name = "reth-revm" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-eips", - "reth-chainspec", - "reth-consensus-common", - "reth-execution-errors", - "reth-primitives", - "reth-prune-types", - "reth-storage-api", - "reth-storage-errors", - "revm", -] - -[[package]] -name = "reth-stages-types" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-primitives", - "bytes", - "modular-bitfield", - "reth-codecs", - "reth-trie-common", - "serde", -] - -[[package]] -name = "reth-static-file-types" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-primitives", - "derive_more", - "serde", - "strum", -] - -[[package]] -name = "reth-storage-api" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "auto_impl", - "reth-chainspec", - "reth-db-api", - "reth-execution-types", - "reth-primitives", - "reth-prune-types", - "reth-stages-types", - "reth-storage-errors", - "reth-trie", - "revm", -] - -[[package]] -name = "reth-storage-errors" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-rlp", - "reth-fs-util", - "reth-primitives", - "thiserror-no-std", -] - -[[package]] -name = "reth-trie" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-rlp", - "auto_impl", - "derive_more", - "itertools 0.13.0", - "rayon", - "reth-execution-errors", - "reth-primitives", - "reth-stages-types", - "reth-storage-errors", - "reth-trie-common", - "revm", - "tracing", -] - -[[package]] -name = "reth-trie-common" -version = "1.0.4" -source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240827#ea242fbb1d70f37b016a37a9a6d28b0b4bd7f25c" -dependencies = [ - "alloy-consensus", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-trie", - "bytes", - "derive_more", - "itertools 0.13.0", - "nybbles", - "reth-codecs", - "reth-primitives-traits", - "revm-primitives", - "serde", -] - -[[package]] -name = "revm" -version = "12.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6cfb48bce8ca2113e157bdbddbd5eeb09daac1c903d79ec17085897c38c7c91" -dependencies = [ - "auto_impl", - "cfg-if", - "dyn-clone", - "revm-interpreter", - "revm-precompile", - "serde", - "serde_json", -] - -[[package]] -name = "revm-interpreter" -version = "8.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b0daddea06fc6da5346acc39b32a357bbe3579e9e3d94117d9ae125cd596fc" -dependencies = [ - "revm-primitives", - "serde", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", ] [[package]] -name = "revm-precompile" -version = "9.2.0" +name = "reqwest" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef55228211251d7b6c7707c3ee13bb70dea4d2fd81ec4034521e4fe31010b2ea" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ - "aurora-engine-modexp", - "c-kzg", - "cfg-if", - "k256", - "kzg-rs", + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", + "hyper-rustls", + "hyper-tls 0.6.0", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", "once_cell", - "p256", - "revm-primitives", - "ripemd", - "secp256k1", - "sha2 0.10.8", - "substrate-bn", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile 2.1.3", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "system-configuration 0.6.0", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", + "windows-registry", ] [[package]] -name = "revm-primitives" -version = "7.1.0" +name = "reqwest-middleware" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc4311037ee093ec50ec734e1424fcb3e12d535c6cef683b75d1c064639630c" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ - "alloy-eips", - "alloy-primitives", - "auto_impl", - "bitflags 2.6.0", - "bitvec", - "c-kzg", - "cfg-if", - "derive_more", - "dyn-clone", - "enumn", - "hashbrown 0.14.5", - "hex", - "kzg-rs", - "once_cell", + "anyhow", + "async-trait", + "http 1.1.0", + "reqwest 0.12.7", "serde", + "thiserror", + "tower-service", ] [[package]] @@ -5389,16 +4330,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "roaring" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4b84ba6e838ceb47b41de5194a60244fac43d9fe03b71dbe8c5a201081d6d1" -dependencies = [ - "bytemuck", - "byteorder", -] - [[package]] name = "rrs-succinct" version = "0.1.0" @@ -5439,164 +4370,6 @@ dependencies = [ "sp1-sdk", ] -[[package]] -name = "rsp-client-executor" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "eyre", - "futures", - "itertools 0.13.0", - "reth-chainspec", - "reth-errors", - "reth-ethereum-consensus", - "reth-evm", - "reth-evm-ethereum", - "reth-evm-optimism", - "reth-execution-types", - "reth-optimism-consensus", - "reth-primitives", - "reth-revm", - "reth-storage-errors", - "reth-trie", - "revm", - "revm-primitives", - "rsp-mpt", - "rsp-primitives", - "rsp-witness-db", - "serde", - "serde_json", - "tokio", - "url", -] - -[[package]] -name = "rsp-host-executor" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "alloy-primitives", - "alloy-provider", - "alloy-rlp", - "alloy-rpc-types", - "alloy-transport", - "eyre", - "futures", - "itertools 0.13.0", - "reth-chainspec", - "reth-codecs", - "reth-errors", - "reth-execution-types", - "reth-primitives", - "reth-storage-errors", - "reth-trie", - "revm", - "revm-primitives", - "rsp-client-executor", - "rsp-mpt", - "rsp-primitives", - "rsp-rpc-db", - "rsp-witness-db", - "serde", - "serde_json", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "rsp-mpt" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "alloy-rpc-types", - "eyre", - "itertools 0.13.0", - "reth-execution-types", - "reth-primitives", - "reth-trie", - "revm-primitives", - "rsp-primitives", -] - -[[package]] -name = "rsp-primitives" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "alloy-rpc-types", - "eyre", - "op-alloy-rpc-types", - "reth-chainspec", - "reth-primitives", - "reth-revm", - "reth-trie", - "revm-primitives", - "serde", - "serde_json", - "tracing", -] - -[[package]] -name = "rsp-rpc-db" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "alloy-provider", - "alloy-rlp", - "alloy-rpc-types", - "alloy-transport", - "futures", - "rayon", - "reth-primitives", - "reth-revm", - "reth-storage-errors", - "reth-trie", - "revm-primitives", - "rsp-primitives", - "rsp-witness-db", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "rsp-script" -version = "0.1.0" -dependencies = [ - "alloy-provider", - "bincode", - "clap", - "csv", - "dotenv", - "eyre", - "rsp-client-executor", - "rsp-host-executor", - "serde", - "serde_json", - "sp1-build", - "sp1-sdk", - "tokio", - "tracing-subscriber", - "url", -] - -[[package]] -name = "rsp-witness-db" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/rsp/?rev=792efd0#792efd0de060df17cb27c3a11c4e29c3ad41e699" -dependencies = [ - "reth-primitives", - "reth-storage-errors", - "revm-primitives", - "rsp-primitives", - "serde", -] - [[package]] name = "ruint" version = "1.12.3" @@ -5854,25 +4627,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0cc0f1cf93f4969faf3ea1c7d8a9faed25918d96affa959720823dfe86d4f3" -dependencies = [ - "rand", - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1433bd67156263443f14d603720b082dd3121779323fce20cba2aa07b874bc1b" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.11.1" @@ -5980,7 +4734,6 @@ version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ - "indexmap 2.4.0", "itoa", "memchr", "ryu", @@ -6059,19 +4812,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap 2.4.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "serial_test" version = "3.1.1" @@ -6207,9 +4947,6 @@ name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -dependencies = [ - "serde", -] [[package]] name = "snowbridge-amcl" @@ -6233,7 +4970,7 @@ dependencies = [ [[package]] name = "sp1-build" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "cargo_metadata", @@ -6244,11 +4981,12 @@ dependencies = [ [[package]] name = "sp1-core-executor" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "bytemuck", "elf", + "enum-map", "eyre", "generic-array 1.1.0", "hashbrown 0.14.5", @@ -6274,11 +5012,12 @@ dependencies = [ "tiny-keccak", "tracing", "typenum", + "vec_map", ] [[package]] name = "sp1-core-machine" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "arrayref", @@ -6342,7 +5081,7 @@ dependencies = [ [[package]] name = "sp1-cuda" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "ctrlc", @@ -6361,7 +5100,7 @@ dependencies = [ [[package]] name = "sp1-curves" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "curve25519-dalek", "dashu", @@ -6380,7 +5119,7 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "proc-macro2", "quote", @@ -6389,7 +5128,7 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -6401,7 +5140,7 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -6439,7 +5178,7 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "itertools 0.13.0", @@ -6462,7 +5201,7 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "backtrace", "itertools 0.13.0", @@ -6490,7 +5229,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "backtrace", @@ -6526,7 +5265,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core-v2" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "backtrace", @@ -6565,7 +5304,7 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "proc-macro2", "quote", @@ -6574,7 +5313,7 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -6599,7 +5338,7 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "itertools 0.13.0", "p3-air", @@ -6629,7 +5368,7 @@ dependencies = [ [[package]] name = "sp1-sdk" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "alloy-sol-types", "anyhow", @@ -6674,7 +5413,7 @@ dependencies = [ [[package]] name = "sp1-stark" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "getrandom", @@ -6698,6 +5437,7 @@ dependencies = [ "serde", "sp1-derive", "sp1-primitives", + "sysinfo", "tracing", ] @@ -6788,19 +5528,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "substrate-bn" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c" -dependencies = [ - "byteorder", - "crunchy", - "lazy_static", - "rand", - "rustc-hex", -] - [[package]] name = "subtle" version = "2.6.1" @@ -7046,26 +5773,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - [[package]] name = "thread_local" version = "1.1.8" @@ -7076,15 +5783,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.3.36" @@ -7192,18 +5890,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", - "tokio-util", -] - [[package]] name = "tokio-util" version = "0.7.11" @@ -7466,12 +6152,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - [[package]] name = "unicode-width" version = "0.1.13" @@ -7484,12 +6164,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - [[package]] name = "untrusted" version = "0.7.1" @@ -7546,6 +6220,9 @@ name = "vec_map" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +dependencies = [ + "serde", +] [[package]] name = "vergen" @@ -8056,7 +6733,7 @@ dependencies = [ "ark-std 0.4.0", "bitvec", "blake2", - "bls12_381 0.7.1", + "bls12_381", "byteorder", "cfg-if", "group 0.12.1", diff --git a/examples/fibonacci/program/Cargo.lock b/examples/fibonacci/program/Cargo.lock index c3079154b8..bf06ad227b 100644 --- a/examples/fibonacci/program/Cargo.lock +++ b/examples/fibonacci/program/Cargo.lock @@ -335,7 +335,7 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "1.2.0-rc1" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -347,7 +347,7 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.2.0-rc1" +version = "1.2.0" dependencies = [ "bincode", "cfg-if", diff --git a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf b/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf index 41b281e4ae..017feaa1a2 100755 Binary files a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf and b/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/fibonacci/script/Cargo.toml b/examples/fibonacci/script/Cargo.toml index e8b0ebeeba..c6c510ba40 100644 --- a/examples/fibonacci/script/Cargo.toml +++ b/examples/fibonacci/script/Cargo.toml @@ -14,8 +14,8 @@ sha2 = "0.10.8" sp1-build = { workspace = true } [[bin]] -name = "plonk_bn254" -path = "bin/plonk_bn254.rs" +name = "groth16_bn254" +path = "bin/groth16_bn254.rs" [[bin]] name = "compressed" diff --git a/examples/fibonacci/script/bin/plonk_bn254.rs b/examples/fibonacci/script/bin/groth16_bn254.rs similarity index 86% rename from examples/fibonacci/script/bin/plonk_bn254.rs rename to examples/fibonacci/script/bin/groth16_bn254.rs index ee09e43b1c..2e25c7e724 100644 --- a/examples/fibonacci/script/bin/plonk_bn254.rs +++ b/examples/fibonacci/script/bin/groth16_bn254.rs @@ -16,7 +16,7 @@ fn main() { // Generate the proof for the given program and input. let client = ProverClient::new(); let (pk, vk) = client.setup(ELF); - let proof = client.prove(&pk, stdin).plonk().run().unwrap(); + let proof = client.prove(&pk, stdin).groth16().run().unwrap(); println!("generated proof"); @@ -32,9 +32,7 @@ fn main() { client.verify(&proof, &vk).expect("verification failed"); // Save the proof. - proof - .save("proof-with-pis.bin") - .expect("saving proof failed"); + proof.save("proof-with-pis.bin").expect("saving proof failed"); println!("successfully generated and verified proof for the program!") } diff --git a/examples/patch-testing/script/src/main.rs b/examples/patch-testing/script/src/main.rs index b3bbcb677f..45f97198ff 100644 --- a/examples/patch-testing/script/src/main.rs +++ b/examples/patch-testing/script/src/main.rs @@ -12,43 +12,25 @@ fn main() { let (_, report) = client.execute(PATCH_TEST_ELF, stdin).run().expect("executing failed"); // Confirm there was at least 1 SHA_COMPUTE syscall. - assert!( - report.syscall_counts.contains_key(&sp1_core_executor::syscalls::SyscallCode::SHA_COMPRESS) - ); - assert!( - report.syscall_counts.contains_key(&sp1_core_executor::syscalls::SyscallCode::SHA_EXTEND) - ); + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SHA_COMPRESS], 0); + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SHA_EXTEND], 0); // Confirm there was at least 1 of each ED25519 syscall. - assert!(report.syscall_counts.contains_key(&sp1_core_executor::syscalls::SyscallCode::ED_ADD)); - assert!( - report - .syscall_counts - .contains_key(&sp1_core_executor::syscalls::SyscallCode::ED_DECOMPRESS) - ); + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::ED_ADD], 0); + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::ED_DECOMPRESS], 0); // Confirm there was at least 1 KECCAK_PERMUTE syscall. - assert!( - report - .syscall_counts - .contains_key(&sp1_core_executor::syscalls::SyscallCode::KECCAK_PERMUTE) - ); + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::KECCAK_PERMUTE], 0); // Confirm there was at least 1 SECP256K1_ADD, SECP256K1_DOUBLE and SECP256K1_DECOMPRESS syscall. - assert!( - report - .syscall_counts - .contains_key(&sp1_core_executor::syscalls::SyscallCode::SECP256K1_ADD) - ); - assert!( - report - .syscall_counts - .contains_key(&sp1_core_executor::syscalls::SyscallCode::SECP256K1_DOUBLE) + assert_ne!(report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SECP256K1_ADD], 0); + assert_ne!( + report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SECP256K1_DOUBLE], + 0 ); - assert!( - report - .syscall_counts - .contains_key(&sp1_core_executor::syscalls::SyscallCode::SECP256K1_DECOMPRESS) + assert_ne!( + report.syscall_counts[sp1_core_executor::syscalls::SyscallCode::SECP256K1_DECOMPRESS], + 0 ); println!("Total instructions: {:?}", report.total_instruction_count()); diff --git a/examples/rsa/program/Cargo.lock b/examples/rsa/program/Cargo.lock index 4cbf5f0f88..c5fdebb49f 100644 --- a/examples/rsa/program/Cargo.lock +++ b/examples/rsa/program/Cargo.lock @@ -35,15 +35,6 @@ dependencies = [ "serde", ] -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - [[package]] name = "block-buffer" version = "0.10.4" @@ -73,9 +64,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cpufeatures" @@ -86,16 +77,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crypto-bigint" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -108,13 +89,13 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", - "crypto-bigint", "pem-rfc7468", + "zeroize", ] [[package]] @@ -128,22 +109,14 @@ dependencies = [ "syn 2.0.60", ] -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", + "const-oid", "crypto-common", ] @@ -287,12 +260,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "parity-scale-codec" version = "3.6.12" @@ -319,33 +286,32 @@ dependencies = [ [[package]] name = "pem-rfc7468" -version = "0.3.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ "base64ct", ] [[package]] name = "pkcs1" -version = "0.3.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" dependencies = [ "der", "pkcs8", - "zeroize", + "spki", ] [[package]] name = "pkcs8" -version = "0.8.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", - "zeroize", ] [[package]] @@ -413,20 +379,19 @@ dependencies = [ [[package]] name = "rsa" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" +version = "0.9.6" dependencies = [ - "byteorder", - "digest 0.10.7", + "const-oid", + "digest", "num-bigint-dig", "num-integer", - "num-iter", "num-traits", "pkcs1", "pkcs8", "rand_core", - "smallvec", + "signature", + "sp1-derive", + "spki", "subtle", "zeroize", ] @@ -435,10 +400,10 @@ dependencies = [ name = "rsa-program" version = "1.1.0" dependencies = [ - "digest 0.10.7", + "digest", "rand", "rsa", - "sha2 0.9.8", + "sha2", "sp1-zkvm", ] @@ -488,25 +453,22 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.8" -source = "git+https://github.com/succinctbot/RustCrypto-hashes.git?branch=v0.9.8#0b578688db61bb53e15353f5beaa2c11ad93f037" +version = "0.10.8" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?branch=patch-sha2-v0.10.8#1f224388fdede7cef649bce0d63876d1a9e3f515" dependencies = [ - "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest 0.9.0", - "opaque-debug", + "digest", ] [[package]] -name = "sha2" -version = "0.10.8" +name = "signature" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", + "digest", + "rand_core", ] [[package]] @@ -525,9 +487,20 @@ dependencies = [ "scale-info", ] +[[package]] +name = "sp1-derive" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d06fdae1dc74a9085b155d12180825653e530983262b8ad2e57fe15551d17a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "sp1-lib" -version = "1.1.1" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -539,7 +512,7 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.1.1" +version = "1.2.0" dependencies = [ "bincode", "cfg-if", @@ -549,7 +522,7 @@ dependencies = [ "once_cell", "rand", "serde", - "sha2 0.10.8", + "sha2", "sp1-lib", ] @@ -561,9 +534,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.5.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -649,6 +622,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/examples/rsa/program/Cargo.toml b/examples/rsa/program/Cargo.toml index 9a9db9e814..2d54b00181 100644 --- a/examples/rsa/program/Cargo.toml +++ b/examples/rsa/program/Cargo.toml @@ -9,9 +9,10 @@ publish = false sp1-zkvm = { path = "../../../crates/zkvm/entrypoint" } digest = "0.10.7" rand = "0.8.5" -rsa = "0.6" # Check for the latest version -sha2 = "0.9.8" # Check for the latest version +rsa = "0.9.6" # Check for the latest version +sha2 = {version = "0.10.8",package = "sha2", features = ["oid"]} # Check for the latest version [patch.crates-io] # Patch sha2 so we can use sha precompiles -sha2 = { git = "https://github.com/succinctbot/RustCrypto-hashes.git", package = "sha2", branch = "v0.9.8" } +sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8"} + diff --git a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf b/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf index 2ab2c15058..3fde9f4d1d 100755 Binary files a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf and b/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/rsa/program/src/main.rs b/examples/rsa/program/src/main.rs index 67c21cd146..b1326eb778 100644 --- a/examples/rsa/program/src/main.rs +++ b/examples/rsa/program/src/main.rs @@ -1,11 +1,9 @@ #![no_main] sp1_zkvm::entrypoint!(main); -use rsa::PaddingScheme; -use rsa::PublicKey; +use rsa::Pkcs1v15Sign; use rsa::{pkcs8::DecodePublicKey, RsaPublicKey}; -use sha2::Digest; -use sha2::Sha256; +use sha2::{Digest, Sha256}; // Ensure this is imported for the Digest trait to work pub fn main() { // Read an input to the program. @@ -21,8 +19,7 @@ pub fn main() { hasher.update(message); let hashed_msg = hasher.finalize(); - let padding = PaddingScheme::new_pkcs1v15_sign(Some(rsa::hash::Hash::SHA2_256)); - let verification = public_key.verify(padding, &hashed_msg, &signature); + let verification = public_key.verify(Pkcs1v15Sign::new::(), &hashed_msg, &signature); let verified = match verification { Ok(_) => { diff --git a/examples/rsa/script/proof-with-pis b/examples/rsa/script/proof-with-pis new file mode 100644 index 0000000000..123d1dc2b9 Binary files /dev/null and b/examples/rsa/script/proof-with-pis differ diff --git a/examples/rsp/program/Cargo.lock b/examples/rsp/program/Cargo.lock index b917a37681..bae3fbbd8c 100644 --- a/examples/rsp/program/Cargo.lock +++ b/examples/rsp/program/Cargo.lock @@ -2530,15 +2530,6 @@ dependencies = [ "url", ] -[[package]] -name = "rsp-eth-program" -version = "1.1.0" -dependencies = [ - "bincode", - "rsp-client-executor", - "sp1-zkvm", -] - [[package]] name = "rsp-mpt" version = "0.1.0" @@ -2574,6 +2565,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "rsp-program" +version = "1.1.0" +dependencies = [ + "bincode", + "rsp-client-executor", + "sp1-zkvm", +] + [[package]] name = "rsp-witness-db" version = "0.1.0" @@ -2922,7 +2922,7 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -2934,7 +2934,7 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "cfg-if", diff --git a/examples/rsp/script/Cargo.lock b/examples/rsp/script/Cargo.lock index ae898626c5..e309050727 100644 --- a/examples/rsp/script/Cargo.lock +++ b/examples/rsp/script/Cargo.lock @@ -1936,6 +1936,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "downcast-rs" version = "1.2.1" @@ -3303,7 +3309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3502,6 +3508,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + [[package]] name = "ntapi" version = "0.4.1" @@ -6270,7 +6285,7 @@ dependencies = [ [[package]] name = "sp1-build" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "cargo_metadata", @@ -6281,7 +6296,7 @@ dependencies = [ [[package]] name = "sp1-core-executor" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "bytemuck", @@ -6315,7 +6330,7 @@ dependencies = [ [[package]] name = "sp1-core-machine" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "arrayref", @@ -6379,7 +6394,7 @@ dependencies = [ [[package]] name = "sp1-cuda" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "ctrlc", @@ -6398,7 +6413,7 @@ dependencies = [ [[package]] name = "sp1-curves" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "curve25519-dalek", "dashu", @@ -6417,7 +6432,7 @@ dependencies = [ [[package]] name = "sp1-derive" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "proc-macro2", "quote", @@ -6426,7 +6441,7 @@ dependencies = [ [[package]] name = "sp1-primitives" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -6438,7 +6453,7 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -6476,7 +6491,7 @@ dependencies = [ [[package]] name = "sp1-recursion-circuit" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "bincode", "itertools 0.13.0", @@ -6499,7 +6514,7 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "backtrace", "itertools 0.13.0", @@ -6527,7 +6542,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "backtrace", @@ -6563,7 +6578,7 @@ dependencies = [ [[package]] name = "sp1-recursion-core-v2" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "backtrace", @@ -6602,7 +6617,7 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "proc-macro2", "quote", @@ -6611,7 +6626,7 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -6636,7 +6651,7 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "itertools 0.13.0", "p3-air", @@ -6666,7 +6681,7 @@ dependencies = [ [[package]] name = "sp1-sdk" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "alloy-sol-types 0.7.7", "anyhow", @@ -6700,7 +6715,7 @@ dependencies = [ "sp1-stark", "strum", "strum_macros", - "sysinfo", + "sysinfo 0.30.13", "tempfile", "thiserror", "tokio", @@ -6711,7 +6726,7 @@ dependencies = [ [[package]] name = "sp1-stark" -version = "1.2.0-rc2" +version = "1.2.0" dependencies = [ "arrayref", "getrandom", @@ -6735,6 +6750,7 @@ dependencies = [ "serde", "sp1-derive", "sp1-primitives", + "sysinfo 0.15.9", "tracing", ] @@ -6770,7 +6786,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -6893,6 +6909,23 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sysinfo" +version = "0.15.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de94457a09609f33fec5e7fceaf907488967c6c7c75d64da6a7ce6ffdb8b5abd" +dependencies = [ + "cc", + "cfg-if", + "core-foundation-sys", + "doc-comment", + "libc", + "ntapi 0.3.7", + "once_cell", + "rayon", + "winapi", +] + [[package]] name = "sysinfo" version = "0.30.13" @@ -6902,7 +6935,7 @@ dependencies = [ "cfg-if", "core-foundation-sys", "libc", - "ntapi", + "ntapi 0.4.1", "once_cell", "rayon", "windows", @@ -7653,7 +7686,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/examples/rsp/script/src/main.rs b/examples/rsp/script/src/main.rs index 194ccedc9d..ea526aeb3e 100644 --- a/examples/rsp/script/src/main.rs +++ b/examples/rsp/script/src/main.rs @@ -57,7 +57,7 @@ fn main() { // It is strongly recommended you use the network prover given the size of these programs. if args.prove { println!("Starting proof generation."); - let proof = client.prove(&pk, stdin).compressed().run().expect("Proving should work."); + let proof = client.prove(&pk, stdin).run().expect("Proving should work."); println!("Proof generation finished."); client.verify(&proof, &vk).expect("proof verification should succeed"); diff --git a/examples/tendermint/program/Cargo.lock b/examples/tendermint/program/Cargo.lock index 9412aabb76..9099d055b5 100644 --- a/examples/tendermint/program/Cargo.lock +++ b/examples/tendermint/program/Cargo.lock @@ -691,7 +691,7 @@ dependencies = [ [[package]] name = "sp1-lib" -version = "1.1.1" +version = "1.2.0" dependencies = [ "anyhow", "bincode", @@ -703,7 +703,7 @@ dependencies = [ [[package]] name = "sp1-zkvm" -version = "1.1.1" +version = "1.2.0" dependencies = [ "bincode", "cfg-if", diff --git a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf b/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf index 1b0da72ab4..c20d62e67c 100755 Binary files a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf and b/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/tendermint/script/src/main.rs b/examples/tendermint/script/src/main.rs index f243879876..437c8b9b8d 100644 --- a/examples/tendermint/script/src/main.rs +++ b/examples/tendermint/script/src/main.rs @@ -46,7 +46,7 @@ fn main() { let execute = client.execute(TENDERMINT_ELF, stdin.clone()).run().expect("proving failed"); - let proof = client.prove(&pk, stdin).compressed().run().expect("proving failed"); + let proof = client.prove(&pk, stdin).run().expect("proving failed"); // Verify proof. client.verify(&proof, &vk).expect("verification failed");