From 15b9b0f1d5f2cbae146fd18d150d1a2b58dd2280 Mon Sep 17 00:00:00 2001 From: John Guibas Date: Sat, 21 Dec 2024 11:03:17 -0800 Subject: [PATCH] feat: dev sync (#169) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: allow for big shapes (#98) * new partial ord * test * maximal set * script v1 * some iterator methods * shape json * maximal shapes * more shapes * program list * shape script with default set * refactor local counts * update syscall counts * change position * local mem counts * fix shape count and distance * fix test * maximal core shapes * weak ordering * cleanup * by shard * checkpoint * shapes * reset option * try * refactor * checkpoint * checkpoint * checkpoint * fix script * back script * more mem init * one ordering only * all programs * checkpoint * checkpoint * try * cleanup * comment * checkpoint * move shape script * clean script * checkpoint try to clean * move script back * private * cleanup * fix cli * script * cleanup * tune * new shapes * fix * threshold * clear only shard sizes given * bound * fix counts * limited shapes * bound * pub * shapes * typo * test * wr too * wr * max shapes * try * f * fix counts * new shapes * 21 shaeps * fix checkpoint * checkpoint * new shapes * go * fix bounds * ff * shapes * fix max shape * counts * checkpoint * checkpoint * checkpoint * update * clippy * try * checkpoint * hacky * f * rm * span * merge latest changes * hm weird --------- Co-authored-by: jtguibas * handle op a set to register 0 correctly * gpu tracegen fix * fix * feat(recursion): executor parallelization (#66) * change cycle tracker to use `Cow<'static, str>` * remove vestigial cycle tracker * basic data structures for the new program * new program struct in runtime, iterator impls * replace program assoc type in airs * add cycle tracker recursion macro * fix cycle tracker span double counting (already fixed in sp1) * sub builder helper method * add parallel builder to recursion * refactor bounds in recursion compiler * parallel dsl support in compiler * replace old compile function * legacy program behind cfg(test) * unsafecell runtime attempt 2 * attempt 2 to separate execute_one out * execute_raw * clean up `MemVec` slightly * witness stream accessible only at top level * parallelize another loop * safety comment for recursion run * better tracing spans in compiler * safety newtype * more safety comments in recursion runtime * clean up a bit * strip out Option in MemVec * `MaybeUninit` in memory * metadata field in program * fixed/upgraded `print_stats` * (doesn't work) validation * copied smallvec for recursion validation * safety wrapper for `DslIrBlock`, undocumented * safety comments * fix constraints to work with parallel instruction * validate memory * re-implement debug printing * fix recursion tests * remove old `RecursionProgram` struct * inline `ProgramMetadata`, have only `shape_mut` on `RecProgram` * fix spelling in validation error * rename `RecProgram` back to `RecursionProgram` * clean up `memory.rs` * revert printing stats in compress * revert changes to root `Cargo.toml` * clippy * don't juggle in hot loop, init alpha_pows all at once * fix: don't push `new_alpha` again * add more spans and optimize hint reading * remove intermediate collects (perf untested) * fix soundness in mw_unchecked * fix memory for real, add safety comments * fix typos * fix a safety comment for RecursionProgram * fix bounds for `SyncUnsafeCell` * fix recursion chip tests * remove instruction extractors * run `cargo clippy --fix`, fix minor lints * automatically set `total_memory` in tests * type annotate `transmute`s, run `cargo fmt` * change `.cloned()` into `.copied()` in `io_addrs` * disable failing tests (to be fixed later) --------- Co-authored-by: tamirhemo Co-authored-by: jtguibas * verify next_pc for non halt ecall * column counts changed * re-enable shapes for unit tests * made program mutable * updates * better tuning for gpu * in progress shape cleanup * succesful shape migration * more cleanup * cleanup * collection checkpoint * built shapes * hm * artifacts * remove panic handle * fix small bugs * fix small issues * update * more update * adjust executor logic * tiny shapes * cleanup * small shapes * fix some small errors * add missing file * verified that address is > 0x20 * Update crates/core/machine/src/memory/instructions/air.rs Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: shape iterator * fixed formatting issue * use staging rpc * update version to rc3 * perf * feat: tests + sp1-perf for executor (#118) * perf: no nonces in executor (#119) * perf: register file (#120) * cumulative sum bug fix * fixed core_air_cost_consistency * register 32 is a valid mem addr * compile flag `c++20` -> c++17` * removed four permutation columns * check that memory instr don't access registers in executor and fixed column cnt file * fixed executor addr check * updated deviations doc * test * fix some issues * fixed conflict * hm * workflow * separate out executor and prover stuff * add executor-suite * wrong command in executor-suite * install m4 in ci * clean up prover opts * cleanup sp1 split opts * opts * fixed comment * in progress changes * fix * hm * fix execution stopping * latest changes * groth16 * name (#131) * remove nonce from the u256xu2048 table * cleanup * latest changes * changes * cpu param selection * adjust heuristic * adjust parameters * auto detect avx512 * update opts * update * opts * boom * commit maximal shapes * tune params * changes * hm * check memory writes * more changes * adjustments * foom * changes * changes * prevent cpu oom on reth * add blacklisted shapes * hm * update cuda image * more worst case maximal shapes * executor * cleanup generate deps span * get rid of prints * fix attempt * improve comments * fix vk hash * additional protection on is_complete * simplify AIR, add comment * mini cleanup, comments * tune number for 4xlarge * comments and very minor changes * Update crates/core/machine/src/control_flow/auipc.rs Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * shape selection fix * remove global 20 shapes from 2^19 * remove global 22 shapes from cpu 21 * push missing file * new recursion shape * update si * more cleanup * more small changes * new shape finding logic * hm * check memory reads * revert some changes * optimistic commit * some reverts * fix rv32im costs * update pr to work * fix: shape panic handling * fix: handle panic during shape vkey setup * vk map * fix * impact * push * recursion shape * do * fix script * generate back * test * print panic shapes * fix recursion script * make shape bigger * shape update * beq failure test * cleaner types * fix * verify vk true * changes * addresses PR comment * test shrink * some comment fixes * latest commit * small shapes checkpoint * new vk map * vk map * Revert "task(core): malicious trace generator support for failure test cases" * update action * update action * update shapes * new shapes * perf: executor performance (#145) * which events are exceeding * coreairid * cleanup -> 37 on mac * more cleanup * fix the test * get script to compile ; * reorder airs * change default to auto * comment nit * Revert "perf: executor performance (#145)" This reverts commit 73444486794d283ac316f36749a99880a7ac8e1d. * fix: executor oom * perf: executor performance (#145) * which events are exceeding * coreairid * cleanup -> 37 on mac * more cleanup * fix the test * get script to compile ; * reorder airs * change default to auto * comment nit * Revert "perf: executor performance (#145)" This reverts commit af0b64eab7c7b7f6d997de013fe7735f4f1721c8. * Reapply "perf: executor performance (#145)" This reverts commit ae0856826ec3d24713b2de26b994040d73138d09. * fix executor commit * fix * disable `sp1-recursion-compiler/debug` feature by default (#154) * feat(recursion): print backtraces on failed assertions (#155) * replace `TracedVec` with `Vec` * add `DebugBacktrace` to dsl and executor instructions * print backtraces with feature `"debug"` on division by zero * add `--no-fail-fast` to CI. should revert when CI passes * update gitignore * clippy fix * fix clippy * update release * update vk * generate proofs in tests * nit * more cleanup * Update crates/core/executor/src/profiler.rs Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix issues * fix: zkvm workspace version (#166) * fix ssz withdrawals (#165) * refactor: sdk v2 (#1875) Co-authored-by: Tamir Hemo Co-authored-by: Tej Qu Nair Co-authored-by: Kevin Jue Co-authored-by: John Guibas Co-authored-by: erabinov Co-authored-by: Eugene Rabinovich Co-authored-by: Yuwen Zhang Co-authored-by: N * separate out veriifer crate test * fix format * fix examples * fix executor clippy * changes * modify * fix sdk * cleanup files a bit * update groth16_vk * fix shape better algo * shape fix * fix shape matching logic * fix fix_shape * new vk map * new sdk in verifier crate * feat(sdk): `get_proof_status`, `request`, `cycle_limit` (#1883) * feat(sdk): latest network proto + error handling + fix examples (#1884) * feat: use `B256` + `request_async` + bump `alloy` + fix CI (#1886) * docs: add conventional commit guidelines to CONTRIBUTING.md (#1854) * fix: remove stdin from SP1ProofWithPublicValues (#1714) * fix: default tag * feat: update book, imports * fix * use SP1_CIRCUIT_VERSION * docs * fix * fix * feat: change loc, fix later * add * add * add * fix * update vk * fix examples * update vk * lock * fmt --------- Co-authored-by: Kevin Jue Co-authored-by: Tamir Hemo Co-authored-by: Tej Qu Nair Co-authored-by: tamirhemo Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chris Tian Co-authored-by: Bhargav Annem Co-authored-by: Yuwen Zhang Co-authored-by: rkm0959 Co-authored-by: erabinov Co-authored-by: Eugene Rabinovich Co-authored-by: N Co-authored-by: Ratan Kaliani Co-authored-by: Matt Stam Co-authored-by: Jev Björsell --- .github/workflows/pr.yml | 47 +- CONTRIBUTING.md | 21 +- Cargo.lock | 302 ++++++++-- SP1_VERSION | 1 + book/docs/generating-proofs/proof-types.md | 6 +- .../generating-proofs/prover-network/usage.md | 2 +- book/docs/writing-programs/cycle-tracking.mdx | 20 +- ...les_fibonacci_script_bin_compressed.rs.mdx | 2 +- ...amples_fibonacci_script_bin_execute.rs.mdx | 2 +- ..._fibonacci_script_bin_groth16_bn254.rs.mdx | 2 +- .../examples_fibonacci_script_src_main.rs.mdx | 4 +- .../examples_groth16_script_src_main.rs.mdx | 4 +- book/verification/onchain/getting-started.md | 2 +- .../version-3.4.0/developers/common-issues.md | 2 +- .../generating-proofs/advanced.mdx | 2 +- .../generating-proofs/proof-types.md | 8 +- .../generating-proofs/prover-network/usage.md | 2 +- .../prover-network/versions.md | 4 +- .../writing-programs/compiling.mdx | 2 +- .../writing-programs/cycle-tracking.mdx | 2 +- .../version-3.4.0/writing-programs/setup.md | 2 +- crates/build/src/lib.rs | 6 +- crates/core/machine/src/lib.rs | 10 - crates/prover/src/lib.rs | 7 +- crates/recursion/gnark-ffi/src/ffi/docker.rs | 4 +- crates/recursion/gnark-ffi/src/ffi/native.rs | 3 +- .../recursion/gnark-ffi/src/groth16_bn254.rs | 3 +- crates/recursion/gnark-ffi/src/lib.rs | 7 + crates/recursion/gnark-ffi/src/plonk_bn254.rs | 3 +- crates/sdk/Cargo.toml | 5 +- crates/sdk/src/lib.rs | 4 +- crates/sdk/src/network/client.rs | 84 ++- crates/sdk/src/network/error.rs | 39 ++ crates/sdk/src/network/mod.rs | 6 +- crates/sdk/src/network/proto/artifact.rs | 59 +- crates/sdk/src/network/proto/mod.rs | 4 + crates/sdk/src/network/proto/network.rs | 212 +++++-- crates/sdk/src/network/prove.rs | 107 +++- crates/sdk/src/network/prover.rs | 131 ++++- crates/sdk/src/network/utils.rs | 54 -- crates/sdk/src/prover.rs | 4 +- crates/verifier/Cargo.toml | 16 +- crates/verifier/README.md | 6 +- crates/verifier/bn254-vk/groth16_vk.bin | Bin 396 -> 396 bytes crates/verifier/bn254-vk/plonk_vk.bin | Bin 34368 -> 34368 bytes crates/verifier/src/error.rs | 2 +- crates/verifier/src/groth16/converter.rs | 2 +- crates/verifier/src/groth16/error.rs | 2 +- crates/verifier/src/groth16/mod.rs | 54 +- crates/verifier/src/groth16/verify.rs | 4 +- crates/verifier/src/lib.rs | 7 +- crates/verifier/src/plonk/converter.rs | 11 +- crates/verifier/src/plonk/error.rs | 2 +- crates/verifier/src/plonk/mod.rs | 45 +- crates/verifier/src/plonk/verify.rs | 4 +- crates/verifier/src/tests.rs | 58 +- .../test_binaries/fibonacci-groth16.bin | Bin 1449 -> 0 bytes .../test_binaries/fibonacci-plonk.bin | Bin 3825 -> 0 bytes examples/Cargo.lock | 531 ++++++++++-------- examples/fibonacci/script/Cargo.toml | 4 + examples/fibonacci/script/bin/network.rs | 77 +++ examples/tendermint/script/Cargo.toml | 2 +- 62 files changed, 1432 insertions(+), 586 deletions(-) create mode 100644 SP1_VERSION create mode 100644 crates/sdk/src/network/error.rs delete mode 100644 crates/verifier/test_binaries/fibonacci-groth16.bin delete mode 100644 crates/verifier/test_binaries/fibonacci-plonk.bin create mode 100644 examples/fibonacci/script/bin/network.rs diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9881b108d4..d4e5e1bc16 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -56,7 +56,7 @@ jobs: with: command: test toolchain: 1.81.0 - args: --release --features native-gnark --no-fail-fast # TODO remove when CI checks always pass + args: --release --features native-gnark --workspace --exclude sp1-verifier env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native RUST_BACKTRACE: 1 @@ -100,12 +100,55 @@ jobs: with: command: test toolchain: 1.81.0 - args: --release --features native-gnark --no-fail-fast # TODO remove when CI checks always pass + args: --release --features native-gnark --workspace --exclude sp1-verifier env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native RUST_BACKTRACE: 1 SP1_DEV: 1 + test-verifier: + name: Test Verifier Crate + runs-on: + [ + runs-on, + runner=64cpu-linux-arm64, + spot=false, + disk=large, + "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 from repo + run: | + cargo run -p sp1-cli -- prove install-toolchain + cd crates/cli + cargo install --locked --force --path . + cargo clean + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + toolchain: 1.81.0 + args: --all-targets --all-features + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + toolchain: 1.81.0 + args: --release --package sp1-verifier + env: + RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native + RUST_BACKTRACE: 1 + lint: name: Formatting & Clippy runs-on: [runs-on, runner=16cpu-linux-x64, disk=large, "run-id=${{ github.run_id }}"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85557b6352..c2c99353f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,6 +107,25 @@ changes that are split across multiple commits. That said, if you have a number of commits that are "checkpoints" and don't represent a single logical change, please squash those together. +**Conventional Commit Messages and PR Titles:** +To ensure consistency and aid in automated tooling (such as changelog generation), please follow the +[Conventional Commits](https://www.conventionalcommits.org/) style for commit messages and PR titles. Prefix your commit +messages and PR titles with one of the following types: + +- **feat:** for new features +- **fix:** for bug fixes +- **docs:** for documentation-only changes +- **refactor:** for code changes that neither fix a bug nor add a feature +- **chore:** for changes to the build process or auxiliary tools +- **test:** for adding or updating tests + +For example: +- `docs: Update README with corrected links` +- `fix: Resolve race condition in event loop` + +If your pull request title does not contain a valid prefix, automated checks may fail. You can amend your commit and +force-push to correct this before merging. + #### Opening the pull request From within GitHub, opening a new pull request will present you with a template that should be filled out. Please try @@ -162,4 +181,4 @@ _Adapted from the [Reth contributing guide](https://raw.githubusercontent.com/pa [mcve]: https://stackoverflow.com/help/mcve -[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment \ No newline at end of file +[hiding-a-comment]: https://help.github.com/articles/managing-disruptive-comments/#hiding-a-comment diff --git a/Cargo.lock b/Cargo.lock index 583df2f7d6..2f22297108 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -111,20 +111,35 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-consensus" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed961a48297c732a5d97ee321aa8bb5009ecadbcb077d8bec90cb54e651629" +checksum = "e88e1edea70787c33e11197d3f32ae380f3db19e6e061e539a5bcf8184a6b326" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", "alloy-serde", + "alloy-trie", "auto_impl", "c-kzg", "derive_more", "serde", ] +[[package]] +name = "alloy-consensus-any" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b1bb53f40c0273cd1975573cd457b39213e68584e36d1401d25fd0398a1d65" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "serde", +] + [[package]] name = "alloy-eip2930" version = "0.1.0" @@ -138,9 +153,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.3.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ffc577390ce50234e02d841214b3dc0bea6aaaae8e04bbf3cb82e9a45da9eb" +checksum = "4c986539255fb839d1533c128e190e557e52ff652c9ef62939e233a81dd93f7e" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -150,9 +165,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69e06cf9c37be824b9d26d6d101114fdde6af0c87de2828b414c05c4b3daa71" +checksum = "5f9fadfe089e9ccc0650473f2d4ef0a28bc015bbca5631d9f0f09e49b557fdb3" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -180,29 +195,31 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af5979e0d5a7bf9c7eb79749121e8256e59021af611322aee56e77e20776b4b3" +checksum = "e29040b9d5fe2fb70415531882685b64f8efd08dfbd6cc907120650504821105" dependencies = [ "alloy-primitives", "alloy-sol-types", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.8", "tracing", ] [[package]] name = "alloy-network" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "204237129086ce5dc17a58025e93739b01b45313841f98fa339eb1d780511e57" +checksum = "510cc00b318db0dfccfdd2d032411cfae64fc144aef9679409e014145d3dacc4" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-json-rpc", "alloy-network-primitives", "alloy-primitives", + "alloy-rpc-types-any", "alloy-rpc-types-eth", "alloy-serde", "alloy-signer", @@ -210,14 +227,16 @@ dependencies = [ "async-trait", "auto_impl", "futures-utils-wasm", - "thiserror 1.0.69", + "serde", + "serde_json", + "thiserror 2.0.8", ] [[package]] name = "alloy-network-primitives" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514f70ee2a953db21631cd817b13a1571474ec77ddc03d47616d5e8203489fde" +checksum = "9081c099e798b8a2bba2145eb82a9a146f01fc7a35e9ab6e7b43305051f97550" dependencies = [ "alloy-consensus", "alloy-eips", @@ -276,13 +295,25 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "alloy-rpc-types-any" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed98e1af55a7d856bfa385f30f63d8d56be2513593655c904a8f4a7ec963aa3e" +dependencies = [ + "alloy-consensus-any", + "alloy-rpc-types-eth", + "alloy-serde", +] + [[package]] name = "alloy-rpc-types-eth" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b034779a4850b4b03f5be5ea674a1cf7d746b2da762b34d1860ab45e48ca27" +checksum = "8737d7a6e37ca7bba9c23e9495c6534caec6760eb24abc9d5ffbaaba147818e1" dependencies = [ "alloy-consensus", + "alloy-consensus-any", "alloy-eips", "alloy-network-primitives", "alloy-primitives", @@ -297,9 +328,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028e72eaa9703e4882344983cfe7636ce06d8cce104a78ea62fd19b46659efc4" +checksum = "5851bf8d5ad33014bd0c45153c603303e730acc8a209450a7ae6b4a12c2789e2" dependencies = [ "alloy-primitives", "serde", @@ -308,23 +339,23 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592c185d7100258c041afac51877660c7bf6213447999787197db4842f0e938e" +checksum = "7e10ca565da6500cca015ba35ee424d59798f2e1b85bc0dd8f81dafd401f029a" dependencies = [ "alloy-primitives", "async-trait", "auto_impl", "elliptic-curve", "k256", - "thiserror 1.0.69", + "thiserror 2.0.8", ] [[package]] name = "alloy-signer-local" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6614f02fc1d5b079b2a4a5320018317b506fd0a6d67c1fd5542a71201724986c" +checksum = "47fababf5a745133490cde927d48e50267f97d3d1209b9fc9f1d1d666964d172" dependencies = [ "alloy-consensus", "alloy-network", @@ -333,7 +364,7 @@ dependencies = [ "async-trait", "k256", "rand 0.8.5", - "thiserror 1.0.69", + "thiserror 2.0.8", ] [[package]] @@ -406,6 +437,22 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-trie" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5fd8fea044cc9a8c8a50bb6f28e31f0385d820f116c5b98f6f4e55d6e5590b" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "arrayvec", + "derive_more", + "nybbles", + "serde", + "smallvec", + "tracing", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -494,6 +541,54 @@ dependencies = [ "backtrace", ] +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "rayon", + "sha2 0.10.8", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -528,6 +623,7 @@ dependencies = [ "num-bigint 0.4.6", "num-traits", "paste", + "rayon", "rustc_version 0.4.1", "zeroize", ] @@ -577,6 +673,48 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "rayon", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "rayon", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber 0.2.25", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -593,11 +731,35 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", "num-bigint 0.4.6", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -616,6 +778,7 @@ checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", "rand 0.8.5", + "rayon", ] [[package]] @@ -629,6 +792,9 @@ name = "arrayvec" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +dependencies = [ + "serde", +] [[package]] name = "async-attributes" @@ -1118,9 +1284,9 @@ dependencies = [ [[package]] name = "bytemuck_derive" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", @@ -2579,6 +2745,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -3655,6 +3830,17 @@ 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 = [ + "const-hex", + "serde", + "smallvec", +] + [[package]] name = "object" version = "0.36.5" @@ -5648,7 +5834,7 @@ dependencies = [ "tiny-keccak", "tracing", "tracing-forest", - "tracing-subscriber", + "tracing-subscriber 0.3.19", "typenum", "web-time", ] @@ -5817,7 +6003,7 @@ dependencies = [ "thiserror 1.0.69", "tracing", "tracing-appender", - "tracing-subscriber", + "tracing-subscriber 0.3.19", ] [[package]] @@ -6008,6 +6194,7 @@ dependencies = [ "test-artifacts", "thiserror 1.0.69", "tokio", + "tokio-test", "tonic", "tracing", "twirp-rs", @@ -6052,6 +6239,12 @@ dependencies = [ name = "sp1-verifier" version = "4.0.0-rc.3" dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-groth16", + "ark-serialize 0.4.2", + "cfg-if", "hex", "lazy_static", "num-bigint 0.4.6", @@ -6059,7 +6252,8 @@ dependencies = [ "sha2 0.10.8", "sp1-sdk", "substrate-bn-succinct", - "thiserror-no-std", + "test-artifacts", + "thiserror 2.0.8", ] [[package]] @@ -6455,26 +6649,6 @@ dependencies = [ "syn 2.0.90", ] -[[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" @@ -6596,9 +6770,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -6669,6 +6843,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-test" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" +dependencies = [ + "async-stream", + "bytes 1.9.0", + "futures-core", + "tokio", + "tokio-stream", +] + [[package]] name = "tokio-util" version = "0.7.13" @@ -6829,7 +7016,7 @@ dependencies = [ "crossbeam-channel", "thiserror 1.0.69", "time 0.3.37", - "tracing-subscriber", + "tracing-subscriber 0.3.19", ] [[package]] @@ -6863,7 +7050,7 @@ dependencies = [ "smallvec", "thiserror 1.0.69", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.19", ] [[package]] @@ -6887,6 +7074,15 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.19" diff --git a/SP1_VERSION b/SP1_VERSION new file mode 100644 index 0000000000..ebca639e0e --- /dev/null +++ b/SP1_VERSION @@ -0,0 +1 @@ +v4.0.0-rc.3 \ No newline at end of file diff --git a/book/docs/generating-proofs/proof-types.md b/book/docs/generating-proofs/proof-types.md index 581a751d3c..dfdae364d5 100644 --- a/book/docs/generating-proofs/proof-types.md +++ b/book/docs/generating-proofs/proof-types.md @@ -13,7 +13,7 @@ the size of the execution. Use this in settings where you don't care about **ver ```rust,noplayground let client = ProverClient::from_env(); -client.prove(&pk, stdin).run().unwrap(); +client.prove(&pk, &stdin).run().unwrap(); ``` ## Compressed @@ -23,7 +23,7 @@ care about **verification cost / proof size**, but not onchain verification. Com ```rust,noplayground let client = ProverClient::from_env(); -client.prove(&pk, stdin).compressed().run().unwrap(); +client.prove(&pk, &stdin).compressed().run().unwrap(); ``` ## Groth16 (Recommended) @@ -45,5 +45,5 @@ PLONK does not require a trusted setup and reuses contributions from the Aztec I ```rust,noplayground let client = ProverClient::from_env(); -client.prove(&pk, stdin).plonk().run().unwrap(); +client.prove(&pk, &stdin).plonk().run().unwrap(); ``` diff --git a/book/docs/generating-proofs/prover-network/usage.md b/book/docs/generating-proofs/prover-network/usage.md index 388c61efdb..77eef1f082 100644 --- a/book/docs/generating-proofs/prover-network/usage.md +++ b/book/docs/generating-proofs/prover-network/usage.md @@ -10,7 +10,7 @@ To use the prover network to generate a proof, you can run your script that uses // Generate the proof for the given program. let client = ProverClient::from_env(); let (pk, vk) = client.setup(ELF); -let mut proof = client.prove(&pk, stdin).run().unwrap(); +let mut proof = client.prove(&pk, &stdin).run().unwrap(); ``` ```sh diff --git a/book/docs/writing-programs/cycle-tracking.mdx b/book/docs/writing-programs/cycle-tracking.mdx index d46da0709f..f38f50d74d 100644 --- a/book/docs/writing-programs/cycle-tracking.mdx +++ b/book/docs/writing-programs/cycle-tracking.mdx @@ -8,7 +8,7 @@ When writing a program, it is useful to know how many RISC-V cycles a portion of To track the number of cycles spent in a portion of the program, you can either put `println!("cycle-tracker-start: block name")` + `println!("cycle-tracker-end: block name")` statements (block name must be same between start and end) around the portion of your program you want to profile or use the `#[sp1_derive::cycle_tracker]` macro on a function. An example is shown below: - + Note that to use the macro, you must add the `sp1-derive` crate to your dependencies for your program. @@ -56,11 +56,12 @@ fn main() { This will log the cycle count for `block name` and include it in the `ExecutionReport` in the `cycle_tracker` map. -### Profiling a ZKVM program +### Profiling a ZKVM program Profiling a zkVM program produces a useful visualization ([example profile](https://share.firefox.dev/3Om1pzz)) which makes it easy to examine program performance and see exactly where VM cycles are being spent without needing to modify the program at all. To profile a program, you need to: + 1. Enable the profiling feature for `sp1-sdk` in `script/Cargo.toml` 2. Set the env variable `TRACE_FILE=trace.json` and then call `ProverClient::execute()` in your script. @@ -68,13 +69,15 @@ If you're executing a larger program (>100M cycles), you should set `TRACE_SAMPL Many examples can be found in the repo, such as this ['fibonacci'](https://github.com/succinctlabs/sp1/blob/dev/examples/fibonacci/script/src/main.rs#L22) script. -Once you have your script it should look like the following: -```rs +Once you have your script it should look like the following: + +```rs // Execute the program using the `ProverClient.execute` method, without generating a proof. - let (_, report) = client.execute(ELF, stdin.clone()).run().unwrap(); + let (_, report) = client.execute(ELF, &stdin).run().unwrap(); ``` As well you must enable the profiling feature on the SDK: + ```toml sp1-sdk = { version = "3.0.0", features = ["profiling"] } ``` @@ -83,11 +86,13 @@ The `TRACE_FILE` env var tells the executor where to save the profile, and the ` A larger sample rate will give you a smaller profile, it is the number of instructions in between each sample. The full command to profile should look something like this + ```sh TRACE_FILE=output.json TRACE_SAMPLE_RATE=100 cargo run ... ``` To view these profiles, we recommend [Samply](https://github.com/mstange/samply). + ```sh cargo install --locked samply samply load output.json @@ -97,7 +102,8 @@ Samply uses the Firefox profiler to create a nice visualization of your programs ![An example screenshot of the Firefox Profiler](@site/static/profiling.png) #### Interpreting the Profile -- The "time" measurement in the profiler is actually the number of cycles spent, -in general the less cycles for a given callframe the better. + +- The "time" measurement in the profiler is actually the number of cycles spent, + in general the less cycles for a given callframe the better. - The CPU usage of the program will always be constant, as its running in the VM which is single threaded. diff --git a/book/static/examples_fibonacci_script_bin_compressed.rs.mdx b/book/static/examples_fibonacci_script_bin_compressed.rs.mdx index 5c9409f8da..1b17c75f3b 100644 --- a/book/static/examples_fibonacci_script_bin_compressed.rs.mdx +++ b/book/static/examples_fibonacci_script_bin_compressed.rs.mdx @@ -16,7 +16,7 @@ fn main() { // Generate the constant-sized proof for the given program and input. let client = ProverClient::new(); let (pk, vk) = client.setup(ELF); - let mut proof = client.prove(&pk, stdin).compressed().run().unwrap(); + let mut proof = client.prove(&pk, &stdin).compressed().run().unwrap(); println!("generated proof"); // Read and verify the output. diff --git a/book/static/examples_fibonacci_script_bin_execute.rs.mdx b/book/static/examples_fibonacci_script_bin_execute.rs.mdx index 46d2bb8757..84175f3017 100644 --- a/book/static/examples_fibonacci_script_bin_execute.rs.mdx +++ b/book/static/examples_fibonacci_script_bin_execute.rs.mdx @@ -16,7 +16,7 @@ fn main() { // Only execute the program and get a `SP1PublicValues` object. let client = ProverClient::new(); - let (mut public_values, execution_report) = client.execute(ELF, stdin).run().unwrap(); + let (mut public_values, execution_report) = client.execute(ELF, &stdin).run().unwrap(); // Print the total number of cycles executed and the full execution report with a breakdown of // the RISC-V opcode and syscall counts. diff --git a/book/static/examples_fibonacci_script_bin_groth16_bn254.rs.mdx b/book/static/examples_fibonacci_script_bin_groth16_bn254.rs.mdx index 6b2d6a7f06..a2ef52fc74 100644 --- a/book/static/examples_fibonacci_script_bin_groth16_bn254.rs.mdx +++ b/book/static/examples_fibonacci_script_bin_groth16_bn254.rs.mdx @@ -20,7 +20,7 @@ fn main() { println!("vk: {:?}", vk.bytes32()); // Generate the Groth16 proof. - let proof = client.prove(&pk, stdin).groth16().run().unwrap(); + let proof = client.prove(&pk, &stdin).groth16().run().unwrap(); println!("generated proof"); // Get the public values as bytes. diff --git a/book/static/examples_fibonacci_script_src_main.rs.mdx b/book/static/examples_fibonacci_script_src_main.rs.mdx index 0aa64a9583..c779c5f945 100644 --- a/book/static/examples_fibonacci_script_src_main.rs.mdx +++ b/book/static/examples_fibonacci_script_src_main.rs.mdx @@ -20,12 +20,12 @@ fn main() { let client = ProverClient::new(); // Execute the program using the `ProverClient.execute` method, without generating a proof. - let (_, report) = client.execute(ELF, stdin.clone()).run().unwrap(); + let (_, report) = client.execute(ELF, &stdin).run().unwrap(); println!("executed program with {} cycles", report.total_instruction_count()); // Generate the proof for the given program and input. let (pk, vk) = client.setup(ELF); - let mut proof = client.prove(&pk, stdin).run().unwrap(); + let mut proof = client.prove(&pk, &stdin).run().unwrap(); println!("generated proof"); diff --git a/book/static/examples_groth16_script_src_main.rs.mdx b/book/static/examples_groth16_script_src_main.rs.mdx index 7be12e7e3d..771a908611 100644 --- a/book/static/examples_groth16_script_src_main.rs.mdx +++ b/book/static/examples_groth16_script_src_main.rs.mdx @@ -29,7 +29,7 @@ fn generate_fibonacci_proof() -> (Vec, Vec, String) { // Generate the groth16 proof for the Fibonacci program. let (pk, vk) = client.setup(FIBONACCI_ELF); println!("vk: {:?}", vk.bytes32()); - let proof = client.prove(&pk, stdin).groth16().run().unwrap(); + let proof = client.prove(&pk, &stdin).groth16().run().unwrap(); (proof.bytes(), proof.public_values.to_vec(), vk.bytes32()) } @@ -50,7 +50,7 @@ fn main() { let client = ProverClient::new(); // Execute the program using the `ProverClient.execute` method, without generating a proof. - let (_, report) = client.execute(GROTH16_ELF, stdin.clone()).run().unwrap(); + let (_, report) = client.execute(GROTH16_ELF, &stdin).run().unwrap(); println!("executed groth16 program with {} cycles", report.total_instruction_count()); println!("{}", report); } diff --git a/book/verification/onchain/getting-started.md b/book/verification/onchain/getting-started.md index 834a23dc18..8519d620a8 100644 --- a/book/verification/onchain/getting-started.md +++ b/book/verification/onchain/getting-started.md @@ -29,5 +29,5 @@ You can run the above script with `RUST_LOG=info cargo run --bin groth16_bn254 - 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 = "2.0.0", features = ["native-gnark"] } +sp1-sdk = { version = "3.0.0", features = ["native-gnark"] } ``` diff --git a/book/versioned_docs/version-3.4.0/developers/common-issues.md b/book/versioned_docs/version-3.4.0/developers/common-issues.md index 5d0a50e808..5b06ec3b43 100644 --- a/book/versioned_docs/version-3.4.0/developers/common-issues.md +++ b/book/versioned_docs/version-3.4.0/developers/common-issues.md @@ -51,7 +51,7 @@ This is likely due to two different versions of `alloy_sol_types` being used. To ```toml [dependencies] -sp1-sdk = { version = "2.0.0", default-features = false } +sp1-sdk = { version = "3.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`. diff --git a/book/versioned_docs/version-3.4.0/generating-proofs/advanced.mdx b/book/versioned_docs/version-3.4.0/generating-proofs/advanced.mdx index 192ab3cb92..da9e3548ab 100644 --- a/book/versioned_docs/version-3.4.0/generating-proofs/advanced.mdx +++ b/book/versioned_docs/version-3.4.0/generating-proofs/advanced.mdx @@ -47,7 +47,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 = "2.0.0", features = ["neon"] } +sp1-sdk = { version = "3.0.0", features = ["neon"] } ``` ## Performance diff --git a/book/versioned_docs/version-3.4.0/generating-proofs/proof-types.md b/book/versioned_docs/version-3.4.0/generating-proofs/proof-types.md index c6d713e754..ece6318edc 100644 --- a/book/versioned_docs/version-3.4.0/generating-proofs/proof-types.md +++ b/book/versioned_docs/version-3.4.0/generating-proofs/proof-types.md @@ -13,7 +13,7 @@ the size of the execution. Use this in settings where you don't care about **ver ```rust let client = ProverClient::new(); -client.prove(&pk, stdin).run().unwrap(); +client.prove(&pk, &stdin).run().unwrap(); ``` ## Compressed @@ -23,7 +23,7 @@ care about **verification cost / proof size**, but not onchain verification. Com ```rust let client = ProverClient::new(); -client.prove(&pk, stdin).compressed().run().unwrap(); +client.prove(&pk, &stdin).compressed().run().unwrap(); ``` ## Groth16 (Recommended) @@ -34,7 +34,7 @@ The trusted setup for the Groth16 circuit keys uses the [Aztec Ignition ceremony ```rust let client = ProverClient::new(); -client.prove(&pk, stdin).groth16().run().unwrap(); +client.prove(&pk, &stdin).groth16().run().unwrap(); ``` ## PLONK @@ -45,5 +45,5 @@ PLONK does not require a trusted setup. ```rust let client = ProverClient::new(); -client.prove(&pk, stdin).plonk().run().unwrap(); +client.prove(&pk, &stdin).plonk().run().unwrap(); ``` diff --git a/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/usage.md b/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/usage.md index 12ef4ac4e6..f17324113e 100644 --- a/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/usage.md +++ b/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/usage.md @@ -10,7 +10,7 @@ To use the prover network to generate a proof, you can run your script that uses // Generate the proof for the given program. let client = ProverClient::new(); let (pk, vk) = client.setup(ELF); -let mut proof = client.prove(&pk, stdin).run().unwrap(); +let mut proof = client.prove(&pk, &stdin).run().unwrap(); ``` ```sh diff --git a/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/versions.md b/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/versions.md index 31503adb80..4190b713fe 100644 --- a/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/versions.md +++ b/book/versioned_docs/version-3.4.0/generating-proofs/prover-network/versions.md @@ -17,14 +17,14 @@ You must switch to a supported version before submitting a proof. To do so, repl ```toml [dependencies] -sp1-zkvm = "2.0.0" +sp1-zkvm = "3.0.0" ``` replace the `sp1-sdk` version in your script's `Cargo.toml`: ```toml [dependencies] -sp1-sdk = "2.0.0" +sp1-sdk = "3.0.0" ``` Re-build your program and script, and then try again. diff --git a/book/versioned_docs/version-3.4.0/writing-programs/compiling.mdx b/book/versioned_docs/version-3.4.0/writing-programs/compiling.mdx index 0041ba8fae..54bf018114 100644 --- a/book/versioned_docs/version-3.4.0/writing-programs/compiling.mdx +++ b/book/versioned_docs/version-3.4.0/writing-programs/compiling.mdx @@ -61,7 +61,7 @@ The path passed in to `build_program` should point to the directory containing t ```toml [build-dependencies] -sp1-build = "2.0.0" +sp1-build = "3.0.0" ``` You will see output like the following from the build script if the program has changed, indicating that the program was rebuilt: diff --git a/book/versioned_docs/version-3.4.0/writing-programs/cycle-tracking.mdx b/book/versioned_docs/version-3.4.0/writing-programs/cycle-tracking.mdx index f29c303a08..0281f5fdc7 100644 --- a/book/versioned_docs/version-3.4.0/writing-programs/cycle-tracking.mdx +++ b/book/versioned_docs/version-3.4.0/writing-programs/cycle-tracking.mdx @@ -14,7 +14,7 @@ Note that to use the macro, you must add the `sp1-derive` crate to your dependen ```toml [dependencies] -sp1-derive = "2.0.0" +sp1-derive = "3.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: diff --git a/book/versioned_docs/version-3.4.0/writing-programs/setup.md b/book/versioned_docs/version-3.4.0/writing-programs/setup.md index 2cd677f4a9..42ab5383bc 100644 --- a/book/versioned_docs/version-3.4.0/writing-programs/setup.md +++ b/book/versioned_docs/version-3.4.0/writing-programs/setup.md @@ -32,7 +32,7 @@ name = "program" edition = "2021" [dependencies] -sp1-zkvm = "2.0.0" +sp1-zkvm = "3.0.0" ``` The `sp1-zkvm` crate includes necessary utilities for your program, including handling inputs and outputs, diff --git a/crates/build/src/lib.rs b/crates/build/src/lib.rs index 1dbbec1347..8fa1c9842c 100644 --- a/crates/build/src/lib.rs +++ b/crates/build/src/lib.rs @@ -6,8 +6,8 @@ pub use build::{execute_build_program, generate_elf_paths}; use clap::Parser; +const SP1_CIRCUIT_VERSION: &str = include_str!("../../../SP1_VERSION"); const BUILD_TARGET: &str = "riscv32im-succinct-zkvm-elf"; -const DEFAULT_TAG: &str = "latest"; const DEFAULT_OUTPUT_DIR: &str = "elf"; const HELPER_TARGET_SUBDIR: &str = "elf-compilation"; @@ -27,7 +27,7 @@ pub struct BuildArgs { #[clap( long, help = "The ghcr.io/succinctlabs/sp1 image tag to use when building with Docker.", - default_value = DEFAULT_TAG + default_value = SP1_CIRCUIT_VERSION )] pub tag: String, #[clap( @@ -83,7 +83,7 @@ impl Default for BuildArgs { fn default() -> Self { Self { docker: false, - tag: DEFAULT_TAG.to_string(), + tag: SP1_CIRCUIT_VERSION.to_string(), features: vec![], rustflags: vec![], ignore_rust_version: false, diff --git a/crates/core/machine/src/lib.rs b/crates/core/machine/src/lib.rs index 26779d6112..e58e5c23cf 100644 --- a/crates/core/machine/src/lib.rs +++ b/crates/core/machine/src/lib.rs @@ -31,16 +31,6 @@ pub mod sys; pub mod syscall; pub mod utils; -#[cfg(test)] -mod test_checkpoints; - -/// The global version for all components of SP1. -/// -/// 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 = "v4.0.0-rc.3"; - // Re-export the `SP1ReduceProof` struct from sp1_core_machine. // // This is done to avoid a circular dependency between sp1_core_machine and sp1_core_executor, and diff --git a/crates/prover/src/lib.rs b/crates/prover/src/lib.rs index 22d4e4f443..458566f2da 100644 --- a/crates/prover/src/lib.rs +++ b/crates/prover/src/lib.rs @@ -87,7 +87,12 @@ use utils::{sp1_committed_values_digest_bn254, sp1_vkey_digest_bn254, words_to_b use components::{CpuProverComponents, SP1ProverComponents}; -pub use sp1_core_machine::SP1_CIRCUIT_VERSION; +/// The global version for all components of SP1. +/// +/// 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 = include_str!("../../../SP1_VERSION"); /// The configuration for the core prover. pub type CoreSC = BabyBearPoseidon2; diff --git a/crates/recursion/gnark-ffi/src/ffi/docker.rs b/crates/recursion/gnark-ffi/src/ffi/docker.rs index 56d416be8d..402205da43 100644 --- a/crates/recursion/gnark-ffi/src/ffi/docker.rs +++ b/crates/recursion/gnark-ffi/src/ffi/docker.rs @@ -1,6 +1,6 @@ -use crate::{Groth16Bn254Proof, PlonkBn254Proof, ProofBn254}; +use crate::ProofBn254; +use crate::{Groth16Bn254Proof, PlonkBn254Proof, SP1_CIRCUIT_VERSION}; use anyhow::{anyhow, Result}; -use sp1_core_machine::SP1_CIRCUIT_VERSION; use std::{io::Write, process::Command}; /// Represents the proof system being used diff --git a/crates/recursion/gnark-ffi/src/ffi/native.rs b/crates/recursion/gnark-ffi/src/ffi/native.rs index 46ab4eacb9..f21b42aa5c 100644 --- a/crates/recursion/gnark-ffi/src/ffi/native.rs +++ b/crates/recursion/gnark-ffi/src/ffi/native.rs @@ -5,9 +5,8 @@ //! Although we cast to *mut c_char because the Go signatures can't be immutable, the Go functions //! should not modify the strings. -use crate::{Groth16Bn254Proof, PlonkBn254Proof}; +use crate::{Groth16Bn254Proof, PlonkBn254Proof, SP1_CIRCUIT_VERSION}; use cfg_if::cfg_if; -use sp1_core_machine::SP1_CIRCUIT_VERSION; use std::{ ffi::{c_char, CStr, CString}, mem::forget, diff --git a/crates/recursion/gnark-ffi/src/groth16_bn254.rs b/crates/recursion/gnark-ffi/src/groth16_bn254.rs index f2864df5bb..c3e7ffb9ca 100644 --- a/crates/recursion/gnark-ffi/src/groth16_bn254.rs +++ b/crates/recursion/gnark-ffi/src/groth16_bn254.rs @@ -7,12 +7,11 @@ use std::{ use crate::{ ffi::{build_groth16_bn254, prove_groth16_bn254, test_groth16_bn254, verify_groth16_bn254}, witness::GnarkWitness, - Groth16Bn254Proof, + Groth16Bn254Proof, SP1_CIRCUIT_VERSION, }; use num_bigint::BigUint; use sha2::{Digest, Sha256}; -use sp1_core_machine::SP1_CIRCUIT_VERSION; use sp1_recursion_compiler::{ constraints::Constraint, ir::{Config, Witness}, diff --git a/crates/recursion/gnark-ffi/src/lib.rs b/crates/recursion/gnark-ffi/src/lib.rs index 436739ba83..df02e731df 100644 --- a/crates/recursion/gnark-ffi/src/lib.rs +++ b/crates/recursion/gnark-ffi/src/lib.rs @@ -10,3 +10,10 @@ pub use groth16_bn254::*; pub use plonk_bn254::*; pub use proof::*; pub use witness::*; + +/// The global version for all components of SP1. +/// +/// 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. +const SP1_CIRCUIT_VERSION: &str = include_str!("../../../../SP1_VERSION"); diff --git a/crates/recursion/gnark-ffi/src/plonk_bn254.rs b/crates/recursion/gnark-ffi/src/plonk_bn254.rs index b901eecc05..00bd3485aa 100644 --- a/crates/recursion/gnark-ffi/src/plonk_bn254.rs +++ b/crates/recursion/gnark-ffi/src/plonk_bn254.rs @@ -7,12 +7,11 @@ use std::{ use crate::{ ffi::{build_plonk_bn254, prove_plonk_bn254, test_plonk_bn254, verify_plonk_bn254}, witness::GnarkWitness, - PlonkBn254Proof, + PlonkBn254Proof, SP1_CIRCUIT_VERSION, }; use num_bigint::BigUint; use sha2::{Digest, Sha256}; -use sp1_core_machine::SP1_CIRCUIT_VERSION; use sp1_recursion_compiler::{ constraints::Constraint, ir::{Config, Witness}, diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml index 36a186db97..e1156d7ce8 100644 --- a/crates/sdk/Cargo.toml +++ b/crates/sdk/Cargo.toml @@ -49,13 +49,14 @@ sp1-primitives = { workspace = true } itertools = { workspace = true } tonic = { version = "0.12", features = ["tls", "tls-roots"], optional = true } alloy-sol-types = { version = "0.8", optional = true } -alloy-signer = { version = "0.5", optional = true } -alloy-signer-local = { version = "0.5", optional = true } +alloy-signer = { version = "0.8", optional = true } +alloy-signer-local = { version = "0.8", optional = true } alloy-primitives = { version = "0.8", optional = true } backoff = { version = "0.4", features = ["tokio"], optional = true } [dev-dependencies] test-artifacts = { workspace = true } +tokio-test = { version = "0.4"} [features] default = ["cuda", "network"] diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index f22e58330c..0576408281 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -57,11 +57,11 @@ pub use sp1_build::include_elf; pub use sp1_core_executor::{ExecutionReport, Executor, HookEnv, SP1Context, SP1ContextBuilder}; // Re-export the machine/prover primitives. -pub use sp1_core_machine::{io::SP1Stdin, SP1_CIRCUIT_VERSION}; +pub use sp1_core_machine::io::SP1Stdin; pub use sp1_primitives::io::SP1PublicValues; pub use sp1_prover::{ CoreSC, HashableKey, InnerSC, OuterSC, PlonkBn254Proof, ProverMode, SP1Prover, SP1ProvingKey, - SP1VerifyingKey, + SP1VerifyingKey, SP1_CIRCUIT_VERSION, }; // Re-export the utilities. diff --git a/crates/sdk/src/network/client.rs b/crates/sdk/src/network/client.rs index 880352c5c6..ae0b405c63 100644 --- a/crates/sdk/src/network/client.rs +++ b/crates/sdk/src/network/client.rs @@ -6,6 +6,7 @@ use std::result::Result::Ok as StdOk; use std::str::FromStr; use std::time::{Duration, SystemTime, UNIX_EPOCH}; +use alloy_primitives::B256; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; use anyhow::{Context, Ok, Result}; @@ -20,14 +21,14 @@ use tonic::{ use super::utils::Signable; use crate::network::proto::artifact::{ - artifact_store_client::ArtifactStoreClient, CreateArtifactRequest, + artifact_store_client::ArtifactStoreClient, ArtifactType, CreateArtifactRequest, }; use crate::network::proto::network::{ prover_network_client::ProverNetworkClient, CreateProgramRequest, CreateProgramRequestBody, - CreateProgramResponse, FulfillmentStatus, FulfillmentStrategy, GetNonceRequest, - GetProgramRequest, GetProgramResponse, GetProofRequestStatusRequest, - GetProofRequestStatusResponse, MessageFormat, ProofMode, RequestProofRequest, - RequestProofRequestBody, RequestProofResponse, + CreateProgramResponse, FulfillmentStatus, FulfillmentStrategy, GetFilteredProofRequestsRequest, + GetFilteredProofRequestsResponse, GetNonceRequest, GetProgramRequest, GetProgramResponse, + GetProofRequestStatusRequest, GetProofRequestStatusResponse, MessageFormat, ProofMode, + RequestProofRequest, RequestProofRequestBody, RequestProofResponse, }; /// A client for interacting with the network. @@ -61,24 +62,23 @@ impl NetworkClient { /// /// # Details /// The verifying key hash is used to identify a program. - pub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result> { - let vk_hash_str = vk.bytes32(); - let vk_hash = hex::decode(vk_hash_str.strip_prefix("0x").unwrap_or(&vk_hash_str))?; - Ok(vk_hash) + pub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result { + let vk_hash_str = B256::from_str(&vk.bytes32())?; + Ok(vk_hash_str) } /// Registers a program with the network if it is not already registered. - pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result> { + pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result { let vk_hash = Self::get_vk_hash(vk)?; // Try to get the existing program. - if (self.get_program(&vk_hash).await?).is_some() { + if (self.get_program(vk_hash).await?).is_some() { // The program already exists. Ok(vk_hash) } else { // The program doesn't exist, create it. - self.create_program(&vk_hash, vk, elf).await?; - log::info!("Registered program 0x{}", hex::encode(vk_hash.clone())); + self.create_program(vk_hash, vk, elf).await?; + log::info!("Registered program {:?}", vk_hash); Ok(vk_hash) } } @@ -87,7 +87,7 @@ impl NetworkClient { /// /// # Details /// Returns `None` if the program does not exist. - pub async fn get_program(&self, vk_hash: &[u8]) -> Result> { + pub async fn get_program(&self, vk_hash: B256) -> Result> { let mut rpc = self.prover_network_client().await?; match rpc.get_program(GetProgramRequest { vk_hash: vk_hash.to_vec() }).await { StdOk(response) => Ok(Some(response.into_inner())), @@ -99,13 +99,14 @@ impl NetworkClient { /// Creates a new program on the network. pub async fn create_program( &self, - vk_hash: &[u8], + vk_hash: B256, vk: &SP1VerifyingKey, elf: &[u8], ) -> Result { // Create the program artifact. let mut store = self.artifact_store_client().await?; - let program_uri = self.create_artifact_with_content(&mut store, &elf).await?; + let program_uri = + self.create_artifact_with_content(&mut store, ArtifactType::Program, &elf).await?; // Serialize the verifying key. let vk_encoded = bincode::serialize(&vk)?; @@ -130,13 +131,51 @@ impl NetworkClient { .into_inner()) } + /// Get all the proof requests that meet the filter criteria. + #[allow(clippy::too_many_arguments)] + pub async fn get_filtered_proof_requests( + &self, + version: Option, + fulfillment_status: Option, + execution_status: Option, + minimum_deadline: Option, + vk_hash: Option>, + requester: Option>, + fulfiller: Option>, + from: Option, + to: Option, + limit: Option, + page: Option, + mode: Option, + ) -> Result { + let mut rpc = self.prover_network_client().await?; + let res = rpc + .get_filtered_proof_requests(GetFilteredProofRequestsRequest { + version, + fulfillment_status, + execution_status, + minimum_deadline, + vk_hash, + requester, + fulfiller, + from, + to, + limit, + page, + mode, + }) + .await? + .into_inner(); + Ok(res) + } + /// Get the status of a given proof. /// /// # Details /// If the status is Fulfilled, the proof is also returned. pub async fn get_proof_request_status( &self, - request_id: &[u8], + request_id: B256, ) -> Result<(GetProofRequestStatusResponse, Option

)> { let mut rpc = self.prover_network_client().await?; let res = rpc @@ -175,7 +214,7 @@ impl NetworkClient { #[allow(clippy::too_many_arguments)] pub async fn request_proof( &self, - vk_hash: &[u8], + vk_hash: B256, stdin: &SP1Stdin, mode: ProofMode, version: &str, @@ -190,7 +229,8 @@ impl NetworkClient { // Create the stdin artifact. let mut store = self.artifact_store_client().await?; - let stdin_uri = self.create_artifact_with_content(&mut store, &stdin).await?; + let stdin_uri = + self.create_artifact_with_content(&mut store, ArtifactType::Stdin, &stdin).await?; // Send the request. let mut rpc = self.prover_network_client().await?; @@ -248,10 +288,14 @@ impl NetworkClient { pub(crate) async fn create_artifact_with_content( &self, store: &mut ArtifactStoreClient, + artifact_type: ArtifactType, item: &T, ) -> Result { let signature = self.signer.sign_message_sync("create_artifact".as_bytes())?; - let request = CreateArtifactRequest { signature: signature.as_bytes().to_vec() }; + let request = CreateArtifactRequest { + artifact_type: artifact_type.into(), + signature: signature.as_bytes().to_vec(), + }; let response = store.create_artifact(request).await?.into_inner(); let presigned_url = response.artifact_presigned_url; diff --git a/crates/sdk/src/network/error.rs b/crates/sdk/src/network/error.rs new file mode 100644 index 0000000000..3cde6d6047 --- /dev/null +++ b/crates/sdk/src/network/error.rs @@ -0,0 +1,39 @@ +use thiserror::Error; +use tonic::Status; + +/// An error that can occur when interacting with the prover network. +#[derive(Error, Debug)] +pub enum Error { + /// The program execution failed. + #[error("Program simulation failed")] + SimulationFailed, + + /// The proof request is unexecutable. + #[error("Proof request 0x{} is unexecutable", hex::encode(.request_id))] + RequestUnexecutable { + /// The ID of the request that cannot be executed. + request_id: Vec, + }, + + /// The proof request is unfulfillable. + #[error("Proof request 0x{} is unfulfillable", hex::encode(.request_id))] + RequestUnfulfillable { + /// The ID of the request that cannot be fulfilled. + request_id: Vec, + }, + + /// The proof request timed out. + #[error("Proof request 0x{} timed out", hex::encode(.request_id))] + RequestTimedOut { + /// The ID of the request that timed out. + request_id: Vec, + }, + + /// An error occurred while interacting with the RPC server. + #[error("RPC error")] + RpcError(#[from] Status), + + /// An unknown error occurred. + #[error("Other error: {0}")] + Other(#[from] anyhow::Error), +} diff --git a/crates/sdk/src/network/mod.rs b/crates/sdk/src/network/mod.rs index 6cc201f327..9e0dd7ca4e 100644 --- a/crates/sdk/src/network/mod.rs +++ b/crates/sdk/src/network/mod.rs @@ -4,19 +4,21 @@ pub mod client; pub mod prover; -mod sign_message; #[rustfmt::skip] #[allow(missing_docs)] #[allow(clippy::default_trait_access)] #[allow(clippy::too_many_lines)] pub mod proto; pub mod builder; +mod error; pub mod prove; pub mod utils; pub use crate::network::client::NetworkClient; pub use crate::network::proto::network::FulfillmentStrategy; +pub use alloy_primitives::B256; +pub use error::*; -pub(crate) const DEFAULT_PROVER_NETWORK_RPC: &str = "https://rpc.production.succinct.tools/"; +pub(crate) const DEFAULT_NETWORK_RPC_URL: &str = "https://rpc.production.succinct.tools/"; pub(crate) const DEFAULT_TIMEOUT_SECS: u64 = 14400; pub(crate) const DEFAULT_CYCLE_LIMIT: u64 = 100_000_000; diff --git a/crates/sdk/src/network/proto/artifact.rs b/crates/sdk/src/network/proto/artifact.rs index e1ff3ad034..c81469442a 100644 --- a/crates/sdk/src/network/proto/artifact.rs +++ b/crates/sdk/src/network/proto/artifact.rs @@ -4,6 +4,9 @@ pub struct CreateArtifactRequest { /// The signature of the user on a pre-defined message. Used for authentication. #[prost(bytes = "vec", tag = "1")] pub signature: ::prost::alloc::vec::Vec, + /// The type of artifact to create. + #[prost(enumeration = "ArtifactType", tag = "2")] + pub artifact_type: i32, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct CreateArtifactResponse { @@ -14,11 +17,60 @@ pub struct CreateArtifactResponse { #[prost(string, tag = "2")] pub artifact_presigned_url: ::prost::alloc::string::String, } +#[derive( + serde::Serialize, + serde::Deserialize, + Clone, + Copy, + Debug, + PartialEq, + Eq, + Hash, + PartialOrd, + Ord, + ::prost::Enumeration, +)] +#[repr(i32)] +pub enum ArtifactType { + UnspecifiedArtifactType = 0, + /// A program artifact. + Program = 1, + /// A stdin artifact. + Stdin = 2, + /// A proof artifact. + Proof = 3, +} +impl ArtifactType { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + Self::UnspecifiedArtifactType => "UNSPECIFIED_ARTIFACT_TYPE", + Self::Program => "PROGRAM", + Self::Stdin => "STDIN", + Self::Proof => "PROOF", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "UNSPECIFIED_ARTIFACT_TYPE" => Some(Self::UnspecifiedArtifactType), + "PROGRAM" => Some(Self::Program), + "STDIN" => Some(Self::Stdin), + "PROOF" => Some(Self::Proof), + _ => None, + } + } +} /// Generated client implementations. pub mod artifact_store_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::http::Uri; - use tonic::codegen::{Body, Bytes, CompressionEncoding, GrpcMethod, InterceptedService, StdError, http}; + use tonic::codegen::{ + http, Body, Bytes, CompressionEncoding, GrpcMethod, InterceptedService, StdError, + }; #[derive(Debug, Clone)] pub struct ArtifactStoreClient { inner: tonic::client::Grpc, @@ -123,7 +175,10 @@ pub mod artifact_store_client { /// Generated server implementations. pub mod artifact_store_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::{Arc, Body, BoxFuture, CompressionEncoding, Context, EnabledCompressionEncodings, InterceptedService, Poll, StdError, async_trait, empty_body, http}; + use tonic::codegen::{ + async_trait, empty_body, http, Arc, Body, BoxFuture, CompressionEncoding, Context, + EnabledCompressionEncodings, InterceptedService, Poll, StdError, + }; /// Generated trait containing gRPC methods that should be implemented for use with ArtifactStoreServer. #[async_trait] pub trait ArtifactStore: std::marker::Send + std::marker::Sync + 'static { diff --git a/crates/sdk/src/network/proto/mod.rs b/crates/sdk/src/network/proto/mod.rs index 48eb63675a..effcc28d94 100644 --- a/crates/sdk/src/network/proto/mod.rs +++ b/crates/sdk/src/network/proto/mod.rs @@ -1,2 +1,6 @@ +#![allow(clippy::all)] +#![allow(missing_docs)] +#![allow(clippy::pedantic)] + pub mod artifact; pub mod network; diff --git a/crates/sdk/src/network/proto/network.rs b/crates/sdk/src/network/proto/network.rs index 52691b93ab..f68bcdfb24 100644 --- a/crates/sdk/src/network/proto/network.rs +++ b/crates/sdk/src/network/proto/network.rs @@ -254,20 +254,28 @@ pub struct ProofRequest { /// The unix timestamp of when the request was updated. #[prost(uint64, tag = "19")] pub updated_at: u64, - /// The unix timestamp of when the request was fulfilled. + /// The unix timestamp of when the request was fulfilled. Only included if + /// the request has a fulfillment status of FULFILLED. #[prost(uint64, optional, tag = "20")] pub fulfilled_at: ::core::option::Option, /// The transaction hash of the request. #[prost(bytes = "vec", tag = "21")] pub tx_hash: ::prost::alloc::vec::Vec, - /// The cycle count for the request. + /// The cycle used during the execution of the request. Only included if the + /// request has an execution status of EXECUTED. #[prost(uint64, optional, tag = "22")] pub cycles: ::core::option::Option, - /// The amount deducted from the fulfiller's balance. - #[prost(string, optional, tag = "23")] - pub deduction_amount: ::core::option::Option<::prost::alloc::string::String>, - /// The amount refunded to the fulfiller's balance. + /// The public values hash from the execution of the request. Only included if + /// the request has an execution status of EXECUTED. + #[prost(bytes = "vec", optional, tag = "23")] + pub public_values_hash: ::core::option::Option<::prost::alloc::vec::Vec>, + /// The amount deducted from the fulfiller's balance. Only included if the + /// request has a fulfillment status of ASSIGNED. #[prost(string, optional, tag = "24")] + pub deduction_amount: ::core::option::Option<::prost::alloc::string::String>, + /// The amount refunded to the fulfiller's balance. Only included if the + /// request has a fulfillment status of EXECUTED. + #[prost(string, optional, tag = "25")] pub refund_amount: ::core::option::Option<::prost::alloc::string::String>, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] @@ -287,14 +295,22 @@ pub struct GetProofRequestStatusResponse { /// The transaction hash of the request. #[prost(bytes = "vec", tag = "3")] pub request_tx_hash: ::prost::alloc::vec::Vec, + /// The deadline of the request. A request should be ignored if it is past + /// its deadline. + #[prost(uint64, tag = "4")] + pub deadline: u64, /// The optional transaction hash of the proof fulfill. Only included if the /// request has a fulfillment status of FULFILLED. - #[prost(bytes = "vec", optional, tag = "4")] + #[prost(bytes = "vec", optional, tag = "5")] pub fulfill_tx_hash: ::core::option::Option<::prost::alloc::vec::Vec>, /// The optional proof URI, where you can download the result of the request. /// Only included if the request has a fulfillment status of FULFILLED. - #[prost(string, optional, tag = "5")] + #[prost(string, optional, tag = "6")] pub proof_uri: ::core::option::Option<::prost::alloc::string::String>, + /// The optional public values hash from the execution of the request. Only + /// included if the request has an execution status of EXECUTED. + #[prost(bytes = "vec", optional, tag = "7")] + pub public_values_hash: ::core::option::Option<::prost::alloc::vec::Vec>, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct GetProofRequestDetailsRequest { @@ -557,6 +573,38 @@ pub struct RemoveDelegationResponse { #[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] pub struct RemoveDelegationResponseBody {} #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct TerminateDelegationRequest { + /// The message format of the body. + #[prost(enumeration = "MessageFormat", tag = "1")] + pub format: i32, + /// The signature of the sender. + #[prost(bytes = "vec", tag = "2")] + pub signature: ::prost::alloc::vec::Vec, + /// The body of the request. + #[prost(message, optional, tag = "3")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct TerminateDelegationRequestBody { + /// The account nonce of the sender. + #[prost(uint64, tag = "1")] + pub nonce: u64, + /// The address of the owner whose delegation to terminate. + #[prost(bytes = "vec", tag = "2")] + pub owner: ::prost::alloc::vec::Vec, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] +pub struct TerminateDelegationResponse { + /// The transaction hash. + #[prost(bytes = "vec", tag = "1")] + pub tx_hash: ::prost::alloc::vec::Vec, + /// The body of the response. + #[prost(message, optional, tag = "2")] + pub body: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +pub struct TerminateDelegationResponseBody {} +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct AcceptDelegationRequest { /// The message format of the body. #[prost(enumeration = "MessageFormat", tag = "1")] @@ -949,14 +997,17 @@ pub struct Reservation { #[prost(uint64, tag = "5")] pub created_at: u64, } -#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, PartialEq, ::prost::Message)] +#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] pub struct GetFilteredReservationsRequest { + /// Requester address to filter for. + #[prost(bytes = "vec", optional, tag = "1")] + pub requester: ::core::option::Option<::prost::alloc::vec::Vec>, /// The optional maximum number of reservations to return (default is 10, /// maximum is 100). - #[prost(uint32, optional, tag = "1")] + #[prost(uint32, optional, tag = "2")] pub limit: ::core::option::Option, /// The optional page number to return (default is 1). - #[prost(uint32, optional, tag = "2")] + #[prost(uint32, optional, tag = "3")] pub page: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)] @@ -1120,19 +1171,19 @@ pub enum MessageFormat { Json = 2, } impl MessageFormat { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedMessageFormat => "UNSPECIFIED_MESSAGE_FORMAT", Self::Binary => "BINARY", Self::Json => "JSON", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_MESSAGE_FORMAT" => Some(Self::UnspecifiedMessageFormat), "BINARY" => Some(Self::Binary), @@ -1167,11 +1218,11 @@ pub enum ProofMode { Groth16 = 4, } impl ProofMode { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedProofMode => "UNSPECIFIED_PROOF_MODE", Self::Core => "CORE", @@ -1180,8 +1231,8 @@ impl ProofMode { Self::Groth16 => "GROTH16", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_PROOF_MODE" => Some(Self::UnspecifiedProofMode), "CORE" => Some(Self::Core), @@ -1219,11 +1270,11 @@ pub enum FulfillmentStrategy { Auction = 3, } impl FulfillmentStrategy { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedFulfillmentStrategy => "UNSPECIFIED_FULFILLMENT_STRATEGY", Self::Hosted => "HOSTED", @@ -1231,8 +1282,8 @@ impl FulfillmentStrategy { Self::Auction => "AUCTION", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_FULFILLMENT_STRATEGY" => Some(Self::UnspecifiedFulfillmentStrategy), "HOSTED" => Some(Self::Hosted), @@ -1269,11 +1320,11 @@ pub enum FulfillmentStatus { Unfulfillable = 4, } impl FulfillmentStatus { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedFulfillmentStatus => "UNSPECIFIED_FULFILLMENT_STATUS", Self::Requested => "REQUESTED", @@ -1282,8 +1333,8 @@ impl FulfillmentStatus { Self::Unfulfillable => "UNFULFILLABLE", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_FULFILLMENT_STATUS" => Some(Self::UnspecifiedFulfillmentStatus), "REQUESTED" => Some(Self::Requested), @@ -1319,11 +1370,11 @@ pub enum ExecutionStatus { Unexecutable = 3, } impl ExecutionStatus { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedExecutionStatus => "UNSPECIFIED_EXECUTION_STATUS", Self::Unexecuted => "UNEXECUTED", @@ -1331,8 +1382,8 @@ impl ExecutionStatus { Self::Unexecutable => "UNEXECUTABLE", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_EXECUTION_STATUS" => Some(Self::UnspecifiedExecutionStatus), "UNEXECUTED" => Some(Self::Unexecuted), @@ -1373,11 +1424,11 @@ pub enum BalanceOperation { Bid = 6, } impl BalanceOperation { - /// String value of the enum field names used in the `ProtoBuf` definition. + /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable - /// (if the `ProtoBuf` definition does not change) and safe for programmatic use. - #[must_use] pub fn as_str_name(&self) -> &'static str { + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { match self { Self::UnspecifiedBalanceChangeOperation => "UNSPECIFIED_BALANCE_CHANGE_OPERATION", Self::Deposit => "DEPOSIT", @@ -1388,8 +1439,8 @@ impl BalanceOperation { Self::Bid => "BID", } } - /// Creates an enum from field names used in the `ProtoBuf` definition. - #[must_use] pub fn from_str_name(value: &str) -> ::core::option::Option { + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "UNSPECIFIED_BALANCE_CHANGE_OPERATION" => Some(Self::UnspecifiedBalanceChangeOperation), "DEPOSIT" => Some(Self::Deposit), @@ -1406,7 +1457,7 @@ impl BalanceOperation { pub mod prover_network_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::http::Uri; - use tonic::codegen::{Body, Bytes, CompressionEncoding, GrpcMethod, InterceptedService, StdError, http}; + use tonic::codegen::*; #[derive(Debug, Clone)] pub struct ProverNetworkClient { inner: tonic::client::Grpc, @@ -1445,11 +1496,11 @@ pub mod prover_network_client { F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< - http::Request, - Response = http::Response< - >::ResponseBody, + http::Request, + Response = http::Response< + >::ResponseBody, + >, >, - >, >>::Error: Into + std::marker::Send + std::marker::Sync, { @@ -1806,6 +1857,26 @@ pub mod prover_network_client { .insert(GrpcMethod::new("network.ProverNetwork", "RemoveDelegation")); self.inner.unary(req, path, codec).await } + /// Terminate a delegation. Only callable by the delegate of a delegation. + pub async fn terminate_delegation( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result, tonic::Status> + { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = + http::uri::PathAndQuery::from_static("/network.ProverNetwork/TerminateDelegation"); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("network.ProverNetwork", "TerminateDelegation")); + self.inner.unary(req, path, codec).await + } /// Accept a delegation. Only callable by the delegate of a delegation. pub async fn accept_delegation( &mut self, @@ -2181,7 +2252,7 @@ pub mod prover_network_client { /// Generated server implementations. pub mod prover_network_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] - use tonic::codegen::{Arc, Body, BoxFuture, CompressionEncoding, Context, EnabledCompressionEncodings, InterceptedService, Poll, StdError, async_trait, empty_body, http}; + use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with ProverNetworkServer. #[async_trait] pub trait ProverNetwork: std::marker::Send + std::marker::Sync + 'static { @@ -2277,6 +2348,11 @@ pub mod prover_network_server { &self, request: tonic::Request, ) -> std::result::Result, tonic::Status>; + /// Terminate a delegation. Only callable by the delegate of a delegation. + async fn terminate_delegation( + &self, + request: tonic::Request, + ) -> std::result::Result, tonic::Status>; /// Accept a delegation. Only callable by the delegate of a delegation. async fn accept_delegation( &self, @@ -3123,6 +3199,48 @@ pub mod prover_network_server { }; Box::pin(fut) } + "/network.ProverNetwork/TerminateDelegation" => { + #[allow(non_camel_case_types)] + struct TerminateDelegationSvc(pub Arc); + impl + tonic::server::UnaryService + for TerminateDelegationSvc + { + type Response = super::TerminateDelegationResponse; + type Future = BoxFuture, tonic::Status>; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::terminate_delegation(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = TerminateDelegationSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } "/network.ProverNetwork/AcceptDelegation" => { #[allow(non_camel_case_types)] struct AcceptDelegationSvc(pub Arc); diff --git a/crates/sdk/src/network/prove.rs b/crates/sdk/src/network/prove.rs index 2d33ea628a..f7f9a0b676 100644 --- a/crates/sdk/src/network/prove.rs +++ b/crates/sdk/src/network/prove.rs @@ -4,6 +4,7 @@ use std::time::Duration; +use alloy_primitives::B256; use anyhow::Result; use sp1_core_machine::io::SP1Stdin; use sp1_prover::SP1ProvingKey; @@ -23,6 +24,7 @@ pub struct NetworkProveBuilder<'a> { pub(crate) timeout: Option, pub(crate) strategy: FulfillmentStrategy, pub(crate) skip_simulation: bool, + pub(crate) cycle_limit: Option, } impl<'a> NetworkProveBuilder<'a> { @@ -231,6 +233,92 @@ impl<'a> NetworkProveBuilder<'a> { self } + /// Sets the cycle limit for the proof request. + /// + /// # Details + /// The cycle limit determines the maximum number of cycles that the program should take to + /// execute. By default, the cycle limit is determined by simulating the program locally. + /// However, you can manually set it if you know the exact cycle count needed and want to skip + /// the simulation step locally. + /// + /// The cycle limit ensures that a prover on the network will stop generating a proof once the + /// cycle limit is reached, which prevents denial of service attacks. + /// + /// # Example + /// ```rust,no_run + /// use sp1_sdk::{ProverClient, SP1Stdin, Prover}; + /// + /// let elf = &[1, 2, 3]; + /// let stdin = SP1Stdin::new(); + /// + /// let client = ProverClient::builder().network().build(); + /// let (pk, vk) = client.setup(elf); + /// let proof = client.prove(&pk, &stdin) + /// .cycle_limit(1_000_000) // Set 1M cycle limit. + /// .skip_simulation(true) // Skip simulation since the limit is set manually. + /// .run() + /// .unwrap(); + /// ``` + #[must_use] + pub fn cycle_limit(mut self, cycle_limit: u64) -> Self { + self.cycle_limit = Some(cycle_limit); + self + } + + /// Request a proof from the prover network. + /// + /// # Details + /// This method will request a proof from the prover network. If the prover fails to request + /// a proof, the method will return an error. It will not wait for the proof to be generated. + /// + /// # Example + /// ```rust,no_run + /// use sp1_sdk::{ProverClient, SP1Stdin, Prover}; + /// + /// let elf = &[1, 2, 3]; + /// let stdin = SP1Stdin::new(); + /// + /// let client = ProverClient::builder().network().build(); + /// let (pk, vk) = client.setup(elf); + /// let request_id = client.prove(&pk, &stdin) + /// .request() + /// .unwrap(); + /// ``` + pub fn request(self) -> Result { + block_on(self.request_async()) + } + + /// Request a proof from the prover network asynchronously. + /// + /// # Details + /// This method will request a proof from the prover network asynchronously. If the prover fails + /// to request a proof, the method will return an error. It will not wait for the proof to be + /// generated. + /// + /// # Example + /// ```rust,no_run + /// use sp1_sdk::{ProverClient, SP1Stdin, Prover}; + /// + /// tokio_test::block_on(async { + /// let elf = &[1, 2, 3]; + /// let stdin = SP1Stdin::new(); + /// + /// let client = ProverClient::builder().network().build(); + /// let (pk, vk) = client.setup(elf); + /// let request_id = client.prove(&pk, &stdin) + /// .request_async() + /// .await + /// .unwrap(); + /// }) + /// ``` + pub async fn request_async(self) -> Result { + let Self { prover, mode, pk, stdin, timeout, strategy, skip_simulation, cycle_limit } = + self; + prover + .request_proof_impl(pk, &stdin, mode, strategy, timeout, skip_simulation, cycle_limit) + .await + } + /// Run the prover with the built arguments. /// /// # Details @@ -251,19 +339,7 @@ impl<'a> NetworkProveBuilder<'a> { /// .unwrap(); /// ``` pub fn run(self) -> Result { - let Self { prover, mode, pk, stdin, timeout, strategy, mut skip_simulation } = self; - - // Check for deprecated environment variable - if let Ok(val) = std::env::var("SKIP_SIMULATION") { - eprintln!( - "Warning: SKIP_SIMULATION environment variable is deprecated. Please use .skip_simulation() instead." - ); - skip_simulation = matches!(val.to_lowercase().as_str(), "true" | "1"); - } - - sp1_dump(&pk.elf, &stdin); - - block_on(prover.prove_impl(pk, &stdin, mode, strategy, timeout, skip_simulation)) + block_on(self.run_async()) } /// Run the prover with the built arguments asynchronously. @@ -284,7 +360,8 @@ impl<'a> NetworkProveBuilder<'a> { /// .run_async(); /// ``` pub async fn run_async(self) -> Result { - let Self { prover, mode, pk, stdin, timeout, strategy, mut skip_simulation } = self; + let Self { prover, mode, pk, stdin, timeout, strategy, mut skip_simulation, cycle_limit } = + self; // Check for deprecated environment variable if let Ok(val) = std::env::var("SKIP_SIMULATION") { @@ -296,6 +373,6 @@ impl<'a> NetworkProveBuilder<'a> { sp1_dump(&pk.elf, &stdin); - prover.prove_impl(pk, &stdin, mode, strategy, timeout, skip_simulation).await + prover.prove_impl(pk, &stdin, mode, strategy, timeout, skip_simulation, cycle_limit).await } } diff --git a/crates/sdk/src/network/prover.rs b/crates/sdk/src/network/prover.rs index 1f43c4e786..7208e65fe3 100644 --- a/crates/sdk/src/network/prover.rs +++ b/crates/sdk/src/network/prover.rs @@ -9,12 +9,14 @@ use super::prove::NetworkProveBuilder; use super::DEFAULT_CYCLE_LIMIT; use crate::cpu::execute::CpuExecuteBuilder; use crate::cpu::CpuProver; -use crate::network::{DEFAULT_PROVER_NETWORK_RPC, DEFAULT_TIMEOUT_SECS}; +use crate::network::proto::network::GetProofRequestStatusResponse; +use crate::network::{Error, DEFAULT_NETWORK_RPC_URL, DEFAULT_TIMEOUT_SECS}; use crate::{ network::client::NetworkClient, network::proto::network::{ExecutionStatus, FulfillmentStatus, FulfillmentStrategy, ProofMode}, Prover, SP1ProofMode, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; +use alloy_primitives::B256; use anyhow::Result; use backoff::{future::retry, Error as BackoffError, ExponentialBackoff}; use serde::de::DeserializeOwned; @@ -108,6 +110,7 @@ impl NetworkProver { timeout: None, strategy: FulfillmentStrategy::Hosted, skip_simulation: false, + cycle_limit: None, } } @@ -130,20 +133,49 @@ impl NetworkProver { /// /// let vk_hash = client.register_program(&vk, elf); /// ``` - pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result> { + pub async fn register_program(&self, vk: &SP1VerifyingKey, elf: &[u8]) -> Result { self.client.register_program(vk, elf).await } + /// Gets the status of a proof request. + /// + /// # Details + /// * `request_id`: The request ID to get the status of. + /// + /// # Example + /// ```rust,no_run + /// use sp1_sdk::{ProverClient, network::B256}; + /// + /// tokio_test::block_on(async { + /// let request_id = B256::from_slice(&vec![1u8; 32]); + /// let client = ProverClient::builder().network().build(); + /// let (status, maybe_proof) = client.get_proof_status(request_id).await.unwrap(); + /// }) + /// ``` + pub async fn get_proof_status( + &self, + request_id: B256, + ) -> Result<(GetProofRequestStatusResponse, Option)> { + self.client.get_proof_request_status(request_id).await + } + /// Requests a proof from the prover network, returning the request ID. + /// + /// # Details + /// * `vk_hash`: The hash of the verifying key to use for the proof. + /// * `stdin`: The input to use for the proof. + /// * `mode`: The proof mode to use for the proof. + /// * `strategy`: The fulfillment strategy to use for the proof. + /// * `cycle_limit`: The cycle limit to use for the proof. pub(crate) async fn request_proof( &self, - vk_hash: &[u8], + vk_hash: B256, stdin: &SP1Stdin, mode: ProofMode, strategy: FulfillmentStrategy, cycle_limit: u64, timeout: Option, - ) -> Result> { + ) -> Result { // Get the timeout. let timeout_secs = timeout.map_or(DEFAULT_TIMEOUT_SECS, |dur| dur.as_secs()); @@ -176,15 +208,14 @@ impl NetworkProver { .await?; // Log the request ID and transaction hash. - let tx_hash_hex = "0x".to_string() + &hex::encode(response.tx_hash); - let request_id = response.body.unwrap().request_id; - let request_id_hex = "0x".to_string() + &hex::encode(request_id.clone()); - log::info!("Created request {} in transaction {}", request_id_hex, tx_hash_hex); + let tx_hash = B256::from_slice(&response.tx_hash); + let request_id = B256::from_slice(&response.body.unwrap().request_id); + log::info!("Created request {} in transaction {:?}", request_id, tx_hash); - if self.client.rpc_url == DEFAULT_PROVER_NETWORK_RPC { + if self.client.rpc_url == DEFAULT_NETWORK_RPC_URL { log::info!( "View request status at: https://network.succinct.xyz/request/{}", - request_id_hex + request_id ); } @@ -193,9 +224,9 @@ impl NetworkProver { /// Waits for a proof to be generated and returns the proof. If a timeout is supplied, the /// function will return an error if the proof is not generated within the timeout. - pub(crate) async fn wait_proof( + pub async fn wait_proof( &self, - request_id: &[u8], + request_id: B256, timeout: Option, ) -> Result

{ let mut is_assigned = false; @@ -205,7 +236,7 @@ impl NetworkProver { // Calculate the remaining timeout. if let Some(timeout) = timeout { if start_time.elapsed() > timeout { - return Err(anyhow::anyhow!("proof request timed out.")); + return Err(Error::RequestTimedOut { request_id: request_id.to_vec() }.into()); } } let remaining_timeout = timeout.map(|t| { @@ -217,17 +248,24 @@ impl NetworkProver { } }); - // Get status with retries. + // Get the status with retries. let (status, maybe_proof) = with_retry( - || async { self.client.get_proof_request_status::

(request_id).await }, + || async { self.client.get_proof_request_status(request_id).await }, remaining_timeout, "getting proof request status", ) .await?; + // Check the deadline. + if status.deadline < Instant::now().elapsed().as_secs() { + return Err(Error::RequestTimedOut { request_id: request_id.to_vec() }.into()); + } + // Check the execution status. - if status.execution_status == ExecutionStatus::Unexecutable as i32 { - return Err(anyhow::anyhow!("proof request is unexecutable")); + if let Ok(ExecutionStatus::Unexecutable) = + ExecutionStatus::try_from(status.execution_status) + { + return Err(Error::RequestUnexecutable { request_id: request_id.to_vec() }.into()); } // Check the fulfillment status. @@ -237,12 +275,14 @@ impl NetworkProver { } Ok(FulfillmentStatus::Assigned) => { if !is_assigned { - log::info!("proof request assigned, proving..."); + log::info!("Proof request assigned, proving..."); is_assigned = true; } } Ok(FulfillmentStatus::Unfulfillable) => { - return Err(anyhow::anyhow!("proof request is unfulfillable")); + return Err( + Error::RequestUnfulfillable { request_id: request_id.to_vec() }.into() + ); } _ => {} } @@ -251,7 +291,23 @@ impl NetworkProver { } } - /// Requests a proof from the prover network and waits for it to be generated. + #[allow(clippy::too_many_arguments)] + pub(crate) async fn request_proof_impl( + &self, + pk: &SP1ProvingKey, + stdin: &SP1Stdin, + mode: SP1ProofMode, + strategy: FulfillmentStrategy, + timeout: Option, + skip_simulation: bool, + cycle_limit: Option, + ) -> Result { + let vk_hash = self.register_program(&pk.vk, &pk.elf).await?; + let cycle_limit = self.get_cycle_limit(cycle_limit, &pk.elf, stdin, skip_simulation)?; + self.request_proof(vk_hash, stdin, mode.into(), strategy, cycle_limit, timeout).await + } + + #[allow(clippy::too_many_arguments)] pub(crate) async fn prove_impl( &self, pk: &SP1ProvingKey, @@ -260,22 +316,39 @@ impl NetworkProver { strategy: FulfillmentStrategy, timeout: Option, skip_simulation: bool, + cycle_limit: Option, ) -> Result { - let vk_hash = self.register_program(&pk.vk, &pk.elf).await?; - let cycle_limit = self.get_cycle_limit(&pk.elf, stdin, skip_simulation)?; let request_id = self - .request_proof(&vk_hash, stdin, mode.into(), strategy, cycle_limit, timeout) + .request_proof_impl(pk, stdin, mode, strategy, timeout, skip_simulation, cycle_limit) .await?; - self.wait_proof(&request_id, timeout).await + self.wait_proof(request_id, timeout).await } - fn get_cycle_limit(&self, elf: &[u8], stdin: &SP1Stdin, skip_simulation: bool) -> Result { + /// The cycle limit is determined according to the following priority: + /// + /// 1. If a cycle limit was explicitly set by the requester, use the specified value. + /// 2. If simulation is enabled, calculate the limit by simulating the + /// execution of the program. This is the default behavior. + /// 3. Otherwise, use the default cycle limit ([`DEFAULT_CYCLE_LIMIT`]). + fn get_cycle_limit( + &self, + cycle_limit: Option, + elf: &[u8], + stdin: &SP1Stdin, + skip_simulation: bool, + ) -> Result { + if let Some(cycle_limit) = cycle_limit { + return Ok(cycle_limit); + } + if skip_simulation { Ok(DEFAULT_CYCLE_LIMIT) } else { - let (_, report) = self.prover.inner().execute(elf, stdin, SP1Context::default())?; - let cycles = report.total_instruction_count(); - Ok(cycles) + self.prover + .inner() + .execute(elf, stdin, SP1Context::default()) + .map(|(_, report)| report.total_instruction_count()) + .map_err(|_| Error::SimulationFailed.into()) } } } @@ -295,7 +368,7 @@ impl Prover for NetworkProver { stdin: &SP1Stdin, mode: SP1ProofMode, ) -> Result { - block_on(self.prove_impl(pk, stdin, mode, FulfillmentStrategy::Hosted, None, false)) + block_on(self.prove_impl(pk, stdin, mode, FulfillmentStrategy::Hosted, None, false, None)) } } diff --git a/crates/sdk/src/network/utils.rs b/crates/sdk/src/network/utils.rs index d25a49dd19..d4bfccdbe9 100644 --- a/crates/sdk/src/network/utils.rs +++ b/crates/sdk/src/network/utils.rs @@ -6,8 +6,6 @@ use alloy_signer::{Signature, SignerSync}; use prost::Message; -use serde::Serialize; -use thiserror::Error; pub(crate) trait Signable: Message { fn sign(&self, signer: &S) -> Signature; @@ -18,55 +16,3 @@ impl Signable for T { signer.sign_message_sync(&self.encode_to_vec()).unwrap() } } - -#[derive(Error, Debug)] -pub(crate) enum JsonFormatError { - #[error("Serialization error: {0}")] - SerializationError(String), -} - -pub(crate) fn format_json_message(body: &T) -> Result, JsonFormatError> -where - T: Message + Serialize, -{ - match serde_json::to_string(body) { - Ok(json_str) => { - if json_str.starts_with('"') && json_str.ends_with('"') { - let inner = &json_str[1..json_str.len() - 1]; - let unescaped = inner.replace("\\\"", "\""); - Ok(unescaped.into_bytes()) - } else { - Ok(json_str.into_bytes()) - } - } - Err(e) => Err(JsonFormatError::SerializationError(e.to_string())), - } -} - -#[cfg(test)] -mod tests { - use super::*; - use prost::Message as ProstMessage; - use serde::{Deserialize, Serialize}; - - // Test message for JSON formatting. - #[derive(Clone, ProstMessage, Serialize, Deserialize)] - struct TestMessage { - #[prost(string, tag = 1)] - value: String, - } - - #[test] - fn test_format_json_message_simple() { - let msg = TestMessage { value: "hello".to_string() }; - let result = format_json_message(&msg).unwrap(); - assert_eq!(result, b"{\"value\":\"hello\"}"); - } - - #[test] - fn test_format_json_message_with_quotes() { - let msg = TestMessage { value: "hello \"world\"".to_string() }; - let result = format_json_message(&msg).unwrap(); - assert_eq!(result, b"{\"value\":\"hello \\\"world\\\"\"}"); - } -} diff --git a/crates/sdk/src/prover.rs b/crates/sdk/src/prover.rs index 83f04deb95..6e9deff2d4 100644 --- a/crates/sdk/src/prover.rs +++ b/crates/sdk/src/prover.rs @@ -8,11 +8,11 @@ use anyhow::Result; use itertools::Itertools; use p3_field::PrimeField32; use sp1_core_executor::{ExecutionReport, SP1Context}; -use sp1_core_machine::{io::SP1Stdin, SP1_CIRCUIT_VERSION}; +use sp1_core_machine::io::SP1Stdin; use sp1_primitives::io::SP1PublicValues; use sp1_prover::{ components::SP1ProverComponents, CoreSC, InnerSC, SP1CoreProofData, SP1Prover, SP1ProvingKey, - SP1VerifyingKey, + SP1VerifyingKey, SP1_CIRCUIT_VERSION, }; use sp1_stark::{air::PublicValues, MachineVerificationError, Word}; use thiserror::Error; diff --git a/crates/verifier/Cargo.toml b/crates/verifier/Cargo.toml index d3f76c92b3..8781eabe25 100644 --- a/crates/verifier/Cargo.toml +++ b/crates/verifier/Cargo.toml @@ -12,15 +12,25 @@ categories = { workspace = true } [dependencies] bn = { version = "0.6.0", package = "substrate-bn-succinct" } sha2 = { version = "0.10.8", default-features = false } -thiserror-no-std = "2.0.2" +thiserror = { version = "2", default-features = false } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } lazy_static = { version = "1.5.0", default-features = false } +# arkworks +ark-bn254 = { version = "0.4.0", optional = true } +ark-serialize = { version = "0.4.2", optional = true } +ark-ff = { version = "0.4.2", optional = true } +ark-groth16 = { version = "0.4.0", optional = true } +ark-ec = { version = "0.4.0", optional = true } + [dev-dependencies] -sp1-sdk = { workspace = true } +sp1-sdk = { workspace = true, features = ["native-gnark"] } +test-artifacts = { workspace = true } num-bigint = "0.4.6" num-traits = "0.2.19" +cfg-if = "1.0.0" [features] default = ["std"] -std = ["thiserror-no-std/std"] \ No newline at end of file +std = ["thiserror/std"] +ark = ["ark-bn254", "ark-serialize", "ark-ff", "ark-groth16", "ark-ec"] diff --git a/crates/verifier/README.md b/crates/verifier/README.md index 8755cfa7c1..fe5db14221 100644 --- a/crates/verifier/README.md +++ b/crates/verifier/README.md @@ -26,11 +26,7 @@ Run tests with the following command: cargo test --package sp1-verifier ``` -These tests verify the proofs in the [`test_binaries`](./test_binaries) directory. These test binaries -were generated from the fibonacci [groth16](../../examples/fibonacci/script/bin/groth16_bn254.rs) and -[plonk](../../examples/fibonacci/script/bin/plonk_bn254.rs) examples. You can reproduce these proofs -from the examples by running `cargo run --bin groth16_bn254` and `cargo run --bin plonk_bn254` from the -[`examples/fibonacci`](../../examples/fibonacci/) directory. +These tests generate a groth16/plonk proof and verify it. ## Acknowledgements diff --git a/crates/verifier/bn254-vk/groth16_vk.bin b/crates/verifier/bn254-vk/groth16_vk.bin index 9f8074a78af87669f693b1f80e601ac779e684a9..c2a3ddd3b325b805836c812666048a436c92e9a4 100644 GIT binary patch literal 396 zcmV;70dxMwj0|H@#Ib-2GtFg#OJ3~Gz^2CnvM#I3`ahgRiVU`mVm1JX%$DCx!WVUN zR1-^^A)qCd>aMl|!F&hXSqGBlklmN#q)NGW&qW$gV%69T+bc zrD5>z+wgj08P4l5qz@8M?k~Cuj~+NQy5|cTv@6|?c?)44l6~L+Yue^>0lhu(g?yj5 z^WA9#hGW<*n98vq#xO{i1sSzi%FRg*0f$P4?ca?Oen2|xRV$}HdTE%`G22ZH-Mx)) zH70~zZhqyh0cLq8J0O=Bs^6pGry?EXD8HjU2$1wmIr1NQ<@7IF3G=XH6h|W=V}n+E zNcw6Q$=Wv~Wf@-oOxhtVS!>7)@C|(dpYSM|)nNtntqH>b000B*9^J%LZg$4ZQxLUT z#9nBJzn-)pA$f0}!$i5PXd%|+U2Tud*}9V5^b#LSHFzRkgE3HnPeu$HO%5rjQDIr$ qs!v^{k;Ft*6@dc_x|^gwaT7ZK^b_?g#vZ# z_*E7Q2mge#o18{5jzE-UQ8A9DcqXOa8lRzF&Re=b>}vN73x_g0>;q-&g^(!)pIt-40# z2)m)Bo14s)Yn(_Emf()u=RDyPPg?M)TxYXL+PTcJL5XXx6g>XjFpKozc;qSWK>tNT zeJZYK^^q9W#@Pu+K09!Nw000A$XFAn?8IhQ<>@pjX zZIUbu9#O1AgGafViJK_Iy_~n!w-g!D@H&_NMaZ0i9uFY7atxF>jRTZ$#{b4Z8|g>P qK@(%L!wwfQ9tskWG4QD@q9(0u{YDqW%a|qS;wL2l000000002-4Y^ Result { let ar = uncompressed_bytes_to_g1_point(&buffer[..64])?; let bs = uncompressed_bytes_to_g2_point(&buffer[64..192])?; diff --git a/crates/verifier/src/groth16/error.rs b/crates/verifier/src/groth16/error.rs index 36952cb749..18d8e2dcbe 100644 --- a/crates/verifier/src/groth16/error.rs +++ b/crates/verifier/src/groth16/error.rs @@ -1,4 +1,4 @@ -use thiserror_no_std::Error; +use thiserror::Error; #[derive(Debug, Error)] pub enum Groth16Error { diff --git a/crates/verifier/src/groth16/mod.rs b/crates/verifier/src/groth16/mod.rs index a62daaa52f..afd8b603ba 100644 --- a/crates/verifier/src/groth16/mod.rs +++ b/crates/verifier/src/groth16/mod.rs @@ -2,19 +2,25 @@ mod converter; pub mod error; mod verify; +use bn::Fr; pub(crate) use converter::{load_groth16_proof_from_bytes, load_groth16_verifying_key_from_bytes}; -use sha2::{Digest, Sha256}; pub(crate) use verify::*; use error::Groth16Error; -use crate::{bn254_public_values, decode_sp1_vkey_hash, error::Error}; +use crate::{decode_sp1_vkey_hash, error::Error, hash_public_inputs}; + +use alloc::vec::Vec; +use sha2::{Digest, Sha256}; + +#[cfg(feature = "ark")] +pub mod ark_converter; /// A verifier for Groth16 zero-knowledge proofs. #[derive(Debug)] pub struct Groth16Verifier; impl Groth16Verifier { - /// Verifies a Groth16 proof. + /// Verifies an SP1 Groth16 proof, as generated by the SP1 SDK. /// /// # Arguments /// @@ -56,11 +62,45 @@ impl Groth16Verifier { } let sp1_vkey_hash = decode_sp1_vkey_hash(sp1_vkey_hash)?; - let public_inputs = bn254_public_values(&sp1_vkey_hash, sp1_public_inputs); - let proof = load_groth16_proof_from_bytes(&proof[4..])?; - let groth16_vk = load_groth16_verifying_key_from_bytes(groth16_vk)?; + Self::verify_gnark_proof( + &proof[4..], + &[sp1_vkey_hash, hash_public_inputs(sp1_public_inputs)], + groth16_vk, + ) + } + + /// Verifies a Gnark Groth16 proof using raw byte inputs. + /// + /// WARNING: if you're verifying an SP1 proof, you should use [`verify`] instead. + /// This is a lower-level verification method that works directly with raw bytes rather than + /// the SP1 SDK's data structures. + /// + /// # Arguments + /// + /// * `proof` - The raw Groth16 proof bytes (without the 4-byte vkey hash prefix) + /// * `public_inputs` - The public inputs to the circuit + /// * `groth16_vk` - The Groth16 verifying key bytes + /// + /// # Returns + /// + /// A [`Result`] containing unit `()` if the proof is valid, + /// or a [`Groth16Error`] if verification fails. + /// + /// # Note + /// + /// This method expects the raw proof bytes without the 4-byte vkey hash prefix that + /// [`verify`] checks. If you have a complete proof with the prefix, use [`verify`] instead. + pub fn verify_gnark_proof( + proof: &[u8], + public_inputs: &[[u8; 32]], + groth16_vk: &[u8], + ) -> Result<(), Groth16Error> { + let proof = load_groth16_proof_from_bytes(proof).unwrap(); + let groth16_vk = load_groth16_verifying_key_from_bytes(groth16_vk).unwrap(); - verify_groth16_raw(&groth16_vk, &proof, &public_inputs) + let public_inputs = + public_inputs.iter().map(|input| Fr::from_slice(input).unwrap()).collect::>(); + verify_groth16_algebraic(&groth16_vk, &proof, &public_inputs) } } diff --git a/crates/verifier/src/groth16/verify.rs b/crates/verifier/src/groth16/verify.rs index 686e62ff61..636a7f66d6 100644 --- a/crates/verifier/src/groth16/verify.rs +++ b/crates/verifier/src/groth16/verify.rs @@ -46,11 +46,11 @@ fn prepare_inputs(vk: Groth16VerifyingKey, public_inputs: &[Fr]) -> Result Result<(), PlonkError> { + let plonk_vk = load_plonk_verifying_key_from_bytes(plonk_vk).unwrap(); + let proof = load_plonk_proof_from_bytes(proof, plonk_vk.qcp.len()).unwrap(); - verify_plonk_raw(&plonk_vk, &proof, &public_inputs) + let public_inputs = + public_inputs.iter().map(|input| Fr::from_slice(input).unwrap()).collect::>(); + verify_plonk_algebraic(&plonk_vk, &proof, &public_inputs) } } diff --git a/crates/verifier/src/plonk/verify.rs b/crates/verifier/src/plonk/verify.rs index 2240bc726b..3ba28282a9 100644 --- a/crates/verifier/src/plonk/verify.rs +++ b/crates/verifier/src/plonk/verify.rs @@ -33,7 +33,7 @@ pub(crate) struct PlonkVerifyingKey { pub(crate) commitment_constraint_indexes: Vec, } -/// Verifies a PLONK proof +/// Verifies a PLONK proof using algebraic inputs. /// /// # Arguments /// @@ -44,7 +44,7 @@ pub(crate) struct PlonkVerifyingKey { /// # Returns /// /// * `Result` - Returns true if the proof is valid, or an error if verification fails -pub(crate) fn verify_plonk_raw( +pub(crate) fn verify_plonk_algebraic( vk: &PlonkVerifyingKey, proof: &PlonkProof, public_inputs: &[Fr], diff --git a/crates/verifier/src/tests.rs b/crates/verifier/src/tests.rs index 907dc6317a..74983c99de 100644 --- a/crates/verifier/src/tests.rs +++ b/crates/verifier/src/tests.rs @@ -1,42 +1,62 @@ -use sp1_sdk::{install::try_install_circuit_artifacts, SP1ProofWithPublicValues}; - -extern crate std; +use sp1_sdk::{install::try_install_circuit_artifacts, HashableKey, ProverClient, SP1Stdin}; +use test_artifacts::FIBONACCI_ELF; #[test] -#[ignore] fn test_verify_groth16() { - // Location of the serialized SP1ProofWithPublicValues. See README.md for more information. - let proof_file = "test_binaries/fibonacci-groth16.bin"; + // Set up the pk and vk. + let client = ProverClient::from_env(); + let (pk, vk) = client.setup(FIBONACCI_ELF); - // Load the saved proof and extract the proof and public inputs. - let sp1_proof_with_public_values = SP1ProofWithPublicValues::load(proof_file).unwrap(); + // Generate the Groth16 proof. + let sp1_proof_with_public_values = client.prove(&pk, &SP1Stdin::new()).groth16().run().unwrap(); + // Extract the proof and public inputs. let proof = sp1_proof_with_public_values.bytes(); let public_inputs = sp1_proof_with_public_values.public_values.to_vec(); - // This vkey hash was derived by calling `vk.bytes32()` on the verifying key. - let vkey_hash = "0x00e60860c07bfc6e4c480286c0ddbb879674eb47f84b4ef041cf858b17aa0ed1"; + // Get the vkey hash. + let vkey_hash = vk.bytes32(); + cfg_if::cfg_if! { + if #[cfg(feature = "ark")] { + use ark_bn254::Bn254; + use ark_groth16::{r1cs_to_qap::LibsnarkReduction, Groth16}; + use crate::{ + decode_sp1_vkey_hash, hash_public_inputs, load_ark_groth16_verifying_key_from_bytes, + load_ark_proof_from_bytes, load_ark_public_inputs_from_bytes, + }; + let ark_proof = load_ark_proof_from_bytes(&proof[4..]).unwrap(); + let ark_vkey = load_ark_groth16_verifying_key_from_bytes(&crate::GROTH16_VK_BYTES).unwrap(); + + let ark_public_inputs = load_ark_public_inputs_from_bytes( + &decode_sp1_vkey_hash(&vkey_hash).unwrap(), + &hash_public_inputs(&public_inputs), + ); + Groth16::::verify_proof(&ark_vkey.into(), &ark_proof, &ark_public_inputs) + .unwrap(); + } + } - crate::Groth16Verifier::verify(&proof, &public_inputs, vkey_hash, &crate::GROTH16_VK_BYTES) + crate::Groth16Verifier::verify(&proof, &public_inputs, &vkey_hash, &crate::GROTH16_VK_BYTES) .expect("Groth16 proof is invalid"); } #[test] -#[ignore] fn test_verify_plonk() { - // Location of the serialized SP1ProofWithPublicValues. See README.md for more information. - let proof_file = "test_binaries/fibonacci-plonk.bin"; + // Set up the pk and vk. + let client = ProverClient::from_env(); + let (pk, vk) = client.setup(FIBONACCI_ELF); - // Load the saved proof and extract the proof and public inputs. - let sp1_proof_with_public_values = SP1ProofWithPublicValues::load(proof_file).unwrap(); + // Generate the Plonk proof. + let sp1_proof_with_public_values = client.prove(&pk, &SP1Stdin::new()).plonk().run().unwrap(); + // Extract the proof and public inputs. let proof = sp1_proof_with_public_values.bytes(); let public_inputs = sp1_proof_with_public_values.public_values.to_vec(); - // This vkey hash was derived by calling `vk.bytes32()` on the verifying key. - let vkey_hash = "0x00e60860c07bfc6e4c480286c0ddbb879674eb47f84b4ef041cf858b17aa0ed1"; + // Get the vkey hash. + let vkey_hash = vk.bytes32(); - crate::PlonkVerifier::verify(&proof, &public_inputs, vkey_hash, &crate::PLONK_VK_BYTES) + crate::PlonkVerifier::verify(&proof, &public_inputs, &vkey_hash, &crate::PLONK_VK_BYTES) .expect("Plonk proof is invalid"); } diff --git a/crates/verifier/test_binaries/fibonacci-groth16.bin b/crates/verifier/test_binaries/fibonacci-groth16.bin deleted file mode 100644 index 72c58644c3c5fcf1c88b4d24c2ced7efd366b910..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1449 zcmeHHJC0Q`41IhwBP1H8rKTC7k$-XGH9$c_jhw`m*uX3SQBDaZEfO0*Vh^wc7C<)( zz)$m#SONu+auYkg_Q~;49vlvb7d4MVK!r)AlePM4XTU~+z-$J9h&-$@F%Ri14937i zkp@9C(~d^M^^@_-yNm}VZKB<*kqy$CqS#akgv+Qh+{JoFXo@gUYKs*PtlWkvSD_A7 zk_Zp??~;NDYxmKRe97Y22B|iaNELif#zoza@aGH)lSwp%Dlcwzg1RQABS*O$2X1f} zo9nxPqWs+I+hB4*4!w`R4gKw6t*+@`QM<`lrF z9?mEXt1TLBv@M#_iIkVDb%4biH7ZBxrPHW>^(Eq^zR_TB!}tGn@Lva|1NcYAqqCcv%Znf1pPzsF^6c~V zw_k7e$Dfx^zFu6vef9LUeYkge3m=}=+dqzzeOw;@b#_~U@6Hd0vy<Mg-cRP>Q=xAa6%Omkh;}o1TK%j83C!M;36O+p^BIpKnRfo z67T?6`@ZKY=P$Sf@6`G1v-dvT($ZQ>IzN1QdHFS7&qK*|i0hOvy!#x)CdxEM1Q9cj z6*gpyrE}<@7&Ml%EFp{V$ss!MqZpsQTk*xkO?^g~#1h9#oy}cH2fkpNF*W97GG|(> zIAq*T!-uW#fsH0%OA-F-Pu?v`IqjZED_(I}L&m~A&i9<~lZkj`Uaxs0eb5R%$=7kl zr*n$6U%J)id-Cah3|pqG-iafGV;fl^SIKpXz0+prOkv#X%rSK%snYDIYOhr+hG0ne zaBgf`_u8?-QHZS^>&~mgSE>j5q^q{$49;ZHye5YVur4>=(|6tFJ5;g#mAjjerVUjW zS%WG??6`H7uD#}5h8(6IUPo-AICh_yQo`4+>4C6i?Q=CunYV4Ao~ObS;ILKMwRs9# zGXaf8DHi#_Ro(ZX2;mkKM**Qo2$dOmMbn&vDJ`9_0~UAWiuzzL3+&^l4rf&$IoDo{ z-~beAKk_D(R@ZDILNF`Sn`e(ebUb$h4Kh`kp>BJUM{i%iKT29AxVYT)oCIeWf!5us zi6i`cA%U7ev}D)brx8iVaLM2Sya{z4M@mFSJ3#CtT9pCPv?*DQE>yR2&X`*+$aZd} zjY7VSU^p~@dN+tNp2Pxl+gx(ogZ3etPt9!&@PI(giX-0VFvT)S=A3tq8n|c%g zY(>3y&%HBafbtOIBW%Q#o(GX}xFhccio*exKk$I+{U|>7Yr}p5 zA(;kCproiJ=MgFU*Z>nL9q>3yqPvch(%uS%HtO0o1^!WZMztJx1P);qC=5ys0z<~t z31E^0v^fubP^mjhAZ$a4FA46PATOIj1pwNMz}z$i0ULaXgPKs>vq7J}Y)8+;id%Hu zabY5t6sNa?Hrb#qBxY-##$uqcg}`cTL6C;RB83TH2nMr&I_KR9W{&g=FPyMA)#hv) zYb;8{DeE?0_I*&#A+#S`Rc=F^BQD{t5;&%)NN+e2{3T;k0>IIF?A6}xCMVwEd(`q9 zynCQzHtyY50-hxs#skC!ZgCW5acSR2f-Pb!uN`ADB@~O1mOS_+R6j_#u9q;A?WD#3F@Kh=B+ULD0p409Run=8@MzUf@9H@ ziR*JeI&ng92}1Flpq<2AJ_d|iz?cid98$f|ZV%K3(6>Dv?w}zgi;M;+=-}Uybbt#e z1mf%gtY6g$pEf#sC5mhJ>17v6g$wb5TW&;!e&p-Y0>;L}l zH|LxG{Qis2e)i)Zy#G)6qxYZRes|*i_vhp1-@EoLZu}Cx_Wj?+m(Ry1^a=eB3!U-D diff --git a/examples/Cargo.lock b/examples/Cargo.lock index 47cb50cb2c..5a6310d44b 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -68,17 +68,17 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-chains" -version = "0.1.47" +version = "0.1.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18c5c520273946ecf715c0010b4e3503d7eba9893cd9ce6b7fff5654c4a3c470" +checksum = "830045a4421ee38d3ab570d36d4d2b5152c066e72797139224da8de5d5981fd0" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "num_enum 0.7.3", "serde", @@ -92,7 +92,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "629b62e38d471cc15fea534eb7283d2f8a4e8bdb1811bcc5d66dda6cfce6fae1" dependencies = [ "alloy-eips 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-serde 0.3.6", "c-kzg", @@ -101,27 +101,42 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed961a48297c732a5d97ee321aa8bb5009ecadbcb077d8bec90cb54e651629" +checksum = "e88e1edea70787c33e11197d3f32ae380f3db19e6e061e539a5bcf8184a6b326" dependencies = [ - "alloy-eips 0.5.4", - "alloy-primitives 0.8.14", + "alloy-eips 0.8.3", + "alloy-primitives 0.8.15", "alloy-rlp", - "alloy-serde 0.5.4", + "alloy-serde 0.8.3", + "alloy-trie 0.7.6", "auto_impl", "c-kzg", "derive_more 1.0.0", "serde", ] +[[package]] +name = "alloy-consensus-any" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b1bb53f40c0273cd1975573cd457b39213e68584e36d1401d25fd0398a1d65" +dependencies = [ + "alloy-consensus 0.8.3", + "alloy-eips 0.8.3", + "alloy-primitives 0.8.15", + "alloy-rlp", + "alloy-serde 0.8.3", + "serde", +] + [[package]] name = "alloy-eip2930" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "serde", ] @@ -132,7 +147,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "k256", "serde", @@ -140,11 +155,11 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.3.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ffc577390ce50234e02d841214b3dc0bea6aaaae8e04bbf3cb82e9a45da9eb" +checksum = "4c986539255fb839d1533c128e190e557e52ff652c9ef62939e233a81dd93f7e" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "derive_more 1.0.0", "serde", @@ -158,7 +173,7 @@ checksum = "f923dd5fca5f67a43d81ed3ebad0880bd41f6dd0ada930030353ac356c54cd0f" dependencies = [ "alloy-eip2930", "alloy-eip7702 0.1.1", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-serde 0.3.6", "c-kzg", @@ -170,15 +185,15 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69e06cf9c37be824b9d26d6d101114fdde6af0c87de2828b414c05c4b3daa71" +checksum = "5f9fadfe089e9ccc0650473f2d4ef0a28bc015bbca5631d9f0f09e49b557fdb3" dependencies = [ "alloy-eip2930", - "alloy-eip7702 0.3.2", - "alloy-primitives 0.8.14", + "alloy-eip7702 0.4.2", + "alloy-primitives 0.8.15", "alloy-rlp", - "alloy-serde 0.5.4", + "alloy-serde 0.8.3", "c-kzg", "derive_more 1.0.0", "once_cell", @@ -192,18 +207,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a7a18afb0b318616b6b2b0e2e7ac5529d32a966c673b48091c9919e284e6aca" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-serde 0.3.6", "serde", ] [[package]] name = "alloy-json-abi" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac4b22b3e51cac09fd2adfcc73b55f447b4df669f983c13f7894ec82b607c63f" +checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-sol-type-parser", "serde", "serde_json", @@ -211,37 +226,41 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af5979e0d5a7bf9c7eb79749121e8256e59021af611322aee56e77e20776b4b3" +checksum = "e29040b9d5fe2fb70415531882685b64f8efd08dfbd6cc907120650504821105" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-sol-types", "serde", "serde_json", - "thiserror 1.0.69", + "thiserror 2.0.8", "tracing", ] [[package]] name = "alloy-network" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "204237129086ce5dc17a58025e93739b01b45313841f98fa339eb1d780511e57" +checksum = "510cc00b318db0dfccfdd2d032411cfae64fc144aef9679409e014145d3dacc4" dependencies = [ - "alloy-consensus 0.5.4", - "alloy-eips 0.5.4", + "alloy-consensus 0.8.3", + "alloy-consensus-any", + "alloy-eips 0.8.3", "alloy-json-rpc", - "alloy-network-primitives 0.5.4", - "alloy-primitives 0.8.14", - "alloy-rpc-types-eth 0.5.4", - "alloy-serde 0.5.4", + "alloy-network-primitives 0.8.3", + "alloy-primitives 0.8.15", + "alloy-rpc-types-any", + "alloy-rpc-types-eth 0.8.3", + "alloy-serde 0.8.3", "alloy-signer", "alloy-sol-types", "async-trait", "auto_impl", "futures-utils-wasm", - "thiserror 1.0.69", + "serde", + "serde_json", + "thiserror 2.0.8", ] [[package]] @@ -251,21 +270,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94ad40869867ed2d9cd3842b1e800889e5b49e6b92da346e93862b4a741bedf3" dependencies = [ "alloy-eips 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-serde 0.3.6", "serde", ] [[package]] name = "alloy-network-primitives" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514f70ee2a953db21631cd817b13a1571474ec77ddc03d47616d5e8203489fde" +checksum = "9081c099e798b8a2bba2145eb82a9a146f01fc7a35e9ab6e7b43305051f97550" dependencies = [ - "alloy-consensus 0.5.4", - "alloy-eips 0.5.4", - "alloy-primitives 0.8.14", - "alloy-serde 0.5.4", + "alloy-consensus 0.8.3", + "alloy-eips 0.8.3", + "alloy-primitives 0.8.15", + "alloy-serde 0.8.3", "serde", ] @@ -293,9 +312,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" +checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" dependencies = [ "alloy-rlp", "bytes", @@ -322,9 +341,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" +checksum = "f542548a609dca89fcd72b3b9f355928cf844d4363c5eed9c5273a3dd225e097" dependencies = [ "alloy-rlp-derive", "arrayvec 0.7.6", @@ -333,9 +352,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" +checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", @@ -353,6 +372,17 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-rpc-types-any" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed98e1af55a7d856bfa385f30f63d8d56be2513593655c904a8f4a7ec963aa3e" +dependencies = [ + "alloy-consensus-any", + "alloy-rpc-types-eth 0.8.3", + "alloy-serde 0.8.3", +] + [[package]] name = "alloy-rpc-types-eth" version = "0.3.6" @@ -362,7 +392,7 @@ dependencies = [ "alloy-consensus 0.3.6", "alloy-eips 0.3.6", "alloy-network-primitives 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-serde 0.3.6", "alloy-sol-types", @@ -376,16 +406,17 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b034779a4850b4b03f5be5ea674a1cf7d746b2da762b34d1860ab45e48ca27" +checksum = "8737d7a6e37ca7bba9c23e9495c6534caec6760eb24abc9d5ffbaaba147818e1" dependencies = [ - "alloy-consensus 0.5.4", - "alloy-eips 0.5.4", - "alloy-network-primitives 0.5.4", - "alloy-primitives 0.8.14", + "alloy-consensus 0.8.3", + "alloy-consensus-any", + "alloy-eips 0.8.3", + "alloy-network-primitives 0.8.3", + "alloy-primitives 0.8.15", "alloy-rlp", - "alloy-serde 0.5.4", + "alloy-serde 0.8.3", "alloy-sol-types", "derive_more 1.0.0", "itertools 0.13.0", @@ -399,57 +430,57 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "731f75ec5d383107fd745d781619bd9cedf145836c51ecb991623d41278e71fa" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "serde", "serde_json", ] [[package]] name = "alloy-serde" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028e72eaa9703e4882344983cfe7636ce06d8cce104a78ea62fd19b46659efc4" +checksum = "5851bf8d5ad33014bd0c45153c603303e730acc8a209450a7ae6b4a12c2789e2" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "serde", "serde_json", ] [[package]] name = "alloy-signer" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592c185d7100258c041afac51877660c7bf6213447999787197db4842f0e938e" +checksum = "7e10ca565da6500cca015ba35ee424d59798f2e1b85bc0dd8f81dafd401f029a" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "async-trait", "auto_impl", "elliptic-curve", "k256", - "thiserror 1.0.69", + "thiserror 2.0.8", ] [[package]] name = "alloy-signer-local" -version = "0.5.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6614f02fc1d5b079b2a4a5320018317b506fd0a6d67c1fd5542a71201724986c" +checksum = "47fababf5a745133490cde927d48e50267f97d3d1209b9fc9f1d1d666964d172" dependencies = [ - "alloy-consensus 0.5.4", + "alloy-consensus 0.8.3", "alloy-network", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-signer", "async-trait", "k256", "rand 0.8.5", - "thiserror 1.0.69", + "thiserror 2.0.8", ] [[package]] name = "alloy-sol-macro" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bfd7853b65a2b4f49629ec975fee274faf6dff15ab8894c620943398ef283c0" +checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -461,9 +492,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82ec42f342d9a9261699f8078e57a7a4fda8aaa73c1a212ed3987080e6a9cd13" +checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -479,9 +510,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2c50e6a62ee2b4f7ab3c6d0366e5770a21cad426e109c2f40335a1b3aff3df" +checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" dependencies = [ "const-hex", "dunce", @@ -494,9 +525,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac17c6e89a50fb4a758012e4b409d9a0ba575228e69b539fe37d7a1bd507ca4a" +checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" dependencies = [ "serde", "winnow 0.6.20", @@ -504,12 +535,12 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9dc0fffe397aa17628160e16b89f704098bf3c9d74d5d369ebc239575936de5" +checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" dependencies = [ "alloy-json-abi", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-sol-macro", "const-hex", "serde", @@ -521,7 +552,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a46c9c4fdccda7982e7928904bd85fe235a0404ee3d7e197fff13d61eac8b4f" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "derive_more 1.0.0", "hashbrown 0.14.5", @@ -531,6 +562,22 @@ dependencies = [ "tracing", ] +[[package]] +name = "alloy-trie" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5fd8fea044cc9a8c8a50bb6f28e31f0385d820f116c5b98f6f4e55d6e5590b" +dependencies = [ + "alloy-primitives 0.8.15", + "alloy-rlp", + "arrayvec 0.7.6", + "derive_more 1.0.0", + "nybbles", + "serde", + "smallvec", + "tracing", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -751,6 +798,9 @@ name = "arrayvec" version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +dependencies = [ + "serde", +] [[package]] name = "async-stream" @@ -844,9 +894,9 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", - "tower 0.5.1", + "tower 0.5.2", "tower-layer", "tower-service", "tracing", @@ -867,7 +917,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -958,18 +1008,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -1120,18 +1170,18 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" +checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a" dependencies = [ "proc-macro2", "quote", @@ -1194,7 +1244,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.23", + "semver 1.0.24", "serde", "serde_json", "thiserror 1.0.69", @@ -1221,9 +1271,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.2" +version = "1.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "c31a0499c1dc64f458ad13872de75c0eb7e3fdb0e67964610c914b034fc5956e" dependencies = [ "jobserver", "libc", @@ -1281,9 +1331,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1305,9 +1355,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -1315,9 +1365,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -1339,9 +1389,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" @@ -1351,15 +1401,15 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width 0.1.14", - "windows-sys 0.52.0", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", ] [[package]] @@ -1459,9 +1509,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1478,9 +1528,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1969,9 +2019,9 @@ dependencies = [ [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "enr" @@ -2071,9 +2121,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fastrlp" @@ -2177,9 +2227,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" [[package]] name = "form_urlencoded" @@ -2562,9 +2612,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -2583,9 +2633,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http", @@ -2856,7 +2906,7 @@ dependencies = [ "console", "number_prefix", "portable-atomic", - "unicode-width 0.2.0", + "unicode-width", "web-time", ] @@ -2957,10 +3007,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.73" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb15147158e79fd8b8afd0252522769c4f48725460b37338544d8379d94fc8f9" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -3061,9 +3112,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libgit2-sys" @@ -3175,9 +3226,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memuse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" +checksum = "3d97bbf43eb4f088f8ca469930cde17fa036207c9a5e02ccc5107c4e8b17c964" [[package]] name = "mime" @@ -3193,9 +3244,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", ] @@ -3521,7 +3572,7 @@ checksum = "21aad1fbf80d2bcd7406880efc7ba109365f44bbb72896758ddcbfa46bf1592c" dependencies = [ "alloy-consensus 0.3.6", "alloy-eips 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-serde 0.3.6", "derive_more 1.0.0", @@ -3537,7 +3588,7 @@ checksum = "e281fbfc2198b7c0c16457d6524f83d192662bc9f3df70f24c3038d4521616df" dependencies = [ "alloy-eips 0.3.6", "alloy-network-primitives 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rpc-types-eth 0.3.6", "alloy-serde 0.3.6", "cfg-if", @@ -3921,7 +3972,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" name = "patch-testing-program" version = "1.1.0" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "curve25519-dalek", "curve25519-dalek-ng 4.1.1 (git+https://github.com/sp1-patches/curve25519-dalek-ng?tag=curve25519_dalek_ng-v4.1.1-patch-v1)", "ed25519-consensus", @@ -3977,12 +4028,12 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 1.0.69", + "thiserror 2.0.8", "ucd-trie", ] @@ -4170,9 +4221,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -4200,12 +4251,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", - "prost-derive 0.13.3", + "prost-derive 0.13.4", ] [[package]] @@ -4223,9 +4274,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", "itertools 0.13.0", @@ -4262,7 +4313,7 @@ dependencies = [ "rustc-hash 2.1.0", "rustls", "socket2", - "thiserror 2.0.4", + "thiserror 2.0.8", "tokio", "tracing", ] @@ -4281,7 +4332,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.4", + "thiserror 2.0.8", "tinyvec", "tracing", "web-time", @@ -4289,9 +4340,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" dependencies = [ "cfg_aliases", "libc", @@ -4433,9 +4484,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags", ] @@ -4541,7 +4592,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-rustls", "tokio-util", @@ -4590,8 +4641,8 @@ dependencies = [ "alloy-chains", "alloy-eips 0.3.6", "alloy-genesis", - "alloy-primitives 0.8.14", - "alloy-trie", + "alloy-primitives 0.8.15", + "alloy-trie 0.5.3", "auto_impl", "derive_more 1.0.0", "once_cell", @@ -4612,8 +4663,8 @@ dependencies = [ "alloy-consensus 0.3.6", "alloy-eips 0.3.6", "alloy-genesis", - "alloy-primitives 0.8.14", - "alloy-trie", + "alloy-primitives 0.8.15", + "alloy-trie 0.5.3", "bytes", "modular-bitfield", "reth-codecs-derive", @@ -4694,7 +4745,7 @@ version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ "alloy-chains", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "auto_impl", "crc", @@ -4767,7 +4818,7 @@ version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ "alloy-eips 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "derive_more 1.0.0", "nybbles", @@ -4804,7 +4855,7 @@ name = "reth-network-peers" version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "enr", "serde_with", @@ -4818,7 +4869,7 @@ version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ "alloy-chains", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "derive_more 1.0.0", "once_cell", "reth-chainspec", @@ -4847,7 +4898,7 @@ dependencies = [ "alloy-consensus 0.3.6", "alloy-eips 0.3.6", "alloy-genesis", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-rpc-types", "alloy-serde 0.3.6", @@ -4876,7 +4927,7 @@ dependencies = [ "alloy-consensus 0.3.6", "alloy-eips 0.3.6", "alloy-genesis", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-rpc-types-eth 0.3.6", "byteorder", @@ -4894,7 +4945,7 @@ name = "reth-prune-types" version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "bytes", "derive_more 1.0.0", "modular-bitfield", @@ -4923,7 +4974,7 @@ name = "reth-stages-types" version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "bytes", "modular-bitfield", "reth-codecs", @@ -4936,7 +4987,7 @@ name = "reth-static-file-types" version = "1.0.6" source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374182a43a3602aaa953d37aa9217b" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "derive_more 1.0.0", "serde", "strum", @@ -4995,9 +5046,9 @@ source = "git+https://github.com/sp1-patches/reth?tag=rsp-20240830#260c7ed2c9374 dependencies = [ "alloy-consensus 0.3.6", "alloy-genesis", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", - "alloy-trie", + "alloy-trie 0.5.3", "bytes", "derive_more 1.0.0", "itertools 0.13.0", @@ -5060,7 +5111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7a6bff9dbde3370a5ac9555104117f7e6039b3cc76e8d5d9d01899088beca2a" dependencies = [ "alloy-eips 0.3.6", - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "auto_impl", "bitflags", "bitvec", @@ -5119,9 +5170,9 @@ dependencies = [ [[package]] name = "roaring" -version = "0.10.7" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81dc953b2244ddd5e7860cb0bb2a790494b898ef321d4aff8e260efab60cc88" +checksum = "41589aba99537475bf697f2118357cad1c31590c5a1b9f6d9fc4ad6d07503661" dependencies = [ "bytemuck", "byteorder", @@ -5201,7 +5252,7 @@ name = "rsp-client-executor" version = "0.1.0" source = "git+https://github.com/succinctlabs/rsp/?rev=3647076#3647076da6580e30384dd911a3fc50d4bcdb5bc1" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "eyre", "futures", @@ -5234,7 +5285,7 @@ name = "rsp-mpt" version = "0.1.0" source = "git+https://github.com/succinctlabs/rsp/?rev=3647076#3647076da6580e30384dd911a3fc50d4bcdb5bc1" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-rlp", "alloy-rpc-types", "anyhow", @@ -5284,7 +5335,7 @@ dependencies = [ name = "rsp-script" version = "0.1.0" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "bincode", "clap", "rsp-client-executor", @@ -5376,27 +5427,27 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.23", + "semver 1.0.24", ] [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "log", "once_cell", @@ -5430,9 +5481,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time", ] @@ -5498,9 +5549,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" +checksum = "94b13f8ea6177672c49d12ed964cca44836f59621981b04a3e26b87e675181de" dependencies = [ "sdd", ] @@ -5522,9 +5573,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sdd" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" +checksum = "478f121bb72bbf63c52c93011ea1791dca40140dfe13f8336c4c5ac952c33aa9" [[package]] name = "sec1" @@ -5595,9 +5646,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] @@ -5613,9 +5664,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -5641,9 +5692,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -6001,7 +6052,7 @@ version = "4.0.0-rc.3" dependencies = [ "bincode", "ctrlc", - "prost 0.13.3", + "prost 0.13.4", "serde", "sp1-core-machine", "sp1-prover", @@ -6262,7 +6313,7 @@ dependencies = [ name = "sp1-sdk" version = "4.0.0-rc.3" dependencies = [ - "alloy-primitives 0.8.14", + "alloy-primitives 0.8.15", "alloy-signer", "alloy-signer-local", "alloy-sol-types", @@ -6281,7 +6332,7 @@ dependencies = [ "p3-baby-bear", "p3-field", "p3-fri", - "prost 0.13.3", + "prost 0.13.4", "reqwest", "reqwest-middleware", "serde", @@ -6345,7 +6396,7 @@ dependencies = [ "lazy_static", "sha2 0.10.8", "substrate-bn-succinct", - "thiserror-no-std", + "thiserror 2.0.8", ] [[package]] @@ -6584,9 +6635,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0523f59468a2696391f2a772edc089342aacd53c3caa2ac3264e598edf119b" +checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" dependencies = [ "paste", "proc-macro2", @@ -6594,12 +6645,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.2" @@ -6757,11 +6802,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.4" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +checksum = "08f5383f3e0071702bf93ab5ee99b52d26936be9dedd9413067cbdcddcb6141a" dependencies = [ - "thiserror-impl 2.0.4", + "thiserror-impl 2.0.8", ] [[package]] @@ -6777,9 +6822,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.4" +version = "2.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +checksum = "f2f357fcec90b3caef6623a099691be676d033b40a058ac95d2a6ade6fa0c943" dependencies = [ "proc-macro2", "quote", @@ -6879,9 +6924,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -6894,9 +6939,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -6923,12 +6968,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] @@ -6945,9 +6989,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -7021,7 +7065,7 @@ dependencies = [ "hyper-util", "percent-encoding", "pin-project", - "prost 0.13.3", + "prost 0.13.4", "rustls-native-certs", "rustls-pemfile", "socket2", @@ -7056,14 +7100,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -7187,13 +7231,13 @@ dependencies = [ "http", "http-body-util", "hyper", - "prost 0.13.3", + "prost 0.13.4", "reqwest", "serde", "serde_json", "thiserror 1.0.69", "tokio", - "tower 0.5.1", + "tower 0.5.2", "url", ] @@ -7239,12 +7283,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.0" @@ -7358,9 +7396,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21d3b25c3ea1126a2ad5f4f9068483c2af1e64168f847abe863a526b8dbfe00b" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -7369,13 +7407,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52857d4c32e496dc6537646b5b117081e71fd2ff06de792e3577a150627db283" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -7384,9 +7421,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.46" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951fe82312ed48443ac78b66fa43eded9999f738f6022e67aead7b708659e49a" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -7397,9 +7434,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "920b0ffe069571ebbfc9ddc0b36ba305ef65577c94b06262ed793716a1afd981" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -7407,9 +7444,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf59002391099644be3524e23b781fa43d2be0c5aa0719a18c0731b9d195cab6" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -7420,9 +7457,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.96" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5047c5392700766601942795a436d7d2599af60dcc3cc1248c9120bfb0827b0" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-streams" @@ -7439,9 +7476,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.73" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476364ff87d0ae6bfb661053a9104ab312542658c3d8f963b7ace80b6f9b26b9" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/examples/fibonacci/script/Cargo.toml b/examples/fibonacci/script/Cargo.toml index e8b9e5d787..a0ff51a369 100644 --- a/examples/fibonacci/script/Cargo.toml +++ b/examples/fibonacci/script/Cargo.toml @@ -28,6 +28,10 @@ path = "bin/compressed.rs" name = "execute" path = "bin/execute.rs" +[[bin]] +name = "network" +path = "bin/network.rs" + [[bin]] name = "fibonacci-script" path = "src/main.rs" diff --git a/examples/fibonacci/script/bin/network.rs b/examples/fibonacci/script/bin/network.rs new file mode 100644 index 0000000000..153a60949a --- /dev/null +++ b/examples/fibonacci/script/bin/network.rs @@ -0,0 +1,77 @@ +use sp1_sdk::network::Error; +use sp1_sdk::{include_elf, utils, ProverClient, SP1ProofWithPublicValues, SP1Stdin}; + +/// The ELF we want to execute inside the zkVM. +const ELF: &[u8] = include_elf!("fibonacci-program"); + +fn main() { + // Setup logging. + utils::setup_logger(); + + // Create an input stream and write '500' to it. + let n = 1000u32; + + // The input stream that the program will read from using `sp1_zkvm::io::read`. Note that the + // types of the elements in the input stream must match the types being read in the program. + let mut stdin = SP1Stdin::new(); + stdin.write(&n); + + // Create a `ProverClient` method. + let client = ProverClient::from_env(); + + // Generate the proof for the given program and input. + let (pk, vk) = client.setup(ELF); + let proof_result = client.prove(&pk, &stdin).compressed().run(); + + // Handle possible prover network errors. + let mut proof = match proof_result { + Ok(proof) => proof, + Err(e) => { + if let Some(network_error) = e.downcast_ref::() { + match network_error { + Error::RequestUnexecutable { request_id: _ } => { + eprintln!("Program is unexecutable: {}", e); + std::process::exit(1); + } + Error::RequestUnfulfillable { request_id: _ } => { + eprintln!("Proof request cannot be fulfilled: {}", e); + std::process::exit(1); + } + _ => { + eprintln!("Unexpected error: {}", e); + std::process::exit(1); + } + } + } else { + eprintln!("Unexpected error: {}", e); + std::process::exit(1); + } + } + }; + + println!("generated proof"); + + // Read and verify the output. + // + // Note that this output is read from values committed to in the program using + // `sp1_zkvm::io::commit`. + let _ = proof.public_values.read::(); + let a = proof.public_values.read::(); + let b = proof.public_values.read::(); + + println!("a: {}", a); + println!("b: {}", b); + + // Verify proof and public values + client.verify(&proof, &vk).expect("verification failed"); + + // Test a round trip of proof serialization and deserialization. + proof.save("proof-with-pis.bin").expect("saving proof failed"); + let deserialized_proof = + SP1ProofWithPublicValues::load("proof-with-pis.bin").expect("loading proof failed"); + + // Verify the deserialized proof. + client.verify(&deserialized_proof, &vk).expect("verification failed"); + + println!("successfully generated and verified proof for the program!") +} diff --git a/examples/tendermint/script/Cargo.toml b/examples/tendermint/script/Cargo.toml index 8c9e343b84..d7231ebbbe 100644 --- a/examples/tendermint/script/Cargo.toml +++ b/examples/tendermint/script/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] sp1-sdk = { workspace = true } -serde_json = { workspace = true, default-features = false, features = ["alloc"] } +serde_json = { workspace = true } tendermint-light-client-verifier = { version = "0.35.0", default-features = false, features = [ "rust-crypto", ] }