diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index 150b7d3f30..77bead45df 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -20,7 +20,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up git private repo access run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 489cc91052..e57346e040 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,14 +18,14 @@ concurrency: cancel-in-progress: true jobs: - groth16: - name: Groth16 + plonk: + name: Plonk runs-on: runs-on,cpu=64,ram=256,family=m7i+m7a,hdd=80,image=ubuntu22-full-x64 env: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup @@ -35,7 +35,7 @@ jobs: with: command: test toolchain: nightly-2024-04-17 - args: --release -p sp1-sdk -- test_e2e_prove_groth16 --nocapture + args: --release -p sp1-sdk --features plonk -- test_e2e_prove_plonk --nocapture env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native RUST_BACKTRACE: 1 \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 3056dae375..656151dc74 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -13,6 +13,8 @@ on: - "recursion/**" - "derive/**" - "sdk/**" + - "zkvm/**" + - "tests/**" - ".github/workflows/**" merge_group: @@ -28,7 +30,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup @@ -45,7 +47,7 @@ jobs: with: command: test toolchain: nightly-2024-04-17 - args: --release -- --nocapture + args: --release --features plonk env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native RUST_BACKTRACE: 1 @@ -59,7 +61,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup @@ -76,7 +78,7 @@ jobs: with: command: test toolchain: nightly-2024-04-17 - args: --release + args: --release --features plonk env: RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native RUST_BACKTRACE: 1 @@ -90,7 +92,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup @@ -118,7 +120,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup @@ -147,7 +149,7 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup CI uses: ./.github/actions/setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 980780a98c..7e2316c500 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,12 +32,17 @@ jobs: with: pull_token: ${{ secrets.PULL_TOKEN }} + # If it's a nightly release, tag with the release time. If the tag is `main`, we want to use + # `latest` as the tag name. Else, use the tag name as is. - name: Compute release name and tag id: release_info run: | if [[ $IS_NIGHTLY ]]; then echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT echo "release_name=Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT + elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then + echo "tag_name=latest" >> $GITHUB_OUTPUT + echo "release_name=Latest Release" >> $GITHUB_OUTPUT else echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT @@ -260,4 +265,4 @@ jobs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} with: update_existing: true - filename: .github/RELEASE_FAILURE_ISSUE_TEMPLATE.md + filename: .github/RELEASE_FAILURE_ISSUE_TEMPLATE.md \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 6e10c5bfee..bba9a1a133 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "addchain" version = "0.2.0" @@ -15,9 +25,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -28,6 +38,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -55,152 +76,11 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "alloy" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-contract", - "alloy-core", - "alloy-eips", - "alloy-genesis", - "alloy-provider", - "alloy-rpc-client", - "alloy-serde", - "alloy-signer", - "alloy-signer-wallet", - "alloy-transport-http", - "reqwest 0.12.4", -] - -[[package]] -name = "alloy-consensus" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "serde", - "sha2", -] - -[[package]] -name = "alloy-contract" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-network", - "alloy-primitives", - "alloy-provider", - "alloy-rpc-types", - "alloy-sol-types", - "alloy-transport", - "futures", - "futures-util", - "thiserror", -] - -[[package]] -name = "alloy-core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e30b83573b348305b9629a094b5331093a030514cd5713433799495cb283fea1" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-types", -] - -[[package]] -name = "alloy-dyn-abi" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545885d9b0b2c30fd344ae291439b4bfe59e48dd62fbc862f8503d98088967dc" -dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-type-parser", - "alloy-sol-types", - "const-hex", - "itoa", - "serde", - "serde_json", - "winnow 0.6.8", -] - -[[package]] -name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "c-kzg", - "once_cell", - "serde", -] - -[[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", -] - -[[package]] -name = "alloy-json-abi" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786689872ec4e7d354810ab0dffd48bb40b838c047522eb031cbd47d15634849" -dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-json-rpc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-network" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-json-rpc", - "alloy-primitives", - "alloy-rpc-types", - "alloy-signer", - "async-trait", - "futures-utils-wasm", - "serde", - "thiserror", -] - [[package]] name = "alloy-primitives" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525448f6afc1b70dd0f9d0a8145631bf2f5e434678ab23ab18409ca264cae6b3" +checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b" dependencies = [ "alloy-rlp", "bytes", @@ -218,149 +98,36 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-provider" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-network", - "alloy-primitives", - "alloy-rpc-client", - "alloy-rpc-types", - "alloy-rpc-types-trace", - "alloy-transport", - "alloy-transport-http", - "async-stream", - "async-trait", - "auto_impl", - "dashmap", - "futures", - "lru", - "reqwest 0.12.4", - "serde_json", - "tokio", - "tracing", - "url", -] - [[package]] name = "alloy-rlp" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" dependencies = [ - "alloy-rlp-derive", "arrayvec", "bytes", ] [[package]] -name = "alloy-rlp-derive" -version = "0.3.4" +name = "alloy-sol-macro" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +checksum = "7dbd17d67f3e89478c8a634416358e539e577899666c927bc3d2b1328ee9b6ca" dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", -] - -[[package]] -name = "alloy-rpc-client" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "alloy-transport-http", - "futures", - "pin-project", - "reqwest 0.12.4", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "alloy-sol-types", - "itertools 0.12.1", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-rpc-types-trace" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "alloy-serde", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-serde" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-signer" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "async-trait", - "auto_impl", - "elliptic-curve", - "k256", - "thiserror", -] - -[[package]] -name = "alloy-signer-wallet" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-network", - "alloy-primitives", - "alloy-signer", - "async-trait", - "k256", - "rand", - "thiserror", + "syn 2.0.66", ] [[package]] -name = "alloy-sol-macro" -version = "0.7.2" +name = "alloy-sol-macro-expander" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c80a2cb97e7aa48611cbb63950336f9824a174cdf670527cc6465078a26ea1" +checksum = "2c6da95adcf4760bb4b108fefa51d50096c5e5fdd29ee72fed3e86ee414f2e34" dependencies = [ - "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.4.1", @@ -368,81 +135,38 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58894b58ac50979eeac6249661991ac40b9d541830d9a725f7714cc9ef08c23" +checksum = "32c8da04c1343871fb6ce5a489218f9c85323c8340a36e9106b5fc98d4dd59d5" dependencies = [ - "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "serde_json", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", ] -[[package]] -name = "alloy-sol-type-parser" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8e71ea68e780cc203919e03f69f59e7afe92d2696fb1dcb6662f61e4031b6" -dependencies = [ - "winnow 0.6.8", -] - [[package]] name = "alloy-sol-types" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399287f68d1081ed8b1f4903c49687658b95b142207d7cb4ae2f4813915343ef" +checksum = "40a64d2d2395c1ac636b62419a7b17ec39031d6b2367e66e9acbf566e6055e9c" dependencies = [ - "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", "serde", ] -[[package]] -name = "alloy-transport" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "base64 0.22.1", - "futures-util", - "futures-utils-wasm", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "url", - "wasm-bindgen-futures", -] - -[[package]] -name = "alloy-transport-http" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "reqwest 0.12.4", - "serde_json", - "tower", - "url", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -524,9 +248,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" dependencies = [ "backtrace", ] @@ -655,12 +379,6 @@ dependencies = [ "rand", ] -[[package]] -name = "array-macro" -version = "2.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220a2c618ab466efe41d0eace94dfeff1c35e3aa47891bdb95e1c0fefffd3c99" - [[package]] name = "arrayref" version = "0.3.7" @@ -674,37 +392,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] -name = "async-stream" -version = "0.3.5" +name = "async-trait" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", + "proc-macro2", + "quote", + "syn 2.0.66", ] [[package]] -name = "async-stream-impl" -version = "0.3.5" +name = "async_io_stream" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.61", + "futures", + "pharos", + "rustc_version 0.4.0", ] [[package]] -name = "async-trait" -version = "0.1.80" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.61", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "auto_impl" @@ -714,7 +427,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -780,9 +493,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" dependencies = [ "addr2line", "cc", @@ -800,6 +513,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -818,6 +537,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bincode" version = "1.3.3" @@ -836,7 +561,7 @@ dependencies = [ "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -846,7 +571,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.61", + "syn 2.0.66", "which", ] @@ -923,11 +648,6 @@ dependencies = [ "rayon", ] -[[package]] -name = "blake3-zkvm" -version = "0.1.0" -source = "git+https://github.com/sp1-patches/BLAKE3.git?branch=patch-blake3_zkvm/v.1.0.0#bac2d59f9122b07a4d91475560b4c3214ae62444" - [[package]] name = "block-buffer" version = "0.10.4" @@ -951,15 +671,13 @@ dependencies = [ ] [[package]] -name = "blst" -version = "0.3.11" +name = "bs58" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", + "sha2", + "tinyvec", ] [[package]] @@ -989,25 +707,11 @@ dependencies = [ "serde", ] -[[package]] -name = "c-kzg" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "serde", -] - [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] @@ -1043,9 +747,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", "libc", @@ -1107,11 +811,21 @@ dependencies = [ "half", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "a483f3cbf7cec2e153d424d0e92329d816becc6421389bd494375c6065921b9b" dependencies = [ "glob", "libc", @@ -1137,7 +851,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -1149,7 +863,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1158,6 +872,58 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest 0.10.7", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.7", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array 0.14.7", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + [[package]] name = "colorchoice" version = "1.0.1" @@ -1179,9 +945,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" dependencies = [ "cfg-if", "cpufeatures", @@ -1233,15 +999,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" -dependencies = [ - "cfg-if", -] - [[package]] name = "criterion" version = "0.5.1" @@ -1278,28 +1035,6 @@ dependencies = [ "itertools 0.10.5", ] -[[package]] -name = "crossbeam" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1319,20 +1054,11 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -1383,6 +1109,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.2" @@ -1407,14 +1142,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ "darling_core", "darling_macro", @@ -1422,40 +1157,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.61", + "strsim", + "syn 2.0.66", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.61", -] - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", + "syn 2.0.66", ] [[package]] @@ -1502,19 +1224,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "dialoguer" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de" -dependencies = [ - "console", - "shell-words", - "tempfile", - "thiserror", - "zeroize", -] - [[package]] name = "digest" version = "0.9.0" @@ -1557,12 +1266,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "dotenv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" - [[package]] name = "downcast-rs" version = "1.2.1" @@ -1589,80 +1292,372 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] -name = "ecdsa" -version = "0.16.9" +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "tap", + "zeroize", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.7", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-middleware", + "ethers-providers", + "ethers-signers", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "syn 2.0.66", + "toml", + "walkdir", ] [[package]] -name = "either" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" - -[[package]] -name = "elf" -version = "0.7.4" +name = "ethers-contract-derive" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.66", +] [[package]] -name = "elliptic-curve" -version = "0.13.8" +name = "ethers-core" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff 0.13.0", + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", "generic-array 0.14.7", - "group 0.13.0", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "tap", - "zeroize", + "k256", + "num_enum 0.7.2", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.66", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", ] [[package]] -name = "encode_unicode" -version = "0.3.6" +name = "ethers-middleware" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] [[package]] -name = "encoding_rs" -version = "0.8.34" +name = "ethers-providers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" dependencies = [ - "cfg-if", + "async-trait", + "auto_impl", + "base64 0.21.7", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.12", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "equivalent" -version = "1.0.1" +name = "ethers-signers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand", + "sha2", + "thiserror", + "tracing", +] [[package]] -name = "errno" -version = "0.3.9" +name = "eyre" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ - "libc", - "windows-sys 0.52.0", + "indenter", + "once_cell", ] [[package]] @@ -1724,21 +1719,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" - -[[package]] -name = "filetime" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "windows-sys 0.52.0", -] +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "fixed-hash" @@ -1752,16 +1735,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "flate2" -version = "1.0.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1846,6 +1819,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1854,7 +1837,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1869,6 +1852,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + [[package]] name = "futures-util" version = "0.3.30" @@ -1888,10 +1881,13 @@ dependencies = [ ] [[package]] -name = "futures-utils-wasm" -version = "0.1.0" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] [[package]] name = "gcd" @@ -1933,9 +1929,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" @@ -1956,6 +1952,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "group" version = "0.12.1" @@ -2000,15 +2008,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http 1.1.0", "indexmap 2.2.6", "slab", @@ -2066,6 +2074,15 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "heck" version = "0.4.1" @@ -2089,9 +2106,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-literal" @@ -2218,7 +2232,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.4", + "h2 0.4.5", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -2279,9 +2293,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ "bytes", "futures-channel", @@ -2345,6 +2359,24 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -2356,6 +2388,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -2391,11 +2429,20 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -2465,6 +2512,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.7", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "jubjub" version = "0.9.0" @@ -2504,9 +2565,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2529,9 +2590,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libgit2-sys" @@ -2573,9 +2634,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.16" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" +checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" dependencies = [ "cc", "libc", @@ -2585,9 +2646,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -2605,15 +2666,6 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "lru" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "matchers" version = "0.1.0" @@ -2655,9 +2707,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -2675,11 +2727,10 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2826,7 +2877,16 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.5.11", +] + +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive 0.7.2", ] [[package]] @@ -2841,6 +2901,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "num_threads" version = "0.1.7" @@ -2858,9 +2930,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.32.2" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" dependencies = [ "memchr", ] @@ -2872,10 +2944,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "oorandom" -version = "11.1.3" +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] name = "openssl" @@ -2900,7 +2997,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2936,7 +3033,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -2945,7 +3042,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "num-bigint 0.4.5", "p3-field", @@ -2959,7 +3056,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "blake3", "p3-symmetric", @@ -2968,7 +3065,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "ff 0.13.0", "num-bigint 0.4.5", @@ -2982,7 +3079,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -2994,7 +3091,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3007,7 +3104,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -3019,7 +3116,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.5", @@ -3032,7 +3129,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3050,7 +3147,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -3060,7 +3157,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -3069,7 +3166,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-air", "p3-field", @@ -3082,7 +3179,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3096,7 +3193,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "rayon", ] @@ -3104,7 +3201,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -3118,7 +3215,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -3134,7 +3231,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "gcd", "p3-field", @@ -3146,7 +3243,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3156,7 +3253,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-air", @@ -3174,7 +3271,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "serde", ] @@ -3216,9 +3313,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -3232,7 +3329,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.1", + "redox_syscall", "smallvec", "windows-targets 0.52.5", ] @@ -3273,6 +3370,34 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -3290,6 +3415,16 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -3307,7 +3442,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -3346,9 +3481,9 @@ checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "plotters" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" dependencies = [ "num-traits", "plotters-backend", @@ -3359,15 +3494,15 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" +checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" [[package]] name = "plotters-svg" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" dependencies = [ "plotters-backend", ] @@ -3397,7 +3532,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -3408,6 +3543,9 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", "uint", ] @@ -3456,9 +3594,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" dependencies = [ "unicode-ident", ] @@ -3485,9 +3623,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", "prost-derive", @@ -3495,24 +3633,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.61", -] - -[[package]] -name = "prost-types" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" -dependencies = [ - "prost", + "syn 2.0.66", ] [[package]] @@ -3604,15 +3733,6 @@ dependencies = [ "rayon", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.5.1" @@ -3727,10 +3847,9 @@ dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", - "futures-channel", "futures-core", "futures-util", - "h2 0.4.4", + "h2 0.4.5", "http 1.1.0", "http-body 1.0.0", "http-body-util", @@ -3793,6 +3912,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.8" @@ -3804,10 +3938,19 @@ dependencies = [ "getrandom", "libc", "spin 0.9.8", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.52.0", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rlp" version = "0.5.2" @@ -3815,16 +3958,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", + "rlp-derive", "rustc-hex", ] +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rrs-lib" version = "0.1.0" source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" dependencies = [ "downcast-rs", - "num_enum", + "num_enum 0.5.11", "paste", ] @@ -3914,7 +4069,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-webpki 0.101.7", "sct", ] @@ -3926,9 +4081,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", "subtle", "zeroize", ] @@ -3964,26 +4119,26 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ - "ring", + "ring 0.17.8", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -4003,6 +4158,15 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + [[package]] name = "same-file" version = "1.0.6" @@ -4060,14 +4224,26 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] + [[package]] name = "sct" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -4140,24 +4316,36 @@ dependencies = [ "pest", ] +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4181,6 +4369,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4220,7 +4417,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4245,7 +4442,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4271,9 +4468,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" dependencies = [ "cc", "cfg-if", @@ -4288,12 +4485,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shell-words" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" - [[package]] name = "shlex" version = "1.3.0" @@ -4319,6 +4510,18 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint 0.4.5", + "num-traits", + "thiserror", + "time", +] + [[package]] name = "size" version = "0.4.1" @@ -4368,10 +4571,8 @@ dependencies = [ "anyhow", "cargo_metadata", "clap", - "dialoguer", "dirs", "downloader", - "flate2", "futures-util", "hex", "indicatif", @@ -4382,7 +4583,6 @@ dependencies = [ "sp1-core", "sp1-prover", "sp1-sdk", - "tar", "target-lexicon", "tempfile", "tokio", @@ -4398,7 +4598,6 @@ dependencies = [ "arrayref", "bincode", "blake3", - "blake3-zkvm", "cfg-if", "criterion", "curve25519-dalek", @@ -4435,7 +4634,6 @@ dependencies = [ "rrs-lib", "serde", "serde_with", - "serial_test", "size", "snowbridge-amcl", "sp1-derive", @@ -4547,7 +4745,6 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-appender", "tracing-subscriber", ] @@ -4603,8 +4800,6 @@ dependencies = [ "p3-util", "rand", "serde", - "serde_json", - "serial_test", "sp1-core", "sp1-recursion-core", "sp1-recursion-derive", @@ -4659,17 +4854,15 @@ version = "0.1.0" dependencies = [ "bindgen", "cc", - "crossbeam", + "cfg-if", "log", "num-bigint 0.4.5", "p3-baby-bear", "p3-field", "rand", - "reqwest 0.12.4", "serde", "serde_json", "sp1-recursion-compiler", - "subtle-encoding", "tempfile", ] @@ -4677,7 +4870,6 @@ dependencies = [ name = "sp1-recursion-program" version = "0.1.0" dependencies = [ - "array-macro", "itertools 0.12.1", "p3-air", "p3-baby-bear", @@ -4704,13 +4896,15 @@ dependencies = [ name = "sp1-sdk" version = "0.1.0" dependencies = [ - "alloy", + "alloy-primitives", + "alloy-sol-types", "anyhow", "async-trait", "axum", "bincode", + "cfg-if", "dirs", - "dotenv", + "ethers", "futures", "hex", "indicatif", @@ -4720,7 +4914,6 @@ dependencies = [ "p3-field", "p3-matrix", "prost", - "prost-types", "reqwest 0.12.4", "reqwest-middleware", "serde", @@ -4782,12 +4975,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -4799,6 +4986,9 @@ name = "strum" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros", +] [[package]] name = "strum_macros" @@ -4810,7 +5000,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4841,9 +5031,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -4852,14 +5042,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa0cefd02f532035d83cfec82647c6eb53140b0485220760e669f4bad489e36" +checksum = "b8db114c44cf843a8bacd37a146e37987a0b823a0e8bc4fdc610c9c72ab397a5" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4901,17 +5091,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "tar" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" -dependencies = [ - "filetime", - "libc", - "xattr", -] - [[package]] name = "target-lexicon" version = "0.12.14" @@ -4932,22 +5111,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4960,15 +5139,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.3.36" @@ -5063,7 +5233,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -5097,18 +5267,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", - "tokio-util", -] - [[package]] name = "tokio-util" version = "0.7.11" @@ -5122,11 +5280,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.13", +] + [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -5150,6 +5323,19 @@ dependencies = [ "winnow 0.5.40", ] +[[package]] +name = "toml_edit" +version = "0.22.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.9", +] + [[package]] name = "tower" version = "0.4.13" @@ -5190,18 +5376,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-appender" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" -dependencies = [ - "crossbeam-channel", - "thiserror", - "time", - "tracing-subscriber", -] - [[package]] name = "tracing-attributes" version = "0.1.27" @@ -5210,7 +5384,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -5236,6 +5410,16 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -5350,6 +5534,18 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -5373,6 +5569,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "valuable" version = "0.1.0" @@ -5459,7 +5665,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -5493,7 +5699,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5754,9 +5960,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "86c949fede1d13936a99f14fafd3e76fd642b556dd2ce96287fbe2e0151bfac6" dependencies = [ "memchr", ] @@ -5782,23 +5988,31 @@ dependencies = [ ] [[package]] -name = "wyz" -version = "0.5.1" +name = "ws_stream_wasm" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" dependencies = [ - "tap", + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] -name = "xattr" -version = "1.3.1" +name = "wyz" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ - "libc", - "linux-raw-sys", - "rustix", + "tap", ] [[package]] @@ -5824,14 +6038,14 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -5844,7 +6058,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 999ba20936..d88f8b7a60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,26 +30,26 @@ debug = true debug-assertions = true [workspace.dependencies] -p3-air = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-field = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-commit = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-matrix = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } +p3-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-field = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-commit = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-matrix = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } p3-baby-bear = { git = "https://github.com/Plonky3/Plonky3.git", features = [ "nightly-features", -], branch = "sp1" } -p3-util = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-challenger = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-dft = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-fri = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-keccak = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-blake3 = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-symmetric = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } -p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3.git", branch = "sp1" } +], rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-util = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-challenger = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-dft = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-fri = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-keccak = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-keccak-air = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-blake3 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-merkle-tree = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-poseidon2 = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-symmetric = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-uni-stark = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-maybe-rayon = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } +p3-bn254-fr = { git = "https://github.com/Plonky3/Plonky3.git", rev = "3b5265f9d5af36534a46caebf0617595cfb42c5a" } # For local development. diff --git a/book.toml b/book.toml index a3b4a79e6c..e30b6057d5 100644 --- a/book.toml +++ b/book.toml @@ -27,4 +27,4 @@ before = ["links"] [preprocessor.index] -[preprocessor.links] \ No newline at end of file +[preprocessor.links] diff --git a/book/SUMMARY.md b/book/SUMMARY.md index 36a380f466..91624caa07 100644 --- a/book/SUMMARY.md +++ b/book/SUMMARY.md @@ -40,4 +40,4 @@ - [Recommended Settings](./developers/recommended-settings.md) -- [Building Groth16 Artifacts](./developers/building-groth16-artifacts.md) \ No newline at end of file +- [Building Plonk Bn254 Artifacts](./developers/building-plonk-artifacts.md) \ No newline at end of file diff --git a/book/developers/building-groth16-artifacts.md b/book/developers/building-groth16-artifacts.md deleted file mode 100644 index beeb20946e..0000000000 --- a/book/developers/building-groth16-artifacts.md +++ /dev/null @@ -1,7 +0,0 @@ -# Building Groth16 Artifacts - -To build the Groth16 artifacts from scratch, you can use the `Makefile` inside the `prover` directory. - -```shell,noplayground -RUST_LOG=info make groth16 -``` \ No newline at end of file diff --git a/book/developers/building-plonk-artifacts.md b/book/developers/building-plonk-artifacts.md new file mode 100644 index 0000000000..9efd9127d0 --- /dev/null +++ b/book/developers/building-plonk-artifacts.md @@ -0,0 +1,7 @@ +# Building Plonk BN254 Artifacts + +To build the Plonk Bn254 artifacts from scratch, you can use the `Makefile` inside the `prover` directory. + +```shell,noplayground +RUST_LOG=info make plonk-bn254 +``` \ No newline at end of file diff --git a/book/developers/recommended-settings.md b/book/developers/recommended-settings.md index 3bbc6c583b..4c03948685 100644 --- a/book/developers/recommended-settings.md +++ b/book/developers/recommended-settings.md @@ -3,4 +3,4 @@ For developers contributing to the SP1 project, we recommend the following settings: - `FRI_QUERIES=1`: Makes the prover use less bits of security to generate proofs more quickly. -- `SP1_DEV=1`: This will rebuild the Groth16 artifacts everytime they are necessary. \ No newline at end of file +- `SP1_DEV=1`: This will rebuild the Plonk Bn254 artifacts everytime they are necessary. \ No newline at end of file diff --git a/book/getting-started/install.md b/book/getting-started/install.md index 474ea8087e..abd3b34a7f 100644 --- a/book/getting-started/install.md +++ b/book/getting-started/install.md @@ -6,7 +6,7 @@ build the toolchain and CLI from source. ## Requirements - [Rust (Nightly)](https://www.rust-lang.org/tools/install) -- [Go 1.22](https://go.dev/doc/install) +- [Go >1.22.1](https://go.dev/doc/install) ## Option 1: Prebuilt Binaries (Recommended) diff --git a/book/getting-started/quickstart.md b/book/getting-started/quickstart.md index e6c850899b..f5cdbbb7ad 100644 --- a/book/getting-started/quickstart.md +++ b/book/getting-started/quickstart.md @@ -35,38 +35,23 @@ There are 2 directories (each a crate) in the project: We recommend you install the [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) extension. Note that if you use `cargo prove new` inside a monorepo, you will need to add the manifest file to `rust-analyzer.linkedProjects` to get full IDE support. -## Build Program - -Before we can run the program inside the zkVM, we must compile it to a RISCV executable using the `succinct` Rust toolchain. The `cargo prove` CLI tool exposes a `build` command which you can run at the root of the `program` directory to do this. - -The program is a very simple program to compute the `n`-th Fibonacci number. - -```bash -cd program -cargo prove build -``` - -The resulting compiled executable is called an [ELF (Executable and Linkable Format)](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) and contains bytecode that can be executed by the SP1 zkVM. - +## Generate Proof -After running the above command, you can verify that the ELF was generated by looking in the `elf` directory and looking for a file called `riscv32im-succinct-zkvm-elf`: -```bash -ls elf # should show riscv32im-succinct-zkvm-elf -``` +The program simply computes the `n`-th Fibonacci number. -## Generate Proof +Before we can run the program inside the zkVM, it must be compiled to a RISCV executable using the `succinct` Rust toolchain. This is called an [ELF (Executable and Linkable Format)](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format). The `build.rs` file in the `script` directory will use the `cargo prove` toolchain to automatically build the ELF. -To generate a proof, we take the ELF file that was generated in the previous step and execute it within the SP1 zkVM. The code in the `script` directory is already scaffolded with a script that has logic to generate a proof, save the proof to disk, and verify it. +To generate a proof, we take the ELF file generated by the `build.rs` file and execute it within the SP1 zkVM. The code in the `script` directory is already scaffolded with a script that has logic to generate a proof, save the proof to disk, and verify it. ```bash -cd ../script -RUST_LOG=info cargo run --release +cd script +cargo run --release ``` The output should show ``` ... - Compiling fibonacci-script v0.1.0 (/Users/umaroy/Documents/fibonacci/script) + Compiling fibonacci-script v0.1.0 (.../fibonacci/script) Finished release [optimized] target(s) in 26.14s Running `target/release/fibonacci-script` a: 205697230343233228174223751303346572685 @@ -76,4 +61,11 @@ successfully generated and verified proof for the program! The program by default is quite small, so proof generation will only take a few seconds locally. After it completes, the proof will be saved in the `proof-with-io.json` file and also be verified for correctness. -You can play around with how many rounds of Fibonacci are executed by playing around with `n` (by default set to `186`) in the file `script/src/main.rs`. Integer overflow will cause larger `n` to result in non-fibonacci output, although the proof will still be generated and verified. \ No newline at end of file +## Modifying the Program + +You can play around with how many rounds of Fibonacci are executed by playing around with `n` (by default set to `186`) in the file `script/src/main.rs`. Integer overflow will cause larger `n` to result in non-fibonacci output, although the proof will still be generated and verified. + +The ELF will be automatically rebuilt every time you modify the program. You can verify that the ELF was re-generated by looking in the `elf` directory and for a file called `riscv32im-succinct-zkvm-elf`: +```bash +ls elf # should show riscv32im-succinct-zkvm-elf +``` \ No newline at end of file diff --git a/book/verifying-proofs/solidity-and-evm.md b/book/verifying-proofs/solidity-and-evm.md index 0d6375c591..294023c5b8 100644 --- a/book/verifying-proofs/solidity-and-evm.md +++ b/book/verifying-proofs/solidity-and-evm.md @@ -3,20 +3,25 @@ SP1 recently added support for verifying proofs for onchain usecases. To see an end-to-end example of using SP1 for on-chain usecases, refer to the [SP1 Project Template](https://github.com/succinctlabs/sp1-project-template/tree/main). -## Generating a Groth16 Proof +## Generating a Plonk Bn254 Proof -By default, the proofs generated by SP1 are not verifiable onchain, as they are non-constant size and STARK verification on Ethereum is very expensive. To generate a proof that can be verified onchain, we use performant STARK recursion to combine SP1 shard proofs into a single STARK proof and then wrap that in a SNARK proof. Our `ProverClient` has a function for this called `prove_groth16`. Behind the scenes, this function will first generate a normal SP1 proof, then recursively combine all of them into a single proof using the STARK recursion protocol. Finally, the proof is wrapped in a SNARK proof using Groth16. +By default, the proofs generated by SP1 are not verifiable onchain, as they are non-constant size and STARK verification on Ethereum is very expensive. To generate a proof that can be verified onchain, we use performant STARK recursion to combine SP1 shard proofs into a single STARK proof and then wrap that in a SNARK proof. Our `ProverClient` has a function for this called `prove_plonk`. Behind the scenes, this function will first generate a normal SP1 proof, then recursively combine all of them into a single proof using the STARK recursion protocol. Finally, the proof is wrapped in a SNARK proof using PLONK. -**Due to the fact that Groth16 proofs require a trusted setup, the Groth16 prover is only guaranteed to work on official releases of SP1 (i.e., `v.1.0.0-testnet`).** +**The PLONK Bn254 prover is only guaranteed to work on official releases of SP1.** + +To use PLONK proving & verification locally, enable the `plonk` feature flag in the sp1-sdk and ensure that Go >1.22.1 is installed. +```toml +sp1-sdk = { features = ["plonk"] } +``` ### Example ```rust,noplayground -{{#include ../../examples/fibonacci/script/bin/groth16.rs}} +{{#include ../../examples/fibonacci/script/bin/plonk_bn254.rs}} ``` -You can run the above script with `RUST_LOG=info cargo run --bin groth16 --release` in `examples/fibonacci/script`. +You can run the above script with `RUST_LOG=info cargo run --bin plonk_bn254 --release` in `examples/fibonacci/script`. ## Exporting the Verifier Contract @@ -36,7 +41,7 @@ use std::path::PathBuf; fn main() { let contracts_src_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../contracts/src"); - sp1_sdk::artifacts::export_solidity_groth16_verifier(contracts_src_dir) + sp1_sdk::artifacts::export_solidity_plonk_bn254_verifier(contracts_src_dir) .expect("failed to export verifier"); } ``` \ No newline at end of file diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 05ccf8cd93..6831879e6e 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -3,13 +3,11 @@ name = "sp1-cli" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [build-dependencies] vergen = { version = "8", default-features = false, features = [ - "build", - "git", - "git2", + "build", + "git", + "git2", ] } [dependencies] @@ -20,25 +18,22 @@ sp1-prover = { path = "../prover" } sp1-sdk = { path = "../sdk" } sp1-core = { path = "../core" } reqwest = { version = "0.12.4", features = [ - "stream", - "json", - "rustls-tls", + "stream", + "json", + "rustls-tls", ], default-features = false } futures-util = "0.3.30" indicatif = "0.17.8" tokio = { version = "1", features = ["full"] } -tar = "0.4" -flate2 = "1.0" dirs = "5.0" serde = { version = "1", features = ["derive"] } rand = "0.8" downloader = { version = "0.2", default-features = false, features = [ - "rustls-tls", + "rustls-tls", ] } serde_json = "1.0.117" yansi = "1.0.1" hex = "0.4.3" anstyle = "1.0.7" target-lexicon = "0.12.14" -dialoguer = "0.11.0" tempfile = "3.10.1" diff --git a/cli/src/assets/script/main.rs b/cli/src/assets/script/main.rs index 3db922be23..2c699b86ac 100644 --- a/cli/src/assets/script/main.rs +++ b/cli/src/assets/script/main.rs @@ -1,10 +1,14 @@ //! A simple script to generate and verify the proof of a given program. -use sp1_sdk::{ProverClient, SP1Stdin}; +use sp1_sdk::{utils, ProverClient, SP1Stdin}; +/// The ELF we want to execute inside the zkVM. const ELF: &[u8] = include_bytes!("../../program/elf/riscv32im-succinct-zkvm-elf"); fn main() { + // Setup logging. + utils::setup_logger(); + // Generate proof. let mut stdin = SP1Stdin::new(); let n = 186u32; diff --git a/cli/src/commands/config-ci.toml b/cli/src/commands/config-ci.toml index c63e41aa95..29e6ce2f41 100644 --- a/cli/src/commands/config-ci.toml +++ b/cli/src/commands/config-ci.toml @@ -13,4 +13,4 @@ llvm-tools = true channel = "nightly" [llvm] -download-ci-llvm = false \ No newline at end of file +download-ci-llvm = false diff --git a/cli/src/commands/config.toml b/cli/src/commands/config.toml index e6f55259e1..bfb56db6d0 100644 --- a/cli/src/commands/config.toml +++ b/cli/src/commands/config.toml @@ -12,4 +12,4 @@ llvm-tools = true channel = "nightly" [llvm] -download-ci-llvm = false \ No newline at end of file +download-ci-llvm = false diff --git a/core/Cargo.toml b/core/Cargo.toml index 60f98dc7cb..df02550f1a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -34,11 +34,10 @@ sp1-primitives = { path = "../primitives" } anyhow = "1.0.83" amcl = { package = "snowbridge-amcl", version = "1.0.2", default-features = false, features = [ - "bls381", + "bls381", ] } arrayref = "0.3.7" blake3 = "1.5" -blake3-zkvm = { git = "https://github.com/sp1-patches/BLAKE3.git", branch = "patch-blake3_zkvm/v.1.0.0" } cfg-if = "1.0.0" generic-array = { version = "1.0.0", features = ["alloc", "serde"] } typenum = "1.17.0" @@ -57,7 +56,6 @@ strum_macros = "0.26" strum = "0.26" web-time = "1.1.0" rayon-scan = "0.1.1" -serial_test = "3.1.1" thiserror = "1.0.60" num-bigint = { version = "0.4.3", default-features = false } diff --git a/core/benches/main.rs b/core/benches/main.rs index ca63a750fc..f40f3db01a 100644 --- a/core/benches/main.rs +++ b/core/benches/main.rs @@ -1,7 +1,10 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use sp1_core::io::SP1Stdin; use sp1_core::runtime::{Program, Runtime}; -use sp1_core::utils::{prove, BabyBearPoseidon2}; +use sp1_core::utils::{prove, BabyBearPoseidon2, SP1CoreOpts}; #[allow(unreachable_code)] pub fn criterion_benchmark(c: &mut Criterion) { @@ -12,7 +15,7 @@ pub fn criterion_benchmark(c: &mut Criterion) { let elf_path = format!("../programs/demo/{}/elf/riscv32im-succinct-zkvm-elf", p); let program = Program::from_elf(&elf_path); let cycles = { - let mut runtime = Runtime::new(program.clone()); + let mut runtime = Runtime::new(program.clone(), SP1CoreOpts::default()); runtime.run().unwrap(); runtime.state.global_clk }; @@ -24,6 +27,7 @@ pub fn criterion_benchmark(c: &mut Criterion) { black_box(program.clone()), &SP1Stdin::new(), BabyBearPoseidon2::new(), + SP1CoreOpts::default(), ) }) }, diff --git a/core/src/air/builder.rs b/core/src/air/builder.rs index 903aac3045..eba567d920 100644 --- a/core/src/air/builder.rs +++ b/core/src/air/builder.rs @@ -84,6 +84,7 @@ pub trait BaseAirBuilder: AirBuilder + MessageBuilder /// A trait which contains methods for byte interactions in an AIR. pub trait ByteAirBuilder: BaseAirBuilder { /// Sends a byte operation to be processed. + #[allow(clippy::too_many_arguments)] fn send_byte( &mut self, opcode: impl Into, @@ -91,9 +92,19 @@ pub trait ByteAirBuilder: BaseAirBuilder { b: impl Into, c: impl Into, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { - self.send_byte_pair(opcode, a, Self::Expr::zero(), b, c, shard, multiplicity) + self.send_byte_pair( + opcode, + a, + Self::Expr::zero(), + b, + c, + shard, + channel, + multiplicity, + ) } /// Sends a byte operation with two outputs to be processed. @@ -106,6 +117,7 @@ pub trait ByteAirBuilder: BaseAirBuilder { b: impl Into, c: impl Into, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { self.send(AirInteraction::new( @@ -116,6 +128,7 @@ pub trait ByteAirBuilder: BaseAirBuilder { b.into(), c.into(), shard.into(), + channel.into(), ], multiplicity.into(), InteractionKind::Byte, @@ -123,6 +136,7 @@ pub trait ByteAirBuilder: BaseAirBuilder { } /// Receives a byte operation to be processed. + #[allow(clippy::too_many_arguments)] fn receive_byte( &mut self, opcode: impl Into, @@ -130,9 +144,19 @@ pub trait ByteAirBuilder: BaseAirBuilder { b: impl Into, c: impl Into, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { - self.receive_byte_pair(opcode, a, Self::Expr::zero(), b, c, shard, multiplicity) + self.receive_byte_pair( + opcode, + a, + Self::Expr::zero(), + b, + c, + shard, + channel, + multiplicity, + ) } /// Receives a byte operation with two outputs to be processed. @@ -145,6 +169,7 @@ pub trait ByteAirBuilder: BaseAirBuilder { b: impl Into, c: impl Into, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { self.receive(AirInteraction::new( @@ -155,6 +180,7 @@ pub trait ByteAirBuilder: BaseAirBuilder { b.into(), c.into(), shard.into(), + channel.into(), ], multiplicity.into(), InteractionKind::Byte, @@ -219,6 +245,7 @@ pub trait WordAirBuilder: ByteAirBuilder { &mut self, input: &[impl Into + Clone], shard: impl Into + Clone, + channel: impl Into + Clone, mult: impl Into + Clone, ) { let mut index = 0; @@ -229,6 +256,7 @@ pub trait WordAirBuilder: ByteAirBuilder { input[index].clone(), input[index + 1].clone(), shard.clone(), + channel.clone(), mult.clone(), ); index += 2; @@ -240,6 +268,7 @@ pub trait WordAirBuilder: ByteAirBuilder { input[index].clone(), Self::Expr::zero(), shard.clone(), + channel.clone(), mult.clone(), ); } @@ -250,6 +279,7 @@ pub trait WordAirBuilder: ByteAirBuilder { &mut self, input: &[impl Into + Copy], shard: impl Into + Clone, + channel: impl Into + Clone, mult: impl Into + Clone, ) { input.iter().for_each(|limb| { @@ -259,6 +289,7 @@ pub trait WordAirBuilder: ByteAirBuilder { Self::Expr::zero(), Self::Expr::zero(), shard.clone(), + channel.clone(), mult.clone(), ); }); @@ -268,6 +299,7 @@ pub trait WordAirBuilder: ByteAirBuilder { /// A trait which contains methods related to ALU interactions in an AIR. pub trait AluAirBuilder: BaseAirBuilder { /// Sends an ALU operation to be processed. + #[allow(clippy::too_many_arguments)] fn send_alu( &mut self, opcode: impl Into, @@ -275,6 +307,7 @@ pub trait AluAirBuilder: BaseAirBuilder { b: Word>, c: Word>, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { let values = once(opcode.into()) @@ -282,6 +315,7 @@ pub trait AluAirBuilder: BaseAirBuilder { .chain(b.0.into_iter().map(Into::into)) .chain(c.0.into_iter().map(Into::into)) .chain(once(shard.into())) + .chain(once(channel.into())) .collect(); self.send(AirInteraction::new( @@ -292,6 +326,7 @@ pub trait AluAirBuilder: BaseAirBuilder { } /// Receives an ALU operation to be processed. + #[allow(clippy::too_many_arguments)] fn receive_alu( &mut self, opcode: impl Into, @@ -299,6 +334,7 @@ pub trait AluAirBuilder: BaseAirBuilder { b: Word>, c: Word>, shard: impl Into, + channel: impl Into, multiplicity: impl Into, ) { let values = once(opcode.into()) @@ -306,6 +342,7 @@ pub trait AluAirBuilder: BaseAirBuilder { .chain(b.0.into_iter().map(Into::into)) .chain(c.0.into_iter().map(Into::into)) .chain(once(shard.into())) + .chain(once(channel.into())) .collect(); self.receive(AirInteraction::new( @@ -316,9 +353,11 @@ pub trait AluAirBuilder: BaseAirBuilder { } /// Sends an syscall operation to be processed (with "ECALL" opcode). + #[allow(clippy::too_many_arguments)] fn send_syscall( &mut self, shard: impl Into + Clone, + channel: impl Into + Clone, clk: impl Into + Clone, syscall_id: impl Into + Clone, arg1: impl Into + Clone, @@ -328,6 +367,7 @@ pub trait AluAirBuilder: BaseAirBuilder { self.send(AirInteraction::new( vec![ shard.clone().into(), + channel.clone().into(), clk.clone().into(), syscall_id.clone().into(), arg1.clone().into(), @@ -339,9 +379,11 @@ pub trait AluAirBuilder: BaseAirBuilder { } /// Receives a syscall operation to be processed. + #[allow(clippy::too_many_arguments)] fn receive_syscall( &mut self, shard: impl Into + Clone, + channel: impl Into + Clone, clk: impl Into + Clone, syscall_id: impl Into + Clone, arg1: impl Into + Clone, @@ -351,6 +393,7 @@ pub trait AluAirBuilder: BaseAirBuilder { self.receive(AirInteraction::new( vec![ shard.clone().into(), + channel.clone().into(), clk.clone().into(), syscall_id.clone().into(), arg1.clone().into(), @@ -371,6 +414,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { fn eval_memory_access + Clone>( &mut self, shard: impl Into, + channel: impl Into, clk: impl Into, addr: impl Into, memory_access: &impl MemoryCols, @@ -378,13 +422,20 @@ pub trait MemoryAirBuilder: BaseAirBuilder { ) { let do_check: Self::Expr = do_check.into(); let shard: Self::Expr = shard.into(); + let channel: Self::Expr = channel.into(); let clk: Self::Expr = clk.into(); let mem_access = memory_access.access(); self.assert_bool(do_check.clone()); // Verify that the current memory access time is greater than the previous's. - self.eval_memory_access_timestamp(mem_access, do_check.clone(), shard.clone(), clk.clone()); + self.eval_memory_access_timestamp( + mem_access, + do_check.clone(), + shard.clone(), + channel, + clk.clone(), + ); // Add to the memory argument. let addr = addr.into(); @@ -420,6 +471,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { fn eval_memory_access_slice + Copy>( &mut self, shard: impl Into + Copy, + channel: impl Into + Clone, clk: impl Into + Clone, initial_addr: impl Into + Clone, memory_access_slice: &[impl MemoryCols], @@ -428,6 +480,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { for (i, access_slice) in memory_access_slice.iter().enumerate() { self.eval_memory_access( shard, + channel.clone(), clk.clone(), initial_addr.clone().into() + Self::Expr::from_canonical_usize(i * 4), access_slice, @@ -447,6 +500,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { mem_access: &MemoryAccessCols + Clone>, do_check: impl Into, shard: impl Into + Clone, + channel: impl Into + Clone, clk: impl Into, ) { let do_check: Self::Expr = do_check.into(); @@ -487,6 +541,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { mem_access.diff_16bit_limb.clone(), mem_access.diff_8bit_limb.clone(), shard.clone(), + channel.clone(), do_check, ); } @@ -503,6 +558,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { limb_16: impl Into + Clone, limb_8: impl Into + Clone, shard: impl Into + Clone, + channel: impl Into + Clone, do_check: impl Into + Clone, ) { // Verify that value = limb_16 + limb_8 * 2^16. @@ -519,6 +575,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { Self::Expr::zero(), Self::Expr::zero(), shard.clone(), + channel.clone(), do_check.clone(), ); @@ -528,6 +585,7 @@ pub trait MemoryAirBuilder: BaseAirBuilder { Self::Expr::zero(), limb_8, shard.clone(), + channel.clone(), do_check, ) } diff --git a/core/src/air/extension.rs b/core/src/air/extension.rs index ea2a06775f..bac5907092 100644 --- a/core/src/air/extension.rs +++ b/core/src/air/extension.rs @@ -22,7 +22,7 @@ impl BinomialExtension { Self(arr) } - pub fn as_base_slice(&self) -> &[T] { + pub const fn as_base_slice(&self) -> &[T] { &self.0 } diff --git a/core/src/air/interaction.rs b/core/src/air/interaction.rs index 62348083cc..37150c99d3 100644 --- a/core/src/air/interaction.rs +++ b/core/src/air/interaction.rs @@ -9,7 +9,7 @@ pub struct AirInteraction { impl AirInteraction { /// Create a new interaction. - pub fn new(values: Vec, multiplicity: E, kind: InteractionKind) -> Self { + pub const fn new(values: Vec, multiplicity: E, kind: InteractionKind) -> Self { Self { values, multiplicity, diff --git a/core/src/air/polynomial.rs b/core/src/air/polynomial.rs index bee06ebbba..72c9dbd2fc 100644 --- a/core/src/air/polynomial.rs +++ b/core/src/air/polynomial.rs @@ -12,7 +12,7 @@ pub struct Polynomial { impl Polynomial { /// Create a new polynomial from a vector of coefficients. - pub fn new(coefficients: Vec) -> Self { + pub const fn new(coefficients: Vec) -> Self { Self { coefficients } } diff --git a/core/src/air/sub_builder.rs b/core/src/air/sub_builder.rs index d8c391fc4e..cd1f6be8a8 100644 --- a/core/src/air/sub_builder.rs +++ b/core/src/air/sub_builder.rs @@ -12,7 +12,7 @@ pub struct SubMatrixRowSlices, T: Send + Sync> { } impl, T: Send + Sync> SubMatrixRowSlices { - pub fn new(inner: M, column_range: Range) -> Self { + pub const fn new(inner: M, column_range: Range) -> Self { Self { inner, column_range, diff --git a/core/src/alu/add_sub/mod.rs b/core/src/alu/add_sub/mod.rs index 3de0819383..2321427c53 100644 --- a/core/src/alu/add_sub/mod.rs +++ b/core/src/alu/add_sub/mod.rs @@ -35,6 +35,9 @@ pub struct AddSubCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// Instance of `AddOperation` to handle addition logic in `AddSubChip`'s ALU operations. /// It's result will be `a` for the add operation and `b` for the sub operation. pub add_operation: AddOperation, @@ -88,14 +91,20 @@ impl MachineAir for AddSubChip { let cols: &mut AddSubCols = row.as_mut_slice().borrow_mut(); let is_add = event.opcode == Opcode::ADD; cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.is_add = F::from_bool(is_add); cols.is_sub = F::from_bool(!is_add); let operand_1 = if is_add { event.b } else { event.a }; let operand_2 = event.c; - cols.add_operation - .populate(&mut record, event.shard, operand_1, operand_2); + cols.add_operation.populate( + &mut record, + event.shard, + event.channel, + operand_1, + operand_2, + ); cols.operand_1 = Word::from(operand_1); cols.operand_2 = Word::from(operand_2); row @@ -150,6 +159,7 @@ where local.operand_2, local.add_operation, local.shard, + local.channel, local.is_add + local.is_sub, ); @@ -161,6 +171,7 @@ where local.operand_1, local.operand_2, local.shard, + local.channel, local.is_add, ); @@ -171,6 +182,7 @@ where local.add_operation.value, local.operand_2, local.shard, + local.channel, local.is_sub, ); @@ -203,7 +215,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.add_events = vec![AluEvent::new(0, 0, Opcode::ADD, 14, 8, 6)]; + shard.add_events = vec![AluEvent::new(0, 0, 0, Opcode::ADD, 14, 8, 6)]; let chip = AddSubChip::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -216,12 +228,13 @@ mod tests { let mut challenger = config.challenger(); let mut shard = ExecutionRecord::default(); - for _ in 0..1000 { + for i in 0..1000 { let operand_1 = thread_rng().gen_range(0..u32::MAX); let operand_2 = thread_rng().gen_range(0..u32::MAX); let result = operand_1.wrapping_add(operand_2); shard.add_events.push(AluEvent::new( 0, + i % 2, 0, Opcode::ADD, result, @@ -229,12 +242,13 @@ mod tests { operand_2, )); } - for _ in 0..1000 { + for i in 0..1000 { let operand_1 = thread_rng().gen_range(0..u32::MAX); let operand_2 = thread_rng().gen_range(0..u32::MAX); let result = operand_1.wrapping_sub(operand_2); shard.add_events.push(AluEvent::new( 0, + i % 2, 0, Opcode::SUB, result, diff --git a/core/src/alu/bitwise/mod.rs b/core/src/alu/bitwise/mod.rs index 61ae4b1506..3e7227b709 100644 --- a/core/src/alu/bitwise/mod.rs +++ b/core/src/alu/bitwise/mod.rs @@ -28,6 +28,9 @@ pub struct BitwiseCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// The output operand. pub a: Word, @@ -73,6 +76,7 @@ impl MachineAir for BitwiseChip { let c = event.c.to_le_bytes(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.a = Word::from(event.a); cols.b = Word::from(event.b); cols.c = Word::from(event.c); @@ -84,6 +88,7 @@ impl MachineAir for BitwiseChip { for ((b_a, b_b), b_c) in a.into_iter().zip(b).zip(c) { let byte_event = ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::from(event.opcode), a1: b_a as u32, a2: 0, @@ -137,7 +142,15 @@ where // Get a multiplicity of `1` only for a true row. let mult = local.is_xor + local.is_or + local.is_and; for ((a, b), c) in local.a.into_iter().zip(local.b).zip(local.c) { - builder.send_byte(opcode.clone(), a, b, c, local.shard, mult.clone()); + builder.send_byte( + opcode.clone(), + a, + b, + c, + local.shard, + local.channel, + mult.clone(), + ); } // Get the cpu opcode, which corresponds to the opcode being sent in the CPU table. @@ -152,6 +165,7 @@ where local.b, local.c, local.shard, + local.channel, local.is_xor + local.is_or + local.is_and, ); @@ -180,7 +194,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.bitwise_events = vec![AluEvent::new(0, 0, Opcode::XOR, 25, 10, 19)]; + shard.bitwise_events = vec![AluEvent::new(0, 0, 0, Opcode::XOR, 25, 10, 19)]; let chip = BitwiseChip::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -194,9 +208,9 @@ mod tests { let mut shard = ExecutionRecord::default(); shard.bitwise_events = [ - AluEvent::new(0, 0, Opcode::XOR, 25, 10, 19), - AluEvent::new(0, 0, Opcode::OR, 27, 10, 19), - AluEvent::new(0, 0, Opcode::AND, 2, 10, 19), + AluEvent::new(0, 0, 0, Opcode::XOR, 25, 10, 19), + AluEvent::new(0, 1, 0, Opcode::OR, 27, 10, 19), + AluEvent::new(0, 0, 0, Opcode::AND, 2, 10, 19), ] .repeat(1000); let chip = BitwiseChip::default(); diff --git a/core/src/alu/divrem/mod.rs b/core/src/alu/divrem/mod.rs index a94cd5d70b..b54206469f 100644 --- a/core/src/alu/divrem/mod.rs +++ b/core/src/alu/divrem/mod.rs @@ -104,6 +104,9 @@ pub struct DivRemCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// The output operand. pub a: Word, @@ -183,6 +186,9 @@ pub struct DivRemCols { /// Selector to know whether this row is enabled. pub is_real: T, + + /// Column to modify multiplicity for remainder range check event. + pub remainder_check_multiplicity: T, } impl MachineAir for DivRemChip { @@ -218,6 +224,7 @@ impl MachineAir for DivRemChip { cols.b = Word::from(event.b); cols.c = Word::from(event.c); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.is_real = F::one(); cols.is_divu = F::from_bool(event.opcode == Opcode::DIVU); cols.is_remu = F::from_bool(event.opcode == Opcode::REMU); @@ -260,6 +267,7 @@ impl MachineAir for DivRemChip { let most_significant_byte = word.to_le_bytes()[WORD_SIZE - 1]; blu_events.push(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::MSB, a1: get_msb(*word) as u32, a2: 0, @@ -271,6 +279,11 @@ impl MachineAir for DivRemChip { } } + // Calculate the modified multiplicity + { + cols.remainder_check_multiplicity = cols.is_real * cols.is_c_0.result; + } + // Calculate c * quotient + remainder. { let c_times_quotient = { @@ -320,6 +333,7 @@ impl MachineAir for DivRemChip { let lower_multiplication = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::MUL, a: lower_word, @@ -330,6 +344,7 @@ impl MachineAir for DivRemChip { let upper_multiplication = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: { if is_signed_operation(event.opcode) { @@ -348,6 +363,7 @@ impl MachineAir for DivRemChip { let lt_event = if is_signed_operation(event.opcode) { AluEvent { shard: event.shard, + channel: event.channel, opcode: Opcode::SLT, a: 1, b: (remainder as i32).abs() as u32, @@ -357,6 +373,7 @@ impl MachineAir for DivRemChip { } else { AluEvent { shard: event.shard, + channel: event.channel, opcode: Opcode::SLTU, a: 1, b: remainder, @@ -364,14 +381,20 @@ impl MachineAir for DivRemChip { clk: event.clk, } }; - output.add_lt_event(lt_event); + if cols.remainder_check_multiplicity == F::one() { + output.add_lt_event(lt_event); + } } // Range check. { - output.add_u8_range_checks(event.shard, "ient.to_le_bytes()); - output.add_u8_range_checks(event.shard, &remainder.to_le_bytes()); - output.add_u8_range_checks(event.shard, &c_times_quotient); + output.add_u8_range_checks(event.shard, event.channel, "ient.to_le_bytes()); + output.add_u8_range_checks( + event.shard, + event.channel, + &remainder.to_le_bytes(), + ); + output.add_u8_range_checks(event.shard, event.channel, &c_times_quotient); } } @@ -466,6 +489,7 @@ where local.quotient, local.c, local.shard, + local.channel, local.is_real, ); @@ -490,6 +514,7 @@ where local.quotient, local.c, local.shard, + local.channel, local.is_real, ); } @@ -674,6 +699,12 @@ where is_signed * slt + is_unsigned * sltu }; + // Check that the event multiplicity column is computed correctly. + builder.assert_eq( + local.remainder_check_multiplicity, + local.is_c_0.result * local.is_real, + ); + // Dispatch abs(remainder) < max(abs(c), 1), this is equivalent to abs(remainder) < // abs(c) if not division by 0. builder.send_alu( @@ -682,7 +713,8 @@ where local.abs_remainder, local.max_abs_c_or_1, local.shard, - local.is_real, + local.channel, + local.remainder_check_multiplicity, ); } @@ -697,20 +729,43 @@ where for msb_pair in msb_pairs.iter() { let msb = msb_pair.0; let byte = msb_pair.1; - builder.send_byte(opcode, msb, byte, zero.clone(), local.shard, local.is_real); + builder.send_byte( + opcode, + msb, + byte, + zero.clone(), + local.shard, + local.channel, + local.is_real, + ); } } // Range check all the bytes. { - builder.slice_range_check_u8(&local.quotient.0, local.shard, local.is_real); - builder.slice_range_check_u8(&local.remainder.0, local.shard, local.is_real); + builder.slice_range_check_u8( + &local.quotient.0, + local.shard, + local.channel, + local.is_real, + ); + builder.slice_range_check_u8( + &local.remainder.0, + local.shard, + local.channel, + local.is_real, + ); local.carry.iter().for_each(|carry| { builder.assert_bool(*carry); }); - builder.slice_range_check_u8(&local.c_times_quotient, local.shard, local.is_real); + builder.slice_range_check_u8( + &local.c_times_quotient, + local.shard, + local.channel, + local.is_real, + ); } // Check that the flags are boolean. @@ -761,6 +816,7 @@ where local.b, local.c, local.shard, + local.channel, local.is_real, ); } @@ -789,7 +845,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.divrem_events = vec![AluEvent::new(0, 0, Opcode::DIVU, 2, 17, 3)]; + shard.divrem_events = vec![AluEvent::new(0, 0, 0, Opcode::DIVU, 2, 17, 3)]; let chip = DivRemChip::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -842,12 +898,12 @@ mod tests { (Opcode::REM, 0, 1 << 31, neg(1)), ]; for t in divrems.iter() { - divrem_events.push(AluEvent::new(0, 0, t.0, t.1, t.2, t.3)); + divrem_events.push(AluEvent::new(0, 9, 0, t.0, t.1, t.2, t.3)); } // Append more events until we have 1000 tests. for _ in 0..(1000 - divrems.len()) { - divrem_events.push(AluEvent::new(0, 0, Opcode::DIVU, 1, 1, 1)); + divrem_events.push(AluEvent::new(0, 0, 0, Opcode::DIVU, 1, 1, 1)); } let mut shard = ExecutionRecord::default(); diff --git a/core/src/alu/divrem/utils.rs b/core/src/alu/divrem/utils.rs index 61943621ea..f3a7b7070f 100644 --- a/core/src/alu/divrem/utils.rs +++ b/core/src/alu/divrem/utils.rs @@ -29,7 +29,7 @@ pub fn get_quotient_and_remainder(b: u32, c: u32, opcode: Opcode) -> (u32, u32) } /// Calculate the most significant bit of the given 32-bit integer `a`, and returns it as a u8. -pub fn get_msb(a: u32) -> u8 { +pub const fn get_msb(a: u32) -> u8 { ((a >> 31) & 1) as u8 } diff --git a/core/src/alu/lt/mod.rs b/core/src/alu/lt/mod.rs index 7727efc219..91b504181c 100644 --- a/core/src/alu/lt/mod.rs +++ b/core/src/alu/lt/mod.rs @@ -31,6 +31,9 @@ pub struct LtCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// If the opcode is SLT. pub is_slt: T, @@ -116,6 +119,7 @@ impl MachineAir for LtChip { let c = event.c.to_le_bytes(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.a = Word(a.map(F::from_canonical_u8)); cols.b = Word(b.map(F::from_canonical_u8)); cols.c = Word(c.map(F::from_canonical_u8)); @@ -129,6 +133,7 @@ impl MachineAir for LtChip { // Send the masked interaction. new_byte_lookup_events.add_byte_lookup_event(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::AND, a1: masked_b as u32, a2: 0, @@ -137,6 +142,7 @@ impl MachineAir for LtChip { }); new_byte_lookup_events.add_byte_lookup_event(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::AND, a1: masked_c as u32, a2: 0, @@ -191,6 +197,7 @@ impl MachineAir for LtChip { new_byte_lookup_events.add_byte_lookup_event(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::LTU, a1: cols.sltu.as_canonical_u32(), a2: 0, @@ -270,6 +277,7 @@ where local.b[3], AB::F::from_canonical_u8(0x7f), local.shard, + local.channel, is_real.clone(), ); builder.send_byte( @@ -278,6 +286,7 @@ where local.c[3], AB::F::from_canonical_u8(0x7f), local.shard, + local.channel, is_real.clone(), ); @@ -398,6 +407,7 @@ where b_comp_byte, c_comp_byte, local.shard, + local.channel, is_real.clone(), ); @@ -420,6 +430,7 @@ where local.b, local.c, local.shard, + local.channel, is_real, ); } @@ -447,7 +458,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.lt_events = vec![AluEvent::new(0, 0, Opcode::SLT, 0, 3, 2)]; + shard.lt_events = vec![AluEvent::new(0, 1, 0, Opcode::SLT, 0, 3, 2)]; let chip = LtChip::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -475,21 +486,21 @@ mod tests { const NEG_4: u32 = 0b11111111111111111111111111111100; shard.lt_events = vec![ // 0 == 3 < 2 - AluEvent::new(0, 0, Opcode::SLT, 0, 3, 2), + AluEvent::new(0, 0, 0, Opcode::SLT, 0, 3, 2), // 1 == 2 < 3 - AluEvent::new(0, 1, Opcode::SLT, 1, 2, 3), + AluEvent::new(0, 0, 1, Opcode::SLT, 1, 2, 3), // 0 == 5 < -3 - AluEvent::new(0, 3, Opcode::SLT, 0, 5, NEG_3), + AluEvent::new(0, 0, 3, Opcode::SLT, 0, 5, NEG_3), // 1 == -3 < 5 - AluEvent::new(0, 2, Opcode::SLT, 1, NEG_3, 5), + AluEvent::new(0, 0, 2, Opcode::SLT, 1, NEG_3, 5), // 0 == -3 < -4 - AluEvent::new(0, 4, Opcode::SLT, 0, NEG_3, NEG_4), + AluEvent::new(0, 0, 4, Opcode::SLT, 0, NEG_3, NEG_4), // 1 == -4 < -3 - AluEvent::new(0, 4, Opcode::SLT, 1, NEG_4, NEG_3), + AluEvent::new(0, 0, 4, Opcode::SLT, 1, NEG_4, NEG_3), // 0 == 3 < 3 - AluEvent::new(0, 5, Opcode::SLT, 0, 3, 3), + AluEvent::new(0, 0, 5, Opcode::SLT, 0, 3, 3), // 0 == -3 < -3 - AluEvent::new(0, 5, Opcode::SLT, 0, NEG_3, NEG_3), + AluEvent::new(0, 0, 5, Opcode::SLT, 0, NEG_3, NEG_3), ]; prove_babybear_template(&mut shard); @@ -502,17 +513,17 @@ mod tests { const LARGE: u32 = 0b11111111111111111111111111111101; shard.lt_events = vec![ // 0 == 3 < 2 - AluEvent::new(0, 0, Opcode::SLTU, 0, 3, 2), + AluEvent::new(0, 0, 0, Opcode::SLTU, 0, 3, 2), // 1 == 2 < 3 - AluEvent::new(0, 1, Opcode::SLTU, 1, 2, 3), + AluEvent::new(0, 0, 1, Opcode::SLTU, 1, 2, 3), // 0 == LARGE < 5 - AluEvent::new(0, 2, Opcode::SLTU, 0, LARGE, 5), + AluEvent::new(0, 0, 2, Opcode::SLTU, 0, LARGE, 5), // 1 == 5 < LARGE - AluEvent::new(0, 3, Opcode::SLTU, 1, 5, LARGE), + AluEvent::new(0, 0, 3, Opcode::SLTU, 1, 5, LARGE), // 0 == 0 < 0 - AluEvent::new(0, 5, Opcode::SLTU, 0, 0, 0), + AluEvent::new(0, 0, 5, Opcode::SLTU, 0, 0, 0), // 0 == LARGE < LARGE - AluEvent::new(0, 5, Opcode::SLTU, 0, LARGE, LARGE), + AluEvent::new(0, 0, 5, Opcode::SLTU, 0, LARGE, LARGE), ]; prove_babybear_template(&mut shard); diff --git a/core/src/alu/mod.rs b/core/src/alu/mod.rs index 1f780988b3..c667c612c8 100644 --- a/core/src/alu/mod.rs +++ b/core/src/alu/mod.rs @@ -24,6 +24,9 @@ pub struct AluEvent { /// The shard number, used for byte lookup table. pub shard: u32, + /// The channel number, used for byte lookup table. + pub channel: u32, + /// The clock cycle that the operation occurs on. pub clk: u32, @@ -42,9 +45,10 @@ pub struct AluEvent { impl AluEvent { /// Creates a new `AluEvent`. - pub fn new(shard: u32, clk: u32, opcode: Opcode, a: u32, b: u32, c: u32) -> Self { + pub fn new(shard: u32, channel: u32, clk: u32, opcode: Opcode, a: u32, b: u32, c: u32) -> Self { Self { shard, + channel, clk, opcode, a, diff --git a/core/src/alu/mul/mod.rs b/core/src/alu/mul/mod.rs index 32a15fef94..c30a59c4f4 100644 --- a/core/src/alu/mul/mod.rs +++ b/core/src/alu/mul/mod.rs @@ -76,6 +76,9 @@ pub struct MulCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// The output operand. pub a: Word, @@ -191,6 +194,7 @@ impl MachineAir for MulChip { let most_significant_byte = word[WORD_SIZE - 1]; blu_events.push(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::MSB, a1: get_msb(*word) as u32, a2: 0, @@ -234,11 +238,16 @@ impl MachineAir for MulChip { cols.is_mulhu = F::from_bool(event.opcode == Opcode::MULHU); cols.is_mulhsu = F::from_bool(event.opcode == Opcode::MULHSU); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); // Range check. { - record.add_u16_range_checks(event.shard, &carry); - record.add_u8_range_checks(event.shard, &product.map(|x| x as u8)); + record.add_u16_range_checks(event.shard, event.channel, &carry); + record.add_u8_range_checks( + event.shard, + event.channel, + &product.map(|x| x as u8), + ); } row }) @@ -299,7 +308,15 @@ where for msb_pair in msb_pairs.iter() { let msb = msb_pair.0; let byte = msb_pair.1; - builder.send_byte(opcode, msb, byte, zero.clone(), local.shard, local.is_real); + builder.send_byte( + opcode, + msb, + byte, + zero.clone(), + local.shard, + local.channel, + local.is_real, + ); } (local.b_msb, local.c_msb) }; @@ -425,9 +442,9 @@ where // Ensure that the carry is at most 2^16. This ensures that // product_before_carry_propagation - carry * base + last_carry never overflows or // underflows enough to "wrap" around to create a second solution. - builder.slice_range_check_u16(&local.carry, local.shard, local.is_real); + builder.slice_range_check_u16(&local.carry, local.shard, local.channel, local.is_real); - builder.slice_range_check_u8(&local.product, local.shard, local.is_real); + builder.slice_range_check_u8(&local.product, local.shard, local.channel, local.is_real); } // Receive the arguments. @@ -437,6 +454,7 @@ where local.b, local.c, local.shard, + local.channel, local.is_real, ); } @@ -469,6 +487,7 @@ mod tests { let mut mul_events: Vec = Vec::new(); for _ in 0..10i32.pow(7) { mul_events.push(AluEvent::new( + 0, 0, 0, Opcode::MULHSU, @@ -544,12 +563,12 @@ mod tests { (Opcode::MULH, 0xffffffff, 0x00000001, 0xffffffff), ]; for t in mul_instructions.iter() { - mul_events.push(AluEvent::new(0, 0, t.0, t.1, t.2, t.3)); + mul_events.push(AluEvent::new(0, 0, 0, t.0, t.1, t.2, t.3)); } // Append more events until we have 1000 tests. for _ in 0..(1000 - mul_instructions.len()) { - mul_events.push(AluEvent::new(0, 0, Opcode::MUL, 1, 1, 1)); + mul_events.push(AluEvent::new(0, 0, 0, Opcode::MUL, 1, 1, 1)); } shard.mul_events = mul_events; diff --git a/core/src/alu/mul/utils.rs b/core/src/alu/mul/utils.rs index a7ac8864e8..db2914aca7 100644 --- a/core/src/alu/mul/utils.rs +++ b/core/src/alu/mul/utils.rs @@ -2,6 +2,6 @@ use crate::air::WORD_SIZE; use super::BYTE_SIZE; -pub fn get_msb(a: [u8; WORD_SIZE]) -> u8 { +pub const fn get_msb(a: [u8; WORD_SIZE]) -> u8 { (a[WORD_SIZE - 1] >> (BYTE_SIZE - 1)) & 1 } diff --git a/core/src/alu/sll/mod.rs b/core/src/alu/sll/mod.rs index ec0f185fe2..d87ee780d6 100644 --- a/core/src/alu/sll/mod.rs +++ b/core/src/alu/sll/mod.rs @@ -64,6 +64,9 @@ pub struct ShiftLeftCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// The output operand. pub a: Word, @@ -118,6 +121,7 @@ impl MachineAir for ShiftLeft { let b = event.b.to_le_bytes(); let c = event.c.to_le_bytes(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.a = Word(a.map(F::from_canonical_u8)); cols.b = Word(b.map(F::from_canonical_u8)); cols.c = Word(c.map(F::from_canonical_u8)); @@ -156,8 +160,8 @@ impl MachineAir for ShiftLeft { // Range checks. { - output.add_u8_range_checks(event.shard, &bit_shift_result); - output.add_u8_range_checks(event.shard, &bit_shift_result_carry); + output.add_u8_range_checks(event.shard, event.channel, &bit_shift_result); + output.add_u8_range_checks(event.shard, event.channel, &bit_shift_result_carry); } // Sanity check. @@ -314,8 +318,18 @@ where // Range check. { - builder.slice_range_check_u8(&local.bit_shift_result, local.shard, local.is_real); - builder.slice_range_check_u8(&local.bit_shift_result_carry, local.shard, local.is_real); + builder.slice_range_check_u8( + &local.bit_shift_result, + local.shard, + local.channel, + local.is_real, + ); + builder.slice_range_check_u8( + &local.bit_shift_result_carry, + local.shard, + local.channel, + local.is_real, + ); } for shift in local.shift_by_n_bytes.iter() { @@ -339,6 +353,7 @@ where local.b, local.c, local.shard, + local.channel, local.is_real, ); } @@ -366,7 +381,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.shift_left_events = vec![AluEvent::new(0, 0, Opcode::SLL, 16, 8, 1)]; + shard.shift_left_events = vec![AluEvent::new(0, 0, 0, Opcode::SLL, 16, 8, 1)]; let chip = ShiftLeft::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -401,7 +416,7 @@ mod tests { (Opcode::SLL, 0x00000000, 0x21212120, 0xffffffff), ]; for t in shift_instructions.iter() { - shift_events.push(AluEvent::new(0, 0, t.0, t.1, t.2, t.3)); + shift_events.push(AluEvent::new(0, 0, 0, t.0, t.1, t.2, t.3)); } // Append more events until we have 1000 tests. diff --git a/core/src/alu/sr/mod.rs b/core/src/alu/sr/mod.rs index f31bf7ee5a..8f9ea721e5 100644 --- a/core/src/alu/sr/mod.rs +++ b/core/src/alu/sr/mod.rs @@ -82,6 +82,9 @@ pub struct ShiftRightCols { /// The shard number, used for byte lookup table. pub shard: T, + /// The channel number, used for byte lookup table. + pub channel: T, + /// The output operand. pub a: Word, @@ -149,6 +152,7 @@ impl MachineAir for ShiftRightChip { // Initialize cols with basic operands and flags derived from the current event. { cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.a = Word::from(event.a); cols.b = Word::from(event.b); cols.c = Word::from(event.c); @@ -168,6 +172,7 @@ impl MachineAir for ShiftRightChip { let most_significant_byte = event.b.to_le_bytes()[WORD_SIZE - 1]; output.add_byte_lookup_events(vec![ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::MSB, a1: ((most_significant_byte >> 7) & 1) as u32, a2: 0, @@ -217,6 +222,7 @@ impl MachineAir for ShiftRightChip { let byte_event = ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::ShrCarry, a1: shift as u32, a2: carry as u32, @@ -239,10 +245,14 @@ impl MachineAir for ShiftRightChip { debug_assert_eq!(cols.a[i], cols.bit_shift_result[i].clone()); } // Range checks. - output.add_u8_range_checks(event.shard, &byte_shift_result); - output.add_u8_range_checks(event.shard, &bit_shift_result); - output.add_u8_range_checks(event.shard, &shr_carry_output_carry); - output.add_u8_range_checks(event.shard, &shr_carry_output_shifted_byte); + output.add_u8_range_checks(event.shard, event.channel, &byte_shift_result); + output.add_u8_range_checks(event.shard, event.channel, &bit_shift_result); + output.add_u8_range_checks(event.shard, event.channel, &shr_carry_output_carry); + output.add_u8_range_checks( + event.shard, + event.channel, + &shr_carry_output_shifted_byte, + ); } rows.push(row); @@ -303,7 +313,15 @@ where let byte = local.b[WORD_SIZE - 1]; let opcode = AB::F::from_canonical_u32(ByteOpcode::MSB as u32); let msb = local.b_msb; - builder.send_byte(opcode, msb, byte, zero.clone(), local.shard, local.is_real); + builder.send_byte( + opcode, + msb, + byte, + zero.clone(), + local.shard, + local.channel, + local.is_real, + ); } // Calculate the number of bits and bytes to shift by from c. @@ -411,6 +429,7 @@ where local.byte_shift_result[i], num_bits_to_shift.clone(), local.shard, + local.channel, local.is_real, ); } @@ -457,14 +476,10 @@ where ]; for long_word in long_words.iter() { - builder.slice_range_check_u8(long_word, local.shard, local.is_real); + builder.slice_range_check_u8(long_word, local.shard, local.channel, local.is_real); } } - builder.assert_zero( - local.a[0] * local.b[0] * local.c[0] - local.a[0] * local.b[0] * local.c[0], - ); - // Check that the operation flags are boolean. builder.assert_bool(local.is_srl); builder.assert_bool(local.is_sra); @@ -478,6 +493,7 @@ where local.b, local.c, local.shard, + local.channel, local.is_real, ); } @@ -504,7 +520,7 @@ mod tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.shift_right_events = vec![AluEvent::new(0, 0, Opcode::SRL, 6, 12, 1)]; + shard.shift_right_events = vec![AluEvent::new(0, 0, 0, Opcode::SRL, 6, 12, 1)]; let chip = ShiftRightChip::default(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); @@ -555,7 +571,7 @@ mod tests { ]; let mut shift_events: Vec = Vec::new(); for t in shifts.iter() { - shift_events.push(AluEvent::new(0, 0, t.0, t.1, t.2, t.3)); + shift_events.push(AluEvent::new(0, 0, 0, t.0, t.1, t.2, t.3)); } let mut shard = ExecutionRecord::default(); shard.shift_right_events = shift_events; diff --git a/core/src/alu/sr/utils.rs b/core/src/alu/sr/utils.rs index f04543e797..46fb4a698a 100644 --- a/core/src/alu/sr/utils.rs +++ b/core/src/alu/sr/utils.rs @@ -3,7 +3,7 @@ use super::BYTE_SIZE; /// Calculate the number of bytes to shift by. /// /// Note that we take the least significant 5 bits per the RISC-V spec. -pub fn nb_bytes_to_shift(shift_amount: u32) -> usize { +pub const fn nb_bytes_to_shift(shift_amount: u32) -> usize { let n = (shift_amount % 32) as usize; n / BYTE_SIZE } @@ -11,7 +11,7 @@ pub fn nb_bytes_to_shift(shift_amount: u32) -> usize { /// Calculate the number of bits shift by. /// /// Note that we take the least significant 5 bits per the RISC-V spec. -pub fn nb_bits_to_shift(shift_amount: u32) -> usize { +pub const fn nb_bits_to_shift(shift_amount: u32) -> usize { let n = (shift_amount % 32) as usize; n % BYTE_SIZE } diff --git a/core/src/bytes/air.rs b/core/src/bytes/air.rs index 712ff1b43e..69d2ba82fe 100644 --- a/core/src/bytes/air.rs +++ b/core/src/bytes/air.rs @@ -7,7 +7,7 @@ use p3_field::Field; use p3_matrix::Matrix; use super::columns::{ByteMultCols, BytePreprocessedCols, NUM_BYTE_MULT_COLS}; -use super::{ByteChip, ByteOpcode}; +use super::{ByteChip, ByteOpcode, NUM_BYTE_LOOKUP_CHANNELS}; use crate::air::SP1AirBuilder; impl BaseAir for ByteChip { @@ -27,49 +27,66 @@ impl Air for ByteChip { let local: &BytePreprocessedCols = (*prep).borrow(); // Send all the lookups for each operation. - for (i, opcode) in ByteOpcode::all().iter().enumerate() { - let field_op = opcode.as_field::(); - let mult = local_mult.multiplicities[i]; - let shard = local_mult.shard; - match opcode { - ByteOpcode::AND => { - builder.receive_byte(field_op, local.and, local.b, local.c, shard, mult) + for channel in 0..NUM_BYTE_LOOKUP_CHANNELS { + let channel_f = AB::F::from_canonical_u32(channel); + let channel = channel as usize; + for (i, opcode) in ByteOpcode::all().iter().enumerate() { + let field_op = opcode.as_field::(); + let mult = local_mult.mult_channels[channel].multiplicities[i]; + let shard = local_mult.shard; + match opcode { + ByteOpcode::AND => builder.receive_byte( + field_op, local.and, local.b, local.c, shard, channel_f, mult, + ), + ByteOpcode::OR => builder + .receive_byte(field_op, local.or, local.b, local.c, shard, channel_f, mult), + ByteOpcode::XOR => builder.receive_byte( + field_op, local.xor, local.b, local.c, shard, channel_f, mult, + ), + ByteOpcode::SLL => builder.receive_byte( + field_op, local.sll, local.b, local.c, shard, channel_f, mult, + ), + ByteOpcode::U8Range => builder.receive_byte( + field_op, + AB::F::zero(), + local.b, + local.c, + shard, + channel_f, + mult, + ), + ByteOpcode::ShrCarry => builder.receive_byte_pair( + field_op, + local.shr, + local.shr_carry, + local.b, + local.c, + shard, + channel_f, + mult, + ), + ByteOpcode::LTU => builder.receive_byte( + field_op, local.ltu, local.b, local.c, shard, channel_f, mult, + ), + ByteOpcode::MSB => builder.receive_byte( + field_op, + local.msb, + local.b, + AB::F::zero(), + shard, + channel_f, + mult, + ), + ByteOpcode::U16Range => builder.receive_byte( + field_op, + local.value_u16, + AB::F::zero(), + AB::F::zero(), + shard, + channel_f, + mult, + ), } - ByteOpcode::OR => { - builder.receive_byte(field_op, local.or, local.b, local.c, shard, mult) - } - ByteOpcode::XOR => { - builder.receive_byte(field_op, local.xor, local.b, local.c, shard, mult) - } - ByteOpcode::SLL => { - builder.receive_byte(field_op, local.sll, local.b, local.c, shard, mult) - } - ByteOpcode::U8Range => { - builder.receive_byte(field_op, AB::F::zero(), local.b, local.c, shard, mult) - } - ByteOpcode::ShrCarry => builder.receive_byte_pair( - field_op, - local.shr, - local.shr_carry, - local.b, - local.c, - shard, - mult, - ), - ByteOpcode::LTU => { - builder.receive_byte(field_op, local.ltu, local.b, local.c, shard, mult) - } - ByteOpcode::MSB => { - builder.receive_byte(field_op, local.msb, local.b, AB::F::zero(), shard, mult) - } - ByteOpcode::U16Range => builder.receive_byte( - field_op, - local.value_u16, - AB::F::zero(), - AB::F::zero(), - shard, - mult, - ), } } } diff --git a/core/src/bytes/columns.rs b/core/src/bytes/columns.rs index 4524bec8bf..7134331f63 100644 --- a/core/src/bytes/columns.rs +++ b/core/src/bytes/columns.rs @@ -1,7 +1,7 @@ use sp1_derive::AlignedBorrow; use std::mem::size_of; -use super::NUM_BYTE_OPS; +use super::{NUM_BYTE_LOOKUP_CHANNELS, NUM_BYTE_OPS}; /// The number of main trace columns for `ByteChip`. pub const NUM_BYTE_PREPROCESSED_COLS: usize = size_of::>(); @@ -44,6 +44,14 @@ pub struct BytePreprocessedCols { pub value_u16: T, } +/// For each byte operation in the preprocessed table, a corresponding ByteMultCols row tracks the +/// number of times the operation is used. +#[derive(Debug, Clone, Copy, AlignedBorrow)] +#[repr(C)] +pub struct MultiplicitiesCols { + pub multiplicities: [T; NUM_BYTE_OPS], +} + /// For each byte operation in the preprocessed table, a corresponding ByteMultCols row tracks the /// number of times the operation is used. #[derive(Debug, Clone, Copy, AlignedBorrow)] @@ -53,5 +61,5 @@ pub struct ByteMultCols { pub shard: T, /// The multiplicites of each byte operation. - pub multiplicities: [T; NUM_BYTE_OPS], + pub mult_channels: [MultiplicitiesCols; NUM_BYTE_LOOKUP_CHANNELS as usize], } diff --git a/core/src/bytes/event.rs b/core/src/bytes/event.rs index 719b4542a4..f45c80cfe8 100644 --- a/core/src/bytes/event.rs +++ b/core/src/bytes/event.rs @@ -11,6 +11,9 @@ pub struct ByteLookupEvent { /// The shard number, used for byte lookup table. pub shard: u32, + // The channel multiplicity identifier. + pub channel: u32, + /// The opcode of the operation. pub opcode: ByteOpcode, @@ -40,9 +43,10 @@ pub trait ByteRecord { } /// Adds a `ByteLookupEvent` to verify `a` and `b are indeed bytes to the shard. - fn add_u8_range_check(&mut self, shard: u32, a: u8, b: u8) { + fn add_u8_range_check(&mut self, shard: u32, channel: u32, a: u8, b: u8) { self.add_byte_lookup_event(ByteLookupEvent { shard, + channel, opcode: ByteOpcode::U8Range, a1: 0, a2: 0, @@ -52,9 +56,10 @@ pub trait ByteRecord { } /// Adds a `ByteLookupEvent` to verify `a` is indeed u16. - fn add_u16_range_check(&mut self, shard: u32, a: u32) { + fn add_u16_range_check(&mut self, shard: u32, channel: u32, a: u32) { self.add_byte_lookup_event(ByteLookupEvent { shard, + channel, opcode: ByteOpcode::U16Range, a1: a, a2: 0, @@ -64,23 +69,29 @@ pub trait ByteRecord { } /// Adds `ByteLookupEvent`s to verify that all the bytes in the input slice are indeed bytes. - fn add_u8_range_checks(&mut self, shard: u32, bytes: &[u8]) { + fn add_u8_range_checks(&mut self, shard: u32, channel: u32, bytes: &[u8]) { let mut index = 0; while index + 1 < bytes.len() { - self.add_u8_range_check(shard, bytes[index], bytes[index + 1]); + self.add_u8_range_check(shard, channel, bytes[index], bytes[index + 1]); index += 2; } if index < bytes.len() { // If the input slice's length is odd, we need to add a check for the last byte. - self.add_u8_range_check(shard, bytes[index], 0); + self.add_u8_range_check(shard, channel, bytes[index], 0); } } /// Adds `ByteLookupEvent`s to verify that all the field elements in the input slice are indeed /// bytes. - fn add_u8_range_checks_field(&mut self, shard: u32, field_values: &[F]) { + fn add_u8_range_checks_field( + &mut self, + shard: u32, + channel: u32, + field_values: &[F], + ) { self.add_u8_range_checks( shard, + channel, &field_values .iter() .map(|x| x.as_canonical_u32() as u8) @@ -89,14 +100,16 @@ pub trait ByteRecord { } /// Adds `ByteLookupEvent`s to verify that all the bytes in the input slice are indeed bytes. - fn add_u16_range_checks(&mut self, shard: u32, ls: &[u32]) { - ls.iter().for_each(|x| self.add_u16_range_check(shard, *x)); + fn add_u16_range_checks(&mut self, shard: u32, channel: u32, ls: &[u32]) { + ls.iter() + .for_each(|x| self.add_u16_range_check(shard, channel, *x)); } /// Adds a `ByteLookupEvent` to compute the bitwise OR of the two input values. - fn lookup_or(&mut self, shard: u32, b: u8, c: u8) { + fn lookup_or(&mut self, shard: u32, channel: u32, b: u8, c: u8) { self.add_byte_lookup_event(ByteLookupEvent { shard, + channel, opcode: ByteOpcode::OR, a1: (b | c) as u32, a2: 0, @@ -108,9 +121,18 @@ pub trait ByteRecord { impl ByteLookupEvent { /// Creates a new `ByteLookupEvent`. - pub fn new(shard: u32, opcode: ByteOpcode, a1: u32, a2: u32, b: u32, c: u32) -> Self { + pub fn new( + shard: u32, + channel: u32, + opcode: ByteOpcode, + a1: u32, + a2: u32, + b: u32, + c: u32, + ) -> Self { Self { shard, + channel, opcode, a1, a2, diff --git a/core/src/bytes/mod.rs b/core/src/bytes/mod.rs index 411b065d1a..f6d5bc482c 100644 --- a/core/src/bytes/mod.rs +++ b/core/src/bytes/mod.rs @@ -23,6 +23,9 @@ use crate::bytes::trace::NUM_ROWS; /// The number of different byte operations. pub const NUM_BYTE_OPS: usize = 9; +/// The number of different byte lookup channels. +pub const NUM_BYTE_LOOKUP_CHANNELS: u32 = 4; + /// A chip for computing byte operations. /// /// The chip contains a preprocessed table of all possible byte operations. Other chips can then @@ -64,61 +67,76 @@ impl ByteChip { col.c = F::from_canonical_u8(c); // Iterate over all operations for results and updating the table map. - for (i, opcode) in opcodes.iter().enumerate() { - let event = match opcode { - ByteOpcode::AND => { - let and = b & c; - col.and = F::from_canonical_u8(and); - ByteLookupEvent::new(shard, *opcode, and as u32, 0, b as u32, c as u32) - } - ByteOpcode::OR => { - let or = b | c; - col.or = F::from_canonical_u8(or); - ByteLookupEvent::new(shard, *opcode, or as u32, 0, b as u32, c as u32) - } - ByteOpcode::XOR => { - let xor = b ^ c; - col.xor = F::from_canonical_u8(xor); - ByteLookupEvent::new(shard, *opcode, xor as u32, 0, b as u32, c as u32) - } - ByteOpcode::SLL => { - let sll = b << (c & 7); - col.sll = F::from_canonical_u8(sll); - ByteLookupEvent::new(shard, *opcode, sll as u32, 0, b as u32, c as u32) - } - ByteOpcode::U8Range => { - ByteLookupEvent::new(shard, *opcode, 0, 0, b as u32, c as u32) - } - ByteOpcode::ShrCarry => { - let (res, carry) = shr_carry(b, c); - col.shr = F::from_canonical_u8(res); - col.shr_carry = F::from_canonical_u8(carry); - ByteLookupEvent::new( - shard, - *opcode, - res as u32, - carry as u32, - b as u32, - c as u32, - ) - } - ByteOpcode::LTU => { - let ltu = b < c; - col.ltu = F::from_bool(ltu); - ByteLookupEvent::new(shard, *opcode, ltu as u32, 0, b as u32, c as u32) - } - ByteOpcode::MSB => { - let msb = (b & 0b1000_0000) != 0; - col.msb = F::from_bool(msb); - ByteLookupEvent::new(shard, *opcode, msb as u32, 0, b as u32, 0 as u32) - } - ByteOpcode::U16Range => { - let v = ((b as u32) << 8) + c as u32; - col.value_u16 = F::from_canonical_u32(v); - ByteLookupEvent::new(shard, *opcode, v, 0, 0, 0) - } - }; - event_map.insert(event, (row_index, i)); + for channel in 0..NUM_BYTE_LOOKUP_CHANNELS { + for (i, opcode) in opcodes.iter().enumerate() { + let event = match opcode { + ByteOpcode::AND => { + let and = b & c; + col.and = F::from_canonical_u8(and); + ByteLookupEvent::new( + shard, channel, *opcode, and as u32, 0, b as u32, c as u32, + ) + } + ByteOpcode::OR => { + let or = b | c; + col.or = F::from_canonical_u8(or); + ByteLookupEvent::new( + shard, channel, *opcode, or as u32, 0, b as u32, c as u32, + ) + } + ByteOpcode::XOR => { + let xor = b ^ c; + col.xor = F::from_canonical_u8(xor); + ByteLookupEvent::new( + shard, channel, *opcode, xor as u32, 0, b as u32, c as u32, + ) + } + ByteOpcode::SLL => { + let sll = b << (c & 7); + col.sll = F::from_canonical_u8(sll); + ByteLookupEvent::new( + shard, channel, *opcode, sll as u32, 0, b as u32, c as u32, + ) + } + ByteOpcode::U8Range => { + ByteLookupEvent::new(shard, channel, *opcode, 0, 0, b as u32, c as u32) + } + ByteOpcode::ShrCarry => { + let (res, carry) = shr_carry(b, c); + col.shr = F::from_canonical_u8(res); + col.shr_carry = F::from_canonical_u8(carry); + ByteLookupEvent::new( + shard, + channel, + *opcode, + res as u32, + carry as u32, + b as u32, + c as u32, + ) + } + ByteOpcode::LTU => { + let ltu = b < c; + col.ltu = F::from_bool(ltu); + ByteLookupEvent::new( + shard, channel, *opcode, ltu as u32, 0, b as u32, c as u32, + ) + } + ByteOpcode::MSB => { + let msb = (b & 0b1000_0000) != 0; + col.msb = F::from_bool(msb); + ByteLookupEvent::new( + shard, channel, *opcode, msb as u32, 0, b as u32, 0 as u32, + ) + } + ByteOpcode::U16Range => { + let v = ((b as u32) << 8) + c as u32; + col.value_u16 = F::from_canonical_u32(v); + ByteLookupEvent::new(shard, channel, *opcode, v, 0, 0, 0) + } + }; + event_map.insert(event, (row_index, i)); + } } } diff --git a/core/src/bytes/trace.rs b/core/src/bytes/trace.rs index 22b8204208..39f2b72ff5 100644 --- a/core/src/bytes/trace.rs +++ b/core/src/bytes/trace.rs @@ -54,10 +54,11 @@ impl MachineAir for ByteChip { for (lookup, mult) in input.byte_lookups[&shard].iter() { let (row, index) = event_map[lookup]; + let channel = lookup.channel as usize; let cols: &mut ByteMultCols = trace.row_mut(row).borrow_mut(); // Update the trace multiplicity - cols.multiplicities[index] += F::from_canonical_usize(*mult); + cols.mult_channels[channel].multiplicities[index] += F::from_canonical_usize(*mult); // Set the shard column as the current shard. cols.shard = F::from_canonical_u32(shard); diff --git a/core/src/bytes/utils.rs b/core/src/bytes/utils.rs index d80d873428..7a56b9ecb4 100644 --- a/core/src/bytes/utils.rs +++ b/core/src/bytes/utils.rs @@ -1,5 +1,5 @@ /// Shifts a byte to the right and returns both the shifted byte and the bits that carried. -pub fn shr_carry(input: u8, rotation: u8) -> (u8, u8) { +pub const fn shr_carry(input: u8, rotation: u8) -> (u8, u8) { let c_mod = rotation & 0x7; if c_mod != 0 { let res = input >> c_mod; diff --git a/core/src/cpu/air/branch.rs b/core/src/cpu/air/branch.rs index 56d5faf5ef..fad654de35 100644 --- a/core/src/cpu/air/branch.rs +++ b/core/src/cpu/air/branch.rs @@ -64,6 +64,7 @@ impl CpuChip { branch_cols.pc, local.op_c_val(), local.shard, + local.channel, local.branching, ); @@ -155,6 +156,7 @@ impl CpuChip { local.op_a_val(), local.op_b_val(), local.shard, + local.channel, is_branch_instruction.clone(), ); @@ -166,6 +168,7 @@ impl CpuChip { local.op_b_val(), local.op_a_val(), local.shard, + local.channel, is_branch_instruction.clone(), ); } diff --git a/core/src/cpu/air/ecall.rs b/core/src/cpu/air/ecall.rs index 3c1f166111..506b2c7b75 100644 --- a/core/src/cpu/air/ecall.rs +++ b/core/src/cpu/air/ecall.rs @@ -1,7 +1,7 @@ use p3_air::AirBuilder; use p3_field::AbstractField; -use crate::air::{BaseAirBuilder, WordAirBuilder}; +use crate::air::{BaseAirBuilder, PublicValues, WordAirBuilder}; use crate::cpu::air::{Word, POSEIDON_NUM_WORDS, PV_DIGEST_NUM_WORDS}; use crate::cpu::columns::{CpuCols, OpcodeSelectorCols}; use crate::memory::MemoryCols; @@ -41,6 +41,7 @@ impl CpuChip { .assert_eq(send_to_table, local.ecall_mul_send_to_table); builder.send_syscall( local.shard, + local.channel, local.clk, syscall_id, local.op_b_val().reduce::(), @@ -171,6 +172,7 @@ impl CpuChip { builder: &mut AB, local: &CpuCols, next: &CpuCols, + public_values: &PublicValues, AB::Expr>, ) { let is_halt = self.get_is_halt_syscall(builder, local); @@ -181,6 +183,11 @@ impl CpuChip { .assert_zero(next.is_real); builder.when(is_halt.clone()).assert_zero(local.next_pc); + + builder.when(is_halt.clone()).assert_eq( + local.op_b_access.value().reduce::(), + public_values.exit_code.clone(), + ); } /// Returns a boolean expression indicating whether the instruction is a HALT instruction. diff --git a/core/src/cpu/air/memory.rs b/core/src/cpu/air/memory.rs index eb4404828e..6ac1a07c11 100644 --- a/core/src/cpu/air/memory.rs +++ b/core/src/cpu/air/memory.rs @@ -65,6 +65,7 @@ impl CpuChip { local.op_b_val(), local.op_c_val(), local.shard, + local.channel, is_memory_instruction.clone(), ); @@ -72,6 +73,7 @@ impl CpuChip { builder.slice_range_check_u8( &memory_columns.addr_word.0, local.shard, + local.channel, is_memory_instruction.clone(), ); @@ -90,6 +92,7 @@ impl CpuChip { // value into the memory columns. builder.eval_memory_access( local.shard, + local.channel, local.clk + AB::F::from_canonical_u32(MemoryAccessPosition::Memory as u32), memory_columns.addr_aligned, &memory_columns.memory_access, @@ -139,6 +142,7 @@ impl CpuChip { local.unsigned_mem_val, signed_value, local.shard, + local.channel, local.mem_value_is_neg, ); diff --git a/core/src/cpu/air/mod.rs b/core/src/cpu/air/mod.rs index f2c77840ee..11a985bb5e 100644 --- a/core/src/cpu/air/mod.rs +++ b/core/src/cpu/air/mod.rs @@ -24,6 +24,8 @@ use crate::cpu::columns::{CpuCols, NUM_CPU_COLS}; use crate::cpu::CpuChip; use crate::runtime::Opcode; +use super::columns::eval_channel_selectors; + impl Air for CpuChip where AB: SP1AirBuilder + AirBuilderWithPublicValues, @@ -64,6 +66,16 @@ where self.eval_memory_load::(builder, local); self.eval_memory_store::(builder, local); + // Channel constraints. + eval_channel_selectors( + builder, + &local.channel_selectors, + &next.channel_selectors, + local.channel, + local.is_real, + next.is_real, + ); + // ALU instructions. builder.send_alu( local.instruction.opcode, @@ -71,6 +83,7 @@ where local.op_b_val(), local.op_c_val(), local.shard, + local.channel, is_alu_instruction, ); @@ -95,7 +108,7 @@ where ); // HALT ecall and UNIMPL instruction. - self.eval_halt_unimpl(builder, local, next); + self.eval_halt_unimpl(builder, local, next, &public_values); // Check that the shard and clk is updated correctly. self.eval_shard_clk(builder, local, next); @@ -169,6 +182,7 @@ impl CpuChip { jump_columns.pc, local.op_b_val(), local.shard, + local.channel, local.selectors.is_jal, ); @@ -179,6 +193,7 @@ impl CpuChip { local.op_b_val(), local.op_c_val(), local.shard, + local.channel, local.selectors.is_jalr, ); } @@ -200,6 +215,7 @@ impl CpuChip { auipc_columns.pc, local.op_b_val(), local.shard, + local.channel, local.selectors.is_auipc, ); } @@ -229,6 +245,7 @@ impl CpuChip { AB::Expr::zero(), AB::Expr::zero(), local.shard, + local.channel, local.is_real, ); @@ -255,6 +272,7 @@ impl CpuChip { local.clk_16bit_limb, local.clk_8bit_limb, local.shard, + local.channel, local.is_real, ); } diff --git a/core/src/cpu/air/register.rs b/core/src/cpu/air/register.rs index 14541c48b9..e0b989c2bc 100644 --- a/core/src/cpu/air/register.rs +++ b/core/src/cpu/air/register.rs @@ -25,6 +25,7 @@ impl CpuChip { // If they are not immediates, read `b` and `c` from memory. builder.eval_memory_access( local.shard, + local.channel, local.clk + AB::F::from_canonical_u32(MemoryAccessPosition::B as u32), local.instruction.op_b[0], &local.op_b_access, @@ -33,6 +34,7 @@ impl CpuChip { builder.eval_memory_access( local.shard, + local.channel, local.clk + AB::F::from_canonical_u32(MemoryAccessPosition::C as u32), local.instruction.op_c[0], &local.op_c_access, @@ -48,6 +50,7 @@ impl CpuChip { // we are performing a branch or a store. builder.eval_memory_access( local.shard, + local.channel, local.clk + AB::F::from_canonical_u32(MemoryAccessPosition::A as u32), local.instruction.op_a[0], &local.op_a_access, diff --git a/core/src/cpu/columns/channel.rs b/core/src/cpu/columns/channel.rs new file mode 100644 index 0000000000..9bd6a4ef78 --- /dev/null +++ b/core/src/cpu/columns/channel.rs @@ -0,0 +1,65 @@ +use p3_air::AirBuilder; +use p3_field::AbstractField; +use p3_field::Field; +use sp1_derive::AlignedBorrow; + +use crate::{bytes::NUM_BYTE_LOOKUP_CHANNELS, stark::SP1AirBuilder}; + +#[derive(AlignedBorrow, Default, Debug, Clone, Copy)] +#[repr(C)] +pub struct ChannelSelectorCols { + pub channel_selectors: [T; NUM_BYTE_LOOKUP_CHANNELS as usize], +} + +impl ChannelSelectorCols { + pub fn populate(&mut self, channel: u32) { + self.channel_selectors = [F::zero(); NUM_BYTE_LOOKUP_CHANNELS as usize]; + self.channel_selectors[channel as usize] = F::one(); + } +} + +pub fn eval_channel_selectors( + builder: &mut AB, + local: &ChannelSelectorCols, + next: &ChannelSelectorCols, + channel: impl Into + Clone, + local_is_real: impl Into + Clone, + next_is_real: impl Into + Clone, +) { + // Constrain: + // - the value of the channel is given by the channel selectors. + // - all selectors are boolean and disjoint. + let mut sum = AB::Expr::zero(); + let mut reconstruct_channel = AB::Expr::zero(); + for (i, selector) in local.channel_selectors.into_iter().enumerate() { + // Constrain that the selector is boolean. + builder.assert_bool(selector); + // Accumulate the sum of the selectors. + sum += selector.into(); + // Accumulate the reconstructed channel. + reconstruct_channel += selector.into() * AB::Expr::from_canonical_u32(i as u32); + } + // Assert that the reconstructed channel is the same as the channel. + builder.assert_eq(reconstruct_channel, channel.clone()); + // For disjointness, assert the sum of the selectors is 1. + builder + .when(local_is_real.clone()) + .assert_eq(sum, AB::Expr::one()); + + // Constrain the first row by asserting that the first selector on the first line is true. + builder + .when_first_row() + .assert_one(local.channel_selectors[0]); + + // Constrain the transition by asserting that the selectors satisfy the recursion relation: + // selectors_next[(i + 1) % NUM_BYTE_LOOKUP_CHANNELS] = selectors[i] + for i in 0..NUM_BYTE_LOOKUP_CHANNELS as usize { + builder + .when_transition() + .when(next_is_real.clone()) + .assert_eq( + local.channel_selectors[i], + next.channel_selectors[(i + 1) % NUM_BYTE_LOOKUP_CHANNELS as usize], + ); + } +} diff --git a/core/src/cpu/columns/mod.rs b/core/src/cpu/columns/mod.rs index e40f30518e..d81bd806fc 100644 --- a/core/src/cpu/columns/mod.rs +++ b/core/src/cpu/columns/mod.rs @@ -1,5 +1,6 @@ mod auipc; mod branch; +mod channel; mod ecall; mod instruction; mod jump; @@ -9,6 +10,7 @@ mod opcode_specific; pub use auipc::*; pub use branch::*; +pub use channel::*; pub use ecall::*; pub use instruction::*; pub use jump::*; @@ -35,6 +37,8 @@ pub const CPU_COL_MAP: CpuCols = make_col_map(); pub struct CpuCols { /// The current shard. pub shard: T, + /// The channel value, used for byte lookup multiplicity. + pub channel: T, /// The clock cycle value. This should be within 24 bits. pub clk: T, @@ -52,6 +56,9 @@ pub struct CpuCols { /// Columns related to the instruction. pub instruction: InstructionCols, + /// Columns related to the byte lookup channel. + pub channel_selectors: ChannelSelectorCols, + /// Selectors for the opcode. pub selectors: OpcodeSelectorCols, diff --git a/core/src/cpu/event.rs b/core/src/cpu/event.rs index 8baa8fb730..2170d91d5d 100644 --- a/core/src/cpu/event.rs +++ b/core/src/cpu/event.rs @@ -9,6 +9,9 @@ pub struct CpuEvent { /// The current shard. pub shard: u32, + /// The current channel. + pub channel: u32, + /// The current clock. pub clk: u32, diff --git a/core/src/cpu/trace.rs b/core/src/cpu/trace.rs index 7000fe0624..b65c4e43ca 100644 --- a/core/src/cpu/trace.rs +++ b/core/src/cpu/trace.rs @@ -149,13 +149,16 @@ impl CpuChip { // Populate memory accesses for a, b, and c. if let Some(record) = event.a_record { - cols.op_a_access.populate(record, &mut new_blu_events) + cols.op_a_access + .populate(event.channel, record, &mut new_blu_events) } if let Some(MemoryRecordEnum::Read(record)) = event.b_record { - cols.op_b_access.populate(record, &mut new_blu_events) + cols.op_b_access + .populate(event.channel, record, &mut new_blu_events) } if let Some(MemoryRecordEnum::Read(record)) = event.c_record { - cols.op_c_access.populate(record, &mut new_blu_events) + cols.op_c_access + .populate(event.channel, record, &mut new_blu_events) } // Populate memory accesses for reading from memory. @@ -164,7 +167,7 @@ impl CpuChip { if let Some(record) = event.memory_record { memory_columns .memory_access - .populate(record, &mut new_blu_events) + .populate(event.channel, record, &mut new_blu_events) } // Populate memory, branch, jump, and auipc specific fields. @@ -188,7 +191,7 @@ impl CpuChip { (row, new_alu_events, new_blu_events) } - /// Populates the shard and clk related rows. + /// Populates the shard, channel, and clk related rows. fn populate_shard_clk( &self, cols: &mut CpuCols, @@ -196,8 +199,11 @@ impl CpuChip { new_blu_events: &mut Vec, ) { cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); + cols.channel_selectors.populate(event.channel); new_blu_events.push(ByteLookupEvent::new( event.shard, + event.channel, U16Range, event.shard, 0, @@ -212,6 +218,7 @@ impl CpuChip { cols.clk_8bit_limb = F::from_canonical_u32(clk_8bit_limb); new_blu_events.push(ByteLookupEvent::new( event.shard, + event.channel, U16Range, clk_16bit_limb, 0, @@ -220,6 +227,7 @@ impl CpuChip { )); new_blu_events.push(ByteLookupEvent::new( event.shard, + event.channel, U8Range, 0, 0, @@ -260,6 +268,7 @@ impl CpuChip { // Add event to ALU check to check that addr == b + c let add_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::ADD, a: memory_addr, @@ -323,6 +332,7 @@ impl CpuChip { if memory_columns.most_sig_byte_decomp[7] == F::one() { cols.mem_value_is_neg = F::one(); let sub_event = AluEvent { + channel: event.channel, shard: event.shard, clk: event.clk, opcode: Opcode::SUB, @@ -344,6 +354,7 @@ impl CpuChip { for byte_pair in addr_bytes.chunks_exact(2) { new_blu_events.push(ByteLookupEvent { shard: event.shard, + channel: event.channel, opcode: ByteOpcode::U8Range, a1: 0, a2: 0, @@ -387,6 +398,7 @@ impl CpuChip { // Add the ALU events for the comparisons let lt_comp_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: alu_op_code, a: a_lt_b as u32, @@ -401,6 +413,7 @@ impl CpuChip { let gt_comp_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: alu_op_code, a: a_gt_b as u32, @@ -434,6 +447,7 @@ impl CpuChip { let add_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::ADD, a: next_pc, @@ -469,6 +483,7 @@ impl CpuChip { let add_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::ADD, a: next_pc, @@ -487,6 +502,7 @@ impl CpuChip { let add_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::ADD, a: next_pc, @@ -518,6 +534,7 @@ impl CpuChip { let add_event = AluEvent { shard: event.shard, + channel: event.channel, clk: event.clk, opcode: Opcode::ADD, a: event.a, @@ -624,13 +641,14 @@ mod tests { use super::*; use crate::runtime::{tests::simple_program, Instruction, Runtime}; - use crate::utils::{run_test, setup_logger}; + use crate::utils::{run_test, setup_logger, SP1CoreOpts}; #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); shard.cpu_events = vec![CpuEvent { shard: 1, + channel: 0, clk: 6, pc: 1, next_pc: 5, @@ -661,7 +679,7 @@ mod tests { #[test] fn generate_trace_simple_program() { let program = simple_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let chip = CpuChip::default(); let trace: RowMajorMatrix = diff --git a/core/src/disassembler/elf.rs b/core/src/disassembler/elf.rs index 8f9dfb612b..42454f5c72 100644 --- a/core/src/disassembler/elf.rs +++ b/core/src/disassembler/elf.rs @@ -30,7 +30,7 @@ pub struct Elf { impl Elf { /// Create a new ELF file. - pub fn new( + pub const fn new( instructions: Vec, pc_start: u32, pc_base: u32, diff --git a/core/src/disassembler/instruction.rs b/core/src/disassembler/instruction.rs index 1b47f7b1e3..9c0eb3e512 100644 --- a/core/src/disassembler/instruction.rs +++ b/core/src/disassembler/instruction.rs @@ -7,7 +7,7 @@ use crate::runtime::{Instruction, Opcode, Register}; impl Instruction { /// Create a new instruction from an R-type instruction. - pub fn from_r_type(opcode: Opcode, dec_insn: RType) -> Self { + pub const fn from_r_type(opcode: Opcode, dec_insn: RType) -> Self { Self::new( opcode, dec_insn.rd as u32, @@ -19,7 +19,7 @@ impl Instruction { } /// Create a new instruction from an I-type instruction. - pub fn from_i_type(opcode: Opcode, dec_insn: IType) -> Self { + pub const fn from_i_type(opcode: Opcode, dec_insn: IType) -> Self { Self::new( opcode, dec_insn.rd as u32, @@ -31,7 +31,7 @@ impl Instruction { } /// Create a new instruction from an I-type instruction with a shamt. - pub fn from_i_type_shamt(opcode: Opcode, dec_insn: ITypeShamt) -> Self { + pub const fn from_i_type_shamt(opcode: Opcode, dec_insn: ITypeShamt) -> Self { Self::new( opcode, dec_insn.rd as u32, @@ -43,7 +43,7 @@ impl Instruction { } /// Create a new instruction from an S-type instruction. - pub fn from_s_type(opcode: Opcode, dec_insn: SType) -> Self { + pub const fn from_s_type(opcode: Opcode, dec_insn: SType) -> Self { Self::new( opcode, dec_insn.rs2 as u32, @@ -55,7 +55,7 @@ impl Instruction { } /// Create a new instruction from a B-type instruction. - pub fn from_b_type(opcode: Opcode, dec_insn: BType) -> Self { + pub const fn from_b_type(opcode: Opcode, dec_insn: BType) -> Self { Self::new( opcode, dec_insn.rs1 as u32, @@ -67,19 +67,19 @@ impl Instruction { } /// Create a new instruction that is not implemented. - pub fn unimp() -> Self { + pub const fn unimp() -> Self { Self::new(Opcode::UNIMP, 0, 0, 0, true, true) } /// Returns if the instruction is an R-type instruction. #[inline(always)] - pub fn is_r_type(&self) -> bool { + pub const fn is_r_type(&self) -> bool { !self.imm_c } /// Returns whether the instruction is an I-type instruction. #[inline(always)] - pub fn is_i_type(&self) -> bool { + pub const fn is_i_type(&self) -> bool { self.imm_c } diff --git a/core/src/disassembler/mod.rs b/core/src/disassembler/mod.rs index 9b94f2058c..a6a89f7f9e 100644 --- a/core/src/disassembler/mod.rs +++ b/core/src/disassembler/mod.rs @@ -10,7 +10,7 @@ use crate::runtime::{Instruction, Program}; impl Program { /// Create a new program. - pub fn new(instructions: Vec, pc_start: u32, pc_base: u32) -> Self { + pub const fn new(instructions: Vec, pc_start: u32, pc_base: u32) -> Self { Self { instructions, pc_start, diff --git a/core/src/io.rs b/core/src/io.rs index cfc461e724..b07643bbd3 100644 --- a/core/src/io.rs +++ b/core/src/io.rs @@ -27,7 +27,7 @@ pub struct SP1PublicValues { impl SP1Stdin { /// Create a new `SP1Stdin`. - pub fn new() -> Self { + pub const fn new() -> Self { Self { buffer: Vec::new(), ptr: 0, @@ -85,7 +85,7 @@ impl SP1Stdin { impl SP1PublicValues { /// Create a new `SP1PublicValues`. - pub fn new() -> Self { + pub const fn new() -> Self { Self { buffer: Buffer::new(), } diff --git a/core/src/lib.rs b/core/src/lib.rs index 8669dd1694..3fb0786a03 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -1,5 +1,4 @@ #![allow( - clippy::eq_op, clippy::new_without_default, clippy::field_reassign_with_default, clippy::unnecessary_cast, diff --git a/core/src/lookup/debug.rs b/core/src/lookup/debug.rs index c58d882b7e..f8962c5769 100644 --- a/core/src/lookup/debug.rs +++ b/core/src/lookup/debug.rs @@ -210,7 +210,7 @@ mod test { lookup::InteractionKind, runtime::{Program, Runtime, ShardingConfig}, stark::RiscvAir, - utils::{setup_logger, tests::UINT256_MUL_ELF, BabyBearPoseidon2}, + utils::{setup_logger, tests::UINT256_MUL_ELF, BabyBearPoseidon2, SP1CoreOpts}, }; use super::debug_interactions_with_all_chips; @@ -222,7 +222,7 @@ mod test { let config = BabyBearPoseidon2::new(); let machine = RiscvAir::machine(config); let (pk, _) = machine.setup(&program); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let shards = machine.shard(runtime.record, &ShardingConfig::default()); let ok = diff --git a/core/src/lookup/interaction.rs b/core/src/lookup/interaction.rs index 0ac2a2903f..74b7a9fc06 100644 --- a/core/src/lookup/interaction.rs +++ b/core/src/lookup/interaction.rs @@ -56,7 +56,7 @@ impl InteractionKind { impl Interaction { /// Create a new interaction. - pub fn new( + pub const fn new( values: Vec>, multiplicity: VirtualPairCol, kind: InteractionKind, @@ -69,7 +69,7 @@ impl Interaction { } /// The index of the argument in the lookup table. - pub fn argument_index(&self) -> usize { + pub const fn argument_index(&self) -> usize { self.kind as usize } } diff --git a/core/src/memory/global.rs b/core/src/memory/global.rs index 5c9974e09f..3786dd4ca1 100644 --- a/core/src/memory/global.rs +++ b/core/src/memory/global.rs @@ -29,7 +29,7 @@ pub struct MemoryChip { impl MemoryChip { /// Creates a new memory chip with a certain type. - pub fn new(kind: MemoryChipType) -> Self { + pub const fn new(kind: MemoryChipType) -> Self { Self { kind } } } @@ -177,14 +177,14 @@ mod tests { use crate::stark::MachineRecord; use crate::stark::{RiscvAir, StarkGenericConfig}; use crate::syscall::precompiles::sha256::extend_tests::sha_extend_program; - use crate::utils::{setup_logger, BabyBearPoseidon2}; + use crate::utils::{setup_logger, BabyBearPoseidon2, SP1CoreOpts}; use crate::utils::{uni_stark_prove as prove, uni_stark_verify as verify}; use p3_baby_bear::BabyBear; #[test] fn test_memory_generate_trace() { let program = simple_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let shard = runtime.record.clone(); @@ -210,7 +210,7 @@ mod tests { let mut challenger = config.challenger(); let program = simple_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let chip = MemoryChip::new(MemoryChipType::Initialize); @@ -228,7 +228,7 @@ mod tests { setup_logger(); let program = sha_extend_program(); let program_clone = program.clone(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let machine: crate::stark::StarkMachine> = RiscvAir::machine(BabyBearPoseidon2::new()); @@ -251,7 +251,7 @@ mod tests { setup_logger(); let program = sha_extend_program(); let program_clone = program.clone(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); let machine = RiscvAir::machine(BabyBearPoseidon2::new()); let (pkey, _) = machine.setup(&program_clone); diff --git a/core/src/memory/mod.rs b/core/src/memory/mod.rs index dcd9e23fe9..7acdee1fb8 100644 --- a/core/src/memory/mod.rs +++ b/core/src/memory/mod.rs @@ -21,7 +21,7 @@ pub struct MemoryInitializeFinalizeEvent { } impl MemoryInitializeFinalizeEvent { - pub fn initialize(addr: u32, value: u32, used: bool) -> Self { + pub const fn initialize(addr: u32, value: u32, used: bool) -> Self { // All memory initialization happen at shard 0, timestamp 0. Self { addr, @@ -32,7 +32,7 @@ impl MemoryInitializeFinalizeEvent { } } - pub fn finalize_from_record(addr: u32, record: &MemoryRecord) -> Self { + pub const fn finalize_from_record(addr: u32, record: &MemoryRecord) -> Self { Self { addr, value: record.value, diff --git a/core/src/memory/program.rs b/core/src/memory/program.rs index fa8815c916..3d922c4ae6 100644 --- a/core/src/memory/program.rs +++ b/core/src/memory/program.rs @@ -44,7 +44,7 @@ pub struct MemoryProgramMultCols { pub struct MemoryProgramChip; impl MemoryProgramChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } diff --git a/core/src/memory/trace.rs b/core/src/memory/trace.rs index e7593d0134..678dfcf7bc 100644 --- a/core/src/memory/trace.rs +++ b/core/src/memory/trace.rs @@ -5,7 +5,12 @@ use crate::bytes::event::ByteRecord; use crate::runtime::{MemoryReadRecord, MemoryRecord, MemoryRecordEnum, MemoryWriteRecord}; impl MemoryWriteCols { - pub fn populate(&mut self, record: MemoryWriteRecord, output: &mut impl ByteRecord) { + pub fn populate( + &mut self, + channel: u32, + record: MemoryWriteRecord, + output: &mut impl ByteRecord, + ) { let current_record = MemoryRecord { value: record.value, shard: record.shard, @@ -18,12 +23,17 @@ impl MemoryWriteCols { }; self.prev_value = prev_record.value.into(); self.access - .populate_access(current_record, prev_record, output); + .populate_access(channel, current_record, prev_record, output); } } impl MemoryReadCols { - pub fn populate(&mut self, record: MemoryReadRecord, output: &mut impl ByteRecord) { + pub fn populate( + &mut self, + channel: u32, + record: MemoryReadRecord, + output: &mut impl ByteRecord, + ) { let current_record = MemoryRecord { value: record.value, shard: record.shard, @@ -35,19 +45,31 @@ impl MemoryReadCols { timestamp: record.prev_timestamp, }; self.access - .populate_access(current_record, prev_record, output); + .populate_access(channel, current_record, prev_record, output); } } impl MemoryReadWriteCols { - pub fn populate(&mut self, record: MemoryRecordEnum, output: &mut impl ByteRecord) { + pub fn populate( + &mut self, + channel: u32, + record: MemoryRecordEnum, + output: &mut impl ByteRecord, + ) { match record { - MemoryRecordEnum::Read(read_record) => self.populate_read(read_record, output), - MemoryRecordEnum::Write(write_record) => self.populate_write(write_record, output), + MemoryRecordEnum::Read(read_record) => self.populate_read(channel, read_record, output), + MemoryRecordEnum::Write(write_record) => { + self.populate_write(channel, write_record, output) + } } } - pub fn populate_write(&mut self, record: MemoryWriteRecord, output: &mut impl ByteRecord) { + pub fn populate_write( + &mut self, + channel: u32, + record: MemoryWriteRecord, + output: &mut impl ByteRecord, + ) { let current_record = MemoryRecord { value: record.value, shard: record.shard, @@ -60,10 +82,15 @@ impl MemoryReadWriteCols { }; self.prev_value = prev_record.value.into(); self.access - .populate_access(current_record, prev_record, output); + .populate_access(channel, current_record, prev_record, output); } - pub fn populate_read(&mut self, record: MemoryReadRecord, output: &mut impl ByteRecord) { + pub fn populate_read( + &mut self, + channel: u32, + record: MemoryReadRecord, + output: &mut impl ByteRecord, + ) { let current_record = MemoryRecord { value: record.value, shard: record.shard, @@ -76,13 +103,14 @@ impl MemoryReadWriteCols { }; self.prev_value = prev_record.value.into(); self.access - .populate_access(current_record, prev_record, output); + .populate_access(channel, current_record, prev_record, output); } } impl MemoryAccessCols { pub(crate) fn populate_access( &mut self, + channel: u32, current_record: MemoryRecord, prev_record: MemoryRecord, output: &mut impl ByteRecord, @@ -115,9 +143,9 @@ impl MemoryAccessCols { let shard = current_record.shard; // Add a byte table lookup with the 16Range op. - output.add_u16_range_check(shard, diff_16bit_limb); + output.add_u16_range_check(shard, channel, diff_16bit_limb); // Add a byte table lookup with the U8Range op. - output.add_u8_range_check(shard, 0, diff_8bit_limb as u8); + output.add_u8_range_check(shard, channel, 0, diff_8bit_limb as u8); } } diff --git a/core/src/operations/add.rs b/core/src/operations/add.rs index 78e8dc1826..27f002db3f 100644 --- a/core/src/operations/add.rs +++ b/core/src/operations/add.rs @@ -24,6 +24,7 @@ impl AddOperation { &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, a_u32: u32, b_u32: u32, ) -> u32 { @@ -54,9 +55,9 @@ impl AddOperation { // Range check { - record.add_u8_range_checks(shard, &a); - record.add_u8_range_checks(shard, &b); - record.add_u8_range_checks(shard, &expected.to_le_bytes()); + record.add_u8_range_checks(shard, channel, &a); + record.add_u8_range_checks(shard, channel, &b); + record.add_u8_range_checks(shard, channel, &expected.to_le_bytes()); } expected } @@ -67,6 +68,7 @@ impl AddOperation { b: Word, cols: AddOperation, shard: AB::Var, + channel: impl Into + Clone, is_real: AB::Expr, ) { let one = AB::Expr::one(); @@ -103,9 +105,9 @@ impl AddOperation { // Range check each byte. { - builder.slice_range_check_u8(&a.0, shard, is_real.clone()); - builder.slice_range_check_u8(&b.0, shard, is_real.clone()); - builder.slice_range_check_u8(&cols.value.0, shard, is_real); + builder.slice_range_check_u8(&a.0, shard, channel.clone(), is_real.clone()); + builder.slice_range_check_u8(&b.0, shard, channel.clone(), is_real.clone()); + builder.slice_range_check_u8(&cols.value.0, shard, channel.clone(), is_real); } } } diff --git a/core/src/operations/add4.rs b/core/src/operations/add4.rs index 10e1f95774..f3066a3851 100644 --- a/core/src/operations/add4.rs +++ b/core/src/operations/add4.rs @@ -33,10 +33,12 @@ pub struct Add4Operation { } impl Add4Operation { + #[allow(clippy::too_many_arguments)] pub fn populate( &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, a_u32: u32, b_u32: u32, c_u32: u32, @@ -71,11 +73,11 @@ impl Add4Operation { // Range check. { - record.add_u8_range_checks(shard, &a); - record.add_u8_range_checks(shard, &b); - record.add_u8_range_checks(shard, &c); - record.add_u8_range_checks(shard, &d); - record.add_u8_range_checks(shard, &expected.to_le_bytes()); + record.add_u8_range_checks(shard, channel, &a); + record.add_u8_range_checks(shard, channel, &b); + record.add_u8_range_checks(shard, channel, &c); + record.add_u8_range_checks(shard, channel, &d); + record.add_u8_range_checks(shard, channel, &expected.to_le_bytes()); } expected } @@ -88,16 +90,17 @@ impl Add4Operation { c: Word, d: Word, shard: AB::Var, + channel: impl Into + Copy, is_real: AB::Var, cols: Add4Operation, ) { // Range check each byte. { - builder.slice_range_check_u8(&a.0, shard, is_real); - builder.slice_range_check_u8(&b.0, shard, is_real); - builder.slice_range_check_u8(&c.0, shard, is_real); - builder.slice_range_check_u8(&d.0, shard, is_real); - builder.slice_range_check_u8(&cols.value.0, shard, is_real); + builder.slice_range_check_u8(&a.0, shard, channel, is_real); + builder.slice_range_check_u8(&b.0, shard, channel, is_real); + builder.slice_range_check_u8(&c.0, shard, channel, is_real); + builder.slice_range_check_u8(&d.0, shard, channel, is_real); + builder.slice_range_check_u8(&cols.value.0, shard, channel, is_real); } builder.assert_bool(is_real); diff --git a/core/src/operations/add5.rs b/core/src/operations/add5.rs index 67421f8aa8..00da26bf84 100644 --- a/core/src/operations/add5.rs +++ b/core/src/operations/add5.rs @@ -41,6 +41,7 @@ impl Add5Operation { &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, a_u32: u32, b_u32: u32, c_u32: u32, @@ -81,12 +82,12 @@ impl Add5Operation { // Range check. { - record.add_u8_range_checks(shard, &a); - record.add_u8_range_checks(shard, &b); - record.add_u8_range_checks(shard, &c); - record.add_u8_range_checks(shard, &d); - record.add_u8_range_checks(shard, &e); - record.add_u8_range_checks(shard, &expected.to_le_bytes()); + record.add_u8_range_checks(shard, channel, &a); + record.add_u8_range_checks(shard, channel, &b); + record.add_u8_range_checks(shard, channel, &c); + record.add_u8_range_checks(shard, channel, &d); + record.add_u8_range_checks(shard, channel, &e); + record.add_u8_range_checks(shard, channel, &expected.to_le_bytes()); } expected @@ -96,6 +97,7 @@ impl Add5Operation { builder: &mut AB, words: &[Word; 5], shard: AB::Var, + channel: impl Into + Copy, is_real: AB::Var, cols: Add5Operation, ) { @@ -104,8 +106,8 @@ impl Add5Operation { { words .iter() - .for_each(|word| builder.slice_range_check_u8(&word.0, shard, is_real)); - builder.slice_range_check_u8(&cols.value.0, shard, is_real); + .for_each(|word| builder.slice_range_check_u8(&word.0, shard, channel, is_real)); + builder.slice_range_check_u8(&cols.value.0, shard, channel, is_real); } let mut builder_is_real = builder.when(is_real); diff --git a/core/src/operations/and.rs b/core/src/operations/and.rs index 9bb27a14a0..adeade4190 100644 --- a/core/src/operations/and.rs +++ b/core/src/operations/and.rs @@ -19,7 +19,14 @@ pub struct AndOperation { } impl AndOperation { - pub fn populate(&mut self, record: &mut ExecutionRecord, shard: u32, x: u32, y: u32) -> u32 { + pub fn populate( + &mut self, + record: &mut ExecutionRecord, + shard: u32, + channel: u32, + x: u32, + y: u32, + ) -> u32 { let expected = x & y; let x_bytes = x.to_le_bytes(); let y_bytes = y.to_le_bytes(); @@ -29,6 +36,7 @@ impl AndOperation { let byte_event = ByteLookupEvent { shard, + channel, opcode: ByteOpcode::AND, a1: and as u32, a2: 0, @@ -47,6 +55,7 @@ impl AndOperation { b: Word, cols: AndOperation, shard: AB::Var, + channel: impl Into + Copy, is_real: AB::Var, ) { for i in 0..WORD_SIZE { @@ -56,6 +65,7 @@ impl AndOperation { a[i], b[i], shard, + channel, is_real, ); } diff --git a/core/src/operations/field/field_den.rs b/core/src/operations/field/field_den.rs index eab87631ca..b1f73e68ec 100644 --- a/core/src/operations/field/field_den.rs +++ b/core/src/operations/field/field_den.rs @@ -33,6 +33,7 @@ impl FieldDenCols { &mut self, record: &mut impl ByteRecord, shard: u32, + channel: u32, a: &BigUint, b: &BigUint, sign: bool, @@ -84,10 +85,10 @@ impl FieldDenCols { self.witness_high = Limbs(p_witness_high.try_into().unwrap()); // Range checks - record.add_u8_range_checks_field(shard, &self.result.0); - record.add_u8_range_checks_field(shard, &self.carry.0); - record.add_u8_range_checks_field(shard, &self.witness_low.0); - record.add_u8_range_checks_field(shard, &self.witness_high.0); + record.add_u8_range_checks_field(shard, channel, &self.result.0); + record.add_u8_range_checks_field(shard, channel, &self.carry.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_low.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_high.0); result } @@ -97,18 +98,16 @@ impl FieldDenCols where Limbs: Copy, { - pub fn eval< - AB: SP1AirBuilder, - EShard: Into + Clone, - ER: Into + Clone, - >( + #[allow(clippy::too_many_arguments)] + pub fn eval>( &self, builder: &mut AB, a: &Limbs, b: &Limbs, sign: bool, - shard: EShard, - is_real: ER, + shard: impl Into + Clone, + channel: impl Into + Clone, + is_real: impl Into + Clone, ) where V: Into, { @@ -139,10 +138,25 @@ where eval_field_operation::(builder, &p_vanishing, &p_witness_low, &p_witness_high); // Range checks for the result, carry, and witness columns. - builder.slice_range_check_u8(&self.result.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.carry.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.witness_low.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.witness_high.0, shard, is_real); + builder.slice_range_check_u8( + &self.result.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + &self.carry.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + &self.witness_low.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8(&self.witness_high.0, shard, channel.clone(), is_real); } } @@ -189,7 +203,7 @@ mod tests { } impl FieldDenChip

{ - pub fn new(sign: bool) -> Self { + pub const fn new(sign: bool) -> Self { Self { sign, _phantom: std::marker::PhantomData, @@ -238,7 +252,7 @@ mod tests { let cols: &mut TestCols = row.as_mut_slice().borrow_mut(); cols.a = P::to_limbs_field::(a); cols.b = P::to_limbs_field::(b); - cols.a_den_b.populate(output, 1, a, b, self.sign); + cols.a_den_b.populate(output, 1, 0, a, b, self.sign); row }) .collect::>(); @@ -278,6 +292,7 @@ mod tests { &local.b, self.sign, AB::F::one(), + AB::F::zero(), AB::F::one(), ); } diff --git a/core/src/operations/field/field_inner_product.rs b/core/src/operations/field/field_inner_product.rs index 070b174bd1..1a585e4e4c 100644 --- a/core/src/operations/field/field_inner_product.rs +++ b/core/src/operations/field/field_inner_product.rs @@ -34,6 +34,7 @@ impl FieldInnerProductCols { &mut self, record: &mut impl ByteRecord, shard: u32, + channel: u32, a: &[BigUint], b: &[BigUint], ) -> BigUint { @@ -86,10 +87,10 @@ impl FieldInnerProductCols { self.witness_high = Limbs(p_witness_high.try_into().unwrap()); // Range checks - record.add_u8_range_checks_field(shard, &self.result.0); - record.add_u8_range_checks_field(shard, &self.carry.0); - record.add_u8_range_checks_field(shard, &self.witness_low.0); - record.add_u8_range_checks_field(shard, &self.witness_high.0); + record.add_u8_range_checks_field(shard, channel, &self.result.0); + record.add_u8_range_checks_field(shard, channel, &self.carry.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_low.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_high.0); result.clone() } @@ -99,17 +100,14 @@ impl FieldInnerProductCols where Limbs: Copy, { - pub fn eval< - AB: SP1AirBuilder, - EShard: Into + Clone, - ER: Into + Clone, - >( + pub fn eval>( &self, builder: &mut AB, a: &[Limbs], b: &[Limbs], - shard: EShard, - is_real: ER, + shard: impl Into + Clone, + channel: impl Into + Clone, + is_real: impl Into + Clone, ) where V: Into, { @@ -138,10 +136,25 @@ where eval_field_operation::(builder, &p_vanishing, &p_witness_low, &p_witness_high); // Range checks for the result, carry, and witness columns. - builder.slice_range_check_u8(&self.result.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.carry.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.witness_low.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.witness_high.0, shard, is_real); + builder.slice_range_check_u8( + &self.result.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + &self.carry.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + &self.witness_low.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8(&self.witness_high.0, shard, channel.clone(), is_real); } } @@ -187,7 +200,7 @@ mod tests { } impl FieldIpChip

{ - pub fn new() -> Self { + pub const fn new() -> Self { Self { _phantom: std::marker::PhantomData, } @@ -231,7 +244,7 @@ mod tests { let cols: &mut TestCols = row.as_mut_slice().borrow_mut(); cols.a[0] = P::to_limbs_field::(&a[0]); cols.b[0] = P::to_limbs_field::(&b[0]); - cols.a_ip_b.populate(output, 1, a, b); + cols.a_ip_b.populate(output, 1, 0, a, b); row }) .collect::>(); @@ -267,9 +280,14 @@ mod tests { let main = builder.main(); let local = main.row_slice(0); let local: &TestCols = (*local).borrow(); - local - .a_ip_b - .eval(builder, &local.a, &local.b, AB::F::one(), AB::F::one()); + local.a_ip_b.eval( + builder, + &local.a, + &local.b, + AB::F::one(), + AB::F::zero(), + AB::F::one(), + ); } } diff --git a/core/src/operations/field/field_op.rs b/core/src/operations/field/field_op.rs index 9c8943d0ce..ae04e2b9b1 100644 --- a/core/src/operations/field/field_op.rs +++ b/core/src/operations/field/field_op.rs @@ -108,10 +108,12 @@ impl FieldOpCols { /// Populate these columns with a specified modulus. This is useful in the `mulmod` precompile /// as an example. + #[allow(clippy::too_many_arguments)] pub fn populate_with_modulus( &mut self, record: &mut impl ByteRecord, shard: u32, + channel: u32, a: &BigUint, b: &BigUint, modulus: &BigUint, @@ -159,10 +161,10 @@ impl FieldOpCols { }; // Range checks - record.add_u8_range_checks_field(shard, &self.result.0); - record.add_u8_range_checks_field(shard, &self.carry.0); - record.add_u8_range_checks_field(shard, &self.witness_low.0); - record.add_u8_range_checks_field(shard, &self.witness_high.0); + record.add_u8_range_checks_field(shard, channel, &self.result.0); + record.add_u8_range_checks_field(shard, channel, &self.carry.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_low.0); + record.add_u8_range_checks_field(shard, channel, &self.witness_high.0); result } @@ -172,11 +174,12 @@ impl FieldOpCols { &mut self, record: &mut impl ByteRecord, shard: u32, + channel: u32, a: &BigUint, b: &BigUint, op: FieldOperation, ) -> BigUint { - self.populate_with_modulus(record, shard, a, b, &P::modulus(), op) + self.populate_with_modulus(record, shard, channel, a, b, &P::modulus(), op) } } @@ -190,6 +193,7 @@ impl FieldOpCols { modulus: &(impl Into> + Clone), op: FieldOperation, shard: impl Into + Clone, + channel: impl Into + Clone, is_real: impl Into + Clone, ) where V: Into, @@ -215,12 +219,33 @@ impl FieldOpCols { eval_field_operation::(builder, &p_vanishing, &p_witness_low, &p_witness_high); // Range checks for the result, carry, and witness columns. - builder.slice_range_check_u8(&self.result.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(&self.carry.0, shard.clone(), is_real.clone()); - builder.slice_range_check_u8(p_witness_low.coefficients(), shard.clone(), is_real.clone()); - builder.slice_range_check_u8(p_witness_high.coefficients(), shard.clone(), is_real); + builder.slice_range_check_u8( + &self.result.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + &self.carry.0, + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + p_witness_low.coefficients(), + shard.clone(), + channel.clone(), + is_real.clone(), + ); + builder.slice_range_check_u8( + p_witness_high.coefficients(), + shard.clone(), + channel.clone(), + is_real, + ); } + #[allow(clippy::too_many_arguments)] pub fn eval>( &self, builder: &mut AB, @@ -228,13 +253,14 @@ impl FieldOpCols { b: &(impl Into> + Clone), op: FieldOperation, shard: impl Into + Clone, + channel: impl Into + Clone, is_real: impl Into + Clone, ) where V: Into, Limbs: Copy, { let p_limbs = Polynomial::from_iter(P::modulus_field_iter::().map(AB::Expr::from)); - self.eval_with_modulus::(builder, a, b, &p_limbs, op, shard, is_real); + self.eval_with_modulus::(builder, a, b, &p_limbs, op, shard, channel, is_real); } } @@ -285,7 +311,7 @@ mod tests { } impl FieldOpChip

{ - pub fn new(operation: FieldOperation) -> Self { + pub const fn new(operation: FieldOperation) -> Self { Self { operation, _phantom: std::marker::PhantomData, @@ -336,7 +362,7 @@ mod tests { cols.a = P::to_limbs_field::(a); cols.b = P::to_limbs_field::(b); cols.a_op_b - .populate(&mut blu_events, 1, a, b, self.operation); + .populate(&mut blu_events, 1, 0, a, b, self.operation); output.add_byte_lookup_events(blu_events); row }) @@ -379,6 +405,7 @@ mod tests { &local.b, self.operation, AB::F::one(), + AB::F::zero(), AB::F::one(), ); } diff --git a/core/src/operations/field/field_sqrt.rs b/core/src/operations/field/field_sqrt.rs index 95f4f55319..c0401a1d46 100644 --- a/core/src/operations/field/field_sqrt.rs +++ b/core/src/operations/field/field_sqrt.rs @@ -41,6 +41,7 @@ impl FieldSqrtCols { &mut self, record: &mut impl ByteRecord, shard: u32, + channel: u32, a: &BigUint, sqrt_fn: impl Fn(&BigUint) -> BigUint, ) -> BigUint { @@ -52,6 +53,7 @@ impl FieldSqrtCols { let sqrt_squared = self.multiplication.populate( record, shard, + channel, &sqrt, &sqrt, super::field_op::FieldOperation::Mul, @@ -65,13 +67,14 @@ impl FieldSqrtCols { self.multiplication.result = P::to_limbs_field::(&sqrt); // Populate the range columns. - self.range.populate(record, shard, &sqrt); + self.range.populate(record, shard, channel, &sqrt); let sqrt_bytes = P::to_limbs(&sqrt); self.lsb = F::from_canonical_u8(sqrt_bytes[0] & 1); let and_event = ByteLookupEvent { shard, + channel, opcode: ByteOpcode::AND, a1: self.lsb.as_canonical_u32(), a2: 0, @@ -89,18 +92,14 @@ where Limbs: Copy, { /// Calculates the square root of `a`. - pub fn eval< - AB: SP1AirBuilder, - ER: Into + Clone, - EOdd: Into, - EShard: Into + Clone, - >( + pub fn eval>( &self, builder: &mut AB, a: &Limbs, - is_odd: EOdd, - shard: EShard, - is_real: ER, + is_odd: impl Into, + shard: impl Into + Clone, + channel: impl Into + Clone, + is_real: impl Into + Clone, ) where V: Into, { @@ -118,11 +117,17 @@ where &sqrt, super::field_op::FieldOperation::Mul, shard.clone(), + channel.clone(), is_real.clone(), ); - self.range - .eval(builder, &sqrt, shard.clone(), is_real.clone()); + self.range.eval( + builder, + &sqrt, + shard.clone(), + channel.clone(), + is_real.clone(), + ); // Assert that the square root is the positive one, i.e., with least significant bit 0. // This is done by computing LSB = least_significant_byte & 1. @@ -134,6 +139,7 @@ where sqrt[0], AB::F::one(), shard, + channel, is_real, ); } @@ -181,7 +187,7 @@ mod tests { } impl EdSqrtChip

{ - pub fn new() -> Self { + pub const fn new() -> Self { Self { _phantom: std::marker::PhantomData, } @@ -224,7 +230,7 @@ mod tests { let mut row = [F::zero(); NUM_TEST_COLS]; let cols: &mut TestCols = row.as_mut_slice().borrow_mut(); cols.a = P::to_limbs_field::(a); - cols.sqrt.populate(&mut blu_events, 1, a, ed25519_sqrt); + cols.sqrt.populate(&mut blu_events, 1, 0, a, ed25519_sqrt); output.add_byte_lookup_events(blu_events); row }) @@ -263,9 +269,14 @@ mod tests { let local: &TestCols = (*local).borrow(); // eval verifies that local.sqrt.result is indeed the square root of local.a. - local - .sqrt - .eval(builder, &local.a, AB::F::zero(), AB::F::one(), AB::F::one()); + local.sqrt.eval( + builder, + &local.a, + AB::F::zero(), + AB::F::one(), + AB::F::zero(), + AB::F::one(), + ); } } diff --git a/core/src/operations/field/range.rs b/core/src/operations/field/range.rs index 484fff6ebe..da2a2de4e8 100644 --- a/core/src/operations/field/range.rs +++ b/core/src/operations/field/range.rs @@ -28,7 +28,13 @@ pub struct FieldRangeCols { } impl FieldRangeCols { - pub fn populate(&mut self, record: &mut impl ByteRecord, shard: u32, value: &BigUint) { + pub fn populate( + &mut self, + record: &mut impl ByteRecord, + shard: u32, + channel: u32, + value: &BigUint, + ) { let value_limbs = P::to_limbs(value); let modulus_limbs = P::to_limbs(&P::modulus()); @@ -46,6 +52,7 @@ impl FieldRangeCols { record.add_byte_lookup_event(ByteLookupEvent { opcode: ByteOpcode::LTU, shard, + channel, a1: 1, a2: 0, b: *byte as u32, @@ -62,17 +69,13 @@ impl FieldRangeCols { } impl FieldRangeCols { - pub fn eval< - AB: SP1AirBuilder, - E: Into> + Clone, - EShard: Into + Clone, - ER: Into + Clone, - >( + pub fn eval, E: Into> + Clone>( &self, builder: &mut AB, element: &E, - shard: EShard, - is_real: ER, + shard: impl Into + Clone, + channel: impl Into + Clone, + is_real: impl Into + Clone, ) where V: Into, Limbs: Copy, @@ -137,6 +140,7 @@ impl FieldRangeCols { self.comparison_byte, modulus_comparison_byte, shard, + channel, is_real, ) } diff --git a/core/src/operations/fixed_rotate_right.rs b/core/src/operations/fixed_rotate_right.rs index 209b1bb045..5172465b39 100644 --- a/core/src/operations/fixed_rotate_right.rs +++ b/core/src/operations/fixed_rotate_right.rs @@ -28,15 +28,15 @@ pub struct FixedRotateRightOperation { } impl FixedRotateRightOperation { - pub fn nb_bytes_to_shift(rotation: usize) -> usize { + pub const fn nb_bytes_to_shift(rotation: usize) -> usize { rotation / 8 } - pub fn nb_bits_to_shift(rotation: usize) -> usize { + pub const fn nb_bits_to_shift(rotation: usize) -> usize { rotation % 8 } - pub fn carry_multiplier(rotation: usize) -> u32 { + pub const fn carry_multiplier(rotation: usize) -> u32 { let nb_bits_to_shift = Self::nb_bits_to_shift(rotation); 1 << (8 - nb_bits_to_shift) } @@ -45,6 +45,7 @@ impl FixedRotateRightOperation { &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, input: u32, rotation: usize, ) -> u32 { @@ -76,6 +77,7 @@ impl FixedRotateRightOperation { let byte_event = ByteLookupEvent { shard, + channel, opcode: ByteOpcode::ShrCarry, a1: shift as u32, a2: carry as u32, @@ -111,6 +113,7 @@ impl FixedRotateRightOperation { rotation: usize, cols: FixedRotateRightOperation, shard: AB::Var, + channel: impl Into + Clone, is_real: AB::Var, ) { // Compute some constants with respect to the rotation needed for the rotation. @@ -138,6 +141,7 @@ impl FixedRotateRightOperation { input_bytes_rotated[i], AB::F::from_canonical_usize(nb_bits_to_shift), shard, + channel.clone(), is_real, ); diff --git a/core/src/operations/fixed_shift_right.rs b/core/src/operations/fixed_shift_right.rs index 5cadb7acca..305f573d4b 100644 --- a/core/src/operations/fixed_shift_right.rs +++ b/core/src/operations/fixed_shift_right.rs @@ -28,15 +28,15 @@ pub struct FixedShiftRightOperation { } impl FixedShiftRightOperation { - pub fn nb_bytes_to_shift(rotation: usize) -> usize { + pub const fn nb_bytes_to_shift(rotation: usize) -> usize { rotation / 8 } - pub fn nb_bits_to_shift(rotation: usize) -> usize { + pub const fn nb_bits_to_shift(rotation: usize) -> usize { rotation % 8 } - pub fn carry_multiplier(rotation: usize) -> u32 { + pub const fn carry_multiplier(rotation: usize) -> u32 { let nb_bits_to_shift = Self::nb_bits_to_shift(rotation); 1 << (8 - nb_bits_to_shift) } @@ -45,6 +45,7 @@ impl FixedShiftRightOperation { &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, input: u32, rotation: usize, ) -> u32 { @@ -75,6 +76,7 @@ impl FixedShiftRightOperation { let (shift, carry) = shr_carry(b, c); let byte_event = ByteLookupEvent { shard, + channel, opcode: ByteOpcode::ShrCarry, a1: shift as u32, a2: carry as u32, @@ -109,7 +111,8 @@ impl FixedShiftRightOperation { input: Word, rotation: usize, cols: FixedShiftRightOperation, - shard: AB::Var, + shard: impl Into + Copy, + channel: impl Into + Copy, is_real: AB::Var, ) { // Compute some constants with respect to the rotation needed for the rotation. @@ -138,6 +141,7 @@ impl FixedShiftRightOperation { input_bytes_rotated[i].clone(), AB::F::from_canonical_usize(nb_bits_to_shift), shard, + channel, is_real, ); diff --git a/core/src/operations/not.rs b/core/src/operations/not.rs index c7a6adad9e..309c630610 100644 --- a/core/src/operations/not.rs +++ b/core/src/operations/not.rs @@ -19,13 +19,19 @@ pub struct NotOperation { } impl NotOperation { - pub fn populate(&mut self, record: &mut ExecutionRecord, shard: u32, x: u32) -> u32 { + pub fn populate( + &mut self, + record: &mut ExecutionRecord, + shard: u32, + channel: u32, + x: u32, + ) -> u32 { let expected = !x; let x_bytes = x.to_le_bytes(); for i in 0..WORD_SIZE { self.value[i] = F::from_canonical_u8(!x_bytes[i]); } - record.add_u8_range_checks(shard, &x_bytes); + record.add_u8_range_checks(shard, channel, &x_bytes); expected } @@ -34,8 +40,9 @@ impl NotOperation { builder: &mut AB, a: Word, cols: NotOperation, - shard: AB::Var, - is_real: AB::Var, + shard: impl Into + Copy, + channel: impl Into + Copy, + is_real: impl Into + Copy, ) { for i in (0..WORD_SIZE).step_by(2) { builder.send_byte_pair( @@ -45,6 +52,7 @@ impl NotOperation { a[i], a[i + 1], shard, + channel, is_real, ); } diff --git a/core/src/operations/or.rs b/core/src/operations/or.rs index f3dd1a1a91..8cb3f00191 100644 --- a/core/src/operations/or.rs +++ b/core/src/operations/or.rs @@ -20,13 +20,20 @@ pub struct OrOperation { } impl OrOperation { - pub fn populate(&mut self, record: &mut ExecutionRecord, shard: u32, x: u32, y: u32) -> u32 { + pub fn populate( + &mut self, + record: &mut ExecutionRecord, + shard: u32, + channel: u32, + x: u32, + y: u32, + ) -> u32 { let expected = x | y; let x_bytes = x.to_le_bytes(); let y_bytes = y.to_le_bytes(); for i in 0..WORD_SIZE { self.value[i] = F::from_canonical_u8(x_bytes[i] | y_bytes[i]); - record.lookup_or(shard, x_bytes[i], y_bytes[i]); + record.lookup_or(shard, channel, x_bytes[i], y_bytes[i]); } expected } @@ -36,7 +43,8 @@ impl OrOperation { a: Word, b: Word, cols: OrOperation, - shard: AB::Var, + shard: impl Into + Copy, + channel: impl Into + Copy, is_real: AB::Var, ) { for i in 0..WORD_SIZE { @@ -46,6 +54,7 @@ impl OrOperation { a[i], b[i], shard, + channel, is_real, ); } diff --git a/core/src/operations/xor.rs b/core/src/operations/xor.rs index 0b6858f6bf..ffb70f6847 100644 --- a/core/src/operations/xor.rs +++ b/core/src/operations/xor.rs @@ -19,7 +19,14 @@ pub struct XorOperation { } impl XorOperation { - pub fn populate(&mut self, record: &mut ExecutionRecord, shard: u32, x: u32, y: u32) -> u32 { + pub fn populate( + &mut self, + record: &mut ExecutionRecord, + shard: u32, + channel: u32, + x: u32, + y: u32, + ) -> u32 { let expected = x ^ y; let x_bytes = x.to_le_bytes(); let y_bytes = y.to_le_bytes(); @@ -29,6 +36,7 @@ impl XorOperation { let byte_event = ByteLookupEvent { shard, + channel, opcode: ByteOpcode::XOR, a1: xor as u32, a2: 0, @@ -47,6 +55,7 @@ impl XorOperation { b: Word, cols: XorOperation, shard: AB::Var, + channel: impl Into + Clone, is_real: AB::Var, ) { for i in 0..WORD_SIZE { @@ -56,6 +65,7 @@ impl XorOperation { a[i], b[i], shard, + channel.clone(), is_real, ); } diff --git a/core/src/program/mod.rs b/core/src/program/mod.rs index 9bb69d9bfa..5b075db1cb 100644 --- a/core/src/program/mod.rs +++ b/core/src/program/mod.rs @@ -43,7 +43,7 @@ pub struct ProgramMultiplicityCols { pub struct ProgramChip; impl ProgramChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } diff --git a/core/src/runtime/instruction.rs b/core/src/runtime/instruction.rs index 1fcf9a1950..9f8c7533c5 100644 --- a/core/src/runtime/instruction.rs +++ b/core/src/runtime/instruction.rs @@ -16,7 +16,14 @@ pub struct Instruction { impl Instruction { /// Create a new instruction. - pub fn new(opcode: Opcode, op_a: u32, op_b: u32, op_c: u32, imm_b: bool, imm_c: bool) -> Self { + pub const fn new( + opcode: Opcode, + op_a: u32, + op_b: u32, + op_c: u32, + imm_b: bool, + imm_c: bool, + ) -> Self { Self { opcode, op_a, @@ -28,7 +35,7 @@ impl Instruction { } /// Returns if the instruction is an ALU instruction. - pub fn is_alu_instruction(&self) -> bool { + pub const fn is_alu_instruction(&self) -> bool { matches!( self.opcode, Opcode::ADD @@ -58,7 +65,7 @@ impl Instruction { } /// Returns if the instruction is a memory instruction. - pub fn is_memory_instruction(&self) -> bool { + pub const fn is_memory_instruction(&self) -> bool { matches!( self.opcode, Opcode::LB @@ -73,7 +80,7 @@ impl Instruction { } /// Returns if the instruction is a branch instruction. - pub fn is_branch_instruction(&self) -> bool { + pub const fn is_branch_instruction(&self) -> bool { matches!( self.opcode, Opcode::BEQ | Opcode::BNE | Opcode::BLT | Opcode::BGE | Opcode::BLTU | Opcode::BGEU @@ -81,7 +88,7 @@ impl Instruction { } /// Returns if the instruction is a jump instruction. - pub fn is_jump_instruction(&self) -> bool { + pub const fn is_jump_instruction(&self) -> bool { matches!(self.opcode, Opcode::JAL | Opcode::JALR) } } diff --git a/core/src/runtime/io.rs b/core/src/runtime/io.rs index 0be9da0e14..f404a8a554 100644 --- a/core/src/runtime/io.rs +++ b/core/src/runtime/io.rs @@ -60,7 +60,7 @@ pub mod tests { use super::*; use crate::runtime::Program; use crate::utils::tests::IO_ELF; - use crate::utils::{self, prove_simple, BabyBearBlake3}; + use crate::utils::{self, prove_simple, BabyBearBlake3, SP1CoreOpts}; use serde::Deserialize; #[derive(Serialize, Deserialize, Debug, PartialEq)] @@ -89,7 +89,7 @@ pub mod tests { fn test_io_run() { utils::setup_logger(); let program = Program::from(IO_ELF); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); let points = points(); runtime.write_stdin(&points.0); runtime.write_stdin(&points.1); @@ -109,7 +109,7 @@ pub mod tests { fn test_io_prove() { utils::setup_logger(); let program = Program::from(IO_ELF); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); let points = points(); runtime.write_stdin(&points.0); runtime.write_stdin(&points.1); diff --git a/core/src/runtime/memory.rs b/core/src/runtime/memory.rs index badfb9983e..4e66245187 100644 --- a/core/src/runtime/memory.rs +++ b/core/src/runtime/memory.rs @@ -53,7 +53,7 @@ pub struct MemoryWriteRecord { } impl MemoryRecordEnum { - pub fn value(&self) -> u32 { + pub const fn value(&self) -> u32 { match self { MemoryRecordEnum::Read(record) => record.value, MemoryRecordEnum::Write(record) => record.value, @@ -74,7 +74,7 @@ impl From for MemoryRecordEnum { } impl MemoryReadRecord { - pub fn new( + pub const fn new( value: u32, shard: u32, timestamp: u32, @@ -94,7 +94,7 @@ impl MemoryReadRecord { } impl MemoryWriteRecord { - pub fn new( + pub const fn new( value: u32, shard: u32, timestamp: u32, diff --git a/core/src/runtime/mod.rs b/core/src/runtime/mod.rs index 09b21a88aa..2a73cf5dac 100644 --- a/core/src/runtime/mod.rs +++ b/core/src/runtime/mod.rs @@ -29,8 +29,9 @@ use std::sync::Arc; use thiserror::Error; +use crate::bytes::NUM_BYTE_LOOKUP_CHANNELS; use crate::memory::MemoryInitializeFinalizeEvent; -use crate::utils::env; +use crate::utils::SP1CoreOpts; use crate::{alu::AluEvent, cpu::CpuEvent}; /// An implementation of a runtime for the SP1 RISC-V zkVM. @@ -98,7 +99,7 @@ pub enum ExecutionError { impl Runtime { // Create a new runtime from a program. - pub fn new(program: Program) -> Self { + pub fn new(program: Program, opts: SP1CoreOpts) -> Self { // Create a shared reference to the program. let program = Arc::new(program); @@ -124,14 +125,13 @@ impl Runtime { .max() .unwrap_or(0); - let shard_size = env::shard_size() as u32; Self { record, state: ExecutionState::new(program.pc_start), program, memory_accesses: MemoryAccessRecord::default(), - shard_size: shard_size * 4, - shard_batch_size: env::shard_batch_size() as u32, + shard_size: (opts.shard_size as u32) * 4, + shard_batch_size: opts.shard_batch_size as u32, cycle_tracker: HashMap::new(), io_buf: HashMap::new(), trace_buf, @@ -144,8 +144,8 @@ impl Runtime { } /// Recover runtime state from a program and existing execution state. - pub fn recover(program: Program, state: ExecutionState) -> Self { - let mut runtime = Self::new(program); + pub fn recover(program: Program, state: ExecutionState, opts: SP1CoreOpts) -> Self { + let mut runtime = Self::new(program, opts); runtime.state = state; let index: u32 = (runtime.state.global_clk / (runtime.shard_size / 4) as u64) .try_into() @@ -191,15 +191,21 @@ impl Runtime { } /// Get the current timestamp for a given memory access position. - pub fn timestamp(&self, position: &MemoryAccessPosition) -> u32 { + pub const fn timestamp(&self, position: &MemoryAccessPosition) -> u32 { self.state.clk + *position as u32 } /// Get the current shard. + #[inline] pub fn shard(&self) -> u32 { self.state.current_shard } + #[inline] + pub fn channel(&self) -> u32 { + self.state.channel + } + /// Read a word from memory and create an access record. pub fn mr(&mut self, addr: u32, shard: u32, timestamp: u32) -> MemoryReadRecord { // Get the memory record entry. @@ -377,6 +383,7 @@ impl Runtime { fn emit_cpu( &mut self, shard: u32, + channel: u32, clk: u32, pc: u32, next_pc: u32, @@ -390,6 +397,7 @@ impl Runtime { ) { let cpu_event = CpuEvent { shard, + channel, clk, pc, next_pc, @@ -413,6 +421,7 @@ impl Runtime { let event = AluEvent { shard: self.shard(), clk, + channel: self.channel(), opcode, a, b, @@ -852,10 +861,18 @@ impl Runtime { // Update the clk to the next cycle. self.state.clk += 4; + let channel = self.channel(); + + // Update the channel to the next cycle. + if !self.unconstrained { + self.state.channel = (self.state.channel + 1) % NUM_BYTE_LOOKUP_CHANNELS; + } + // Emit the CPU event for this cycle. if self.emit_events { self.emit_cpu( self.shard(), + channel, clk, pc, next_pc, @@ -868,7 +885,6 @@ impl Runtime { exit_code, ); }; - Ok(()) } @@ -892,6 +908,7 @@ impl Runtime { if !self.unconstrained && self.max_syscall_cycles + self.state.clk >= self.shard_size { self.state.current_shard += 1; self.state.clk = 0; + self.state.channel = 0; } Ok(self.state.pc.wrapping_sub(self.program.pc_base) @@ -915,6 +932,7 @@ impl Runtime { fn initialize(&mut self) { self.state.clk = 0; + self.state.channel = 0; tracing::info!("loading memory image"); for (addr, value) in self.program.memory_image.iter() { @@ -1055,7 +1073,10 @@ pub mod tests { use crate::{ runtime::Register, - utils::tests::{FIBONACCI_ELF, PANIC_ELF, SSZ_WITHDRAWALS_ELF}, + utils::{ + tests::{FIBONACCI_ELF, PANIC_ELF, SSZ_WITHDRAWALS_ELF}, + SP1CoreOpts, + }, }; use super::{Instruction, Opcode, Program, Runtime}; @@ -1084,7 +1105,7 @@ pub mod tests { #[test] fn test_simple_program_run() { let program = simple_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 42); } @@ -1093,7 +1114,7 @@ pub mod tests { #[should_panic] fn test_panic() { let program = panic_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); } @@ -1109,7 +1130,7 @@ pub mod tests { Instruction::new(Opcode::ADD, 31, 30, 29, false, false), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 42); } @@ -1126,7 +1147,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 32); } @@ -1143,7 +1164,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 32); } @@ -1160,7 +1181,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 37); @@ -1178,7 +1199,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 5); } @@ -1195,7 +1216,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 1184); } @@ -1212,7 +1233,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 1); } @@ -1229,7 +1250,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 1); } @@ -1246,7 +1267,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 0); } @@ -1263,7 +1284,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 0); } @@ -1280,7 +1301,7 @@ pub mod tests { ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 84); } @@ -1296,7 +1317,7 @@ pub mod tests { Instruction::new(Opcode::ADD, 31, 30, 4, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 5 - 1 + 4); } @@ -1312,7 +1333,7 @@ pub mod tests { Instruction::new(Opcode::XOR, 31, 30, 42, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 10); } @@ -1328,7 +1349,7 @@ pub mod tests { Instruction::new(Opcode::OR, 31, 30, 42, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 47); } @@ -1344,7 +1365,7 @@ pub mod tests { Instruction::new(Opcode::AND, 31, 30, 42, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 0); } @@ -1358,7 +1379,7 @@ pub mod tests { Instruction::new(Opcode::SLL, 31, 29, 4, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 80); } @@ -1372,7 +1393,7 @@ pub mod tests { Instruction::new(Opcode::SRL, 31, 29, 4, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 2); } @@ -1386,7 +1407,7 @@ pub mod tests { Instruction::new(Opcode::SRA, 31, 29, 4, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 2); } @@ -1400,7 +1421,7 @@ pub mod tests { Instruction::new(Opcode::SLT, 31, 29, 37, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 0); } @@ -1414,7 +1435,7 @@ pub mod tests { Instruction::new(Opcode::SLTU, 31, 29, 37, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.register(Register::X31), 0); } @@ -1433,7 +1454,7 @@ pub mod tests { Instruction::new(Opcode::JALR, 5, 11, 8, false, true), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.registers()[Register::X5 as usize], 8); assert_eq!(runtime.registers()[Register::X11 as usize], 100); @@ -1447,7 +1468,7 @@ pub mod tests { Instruction::new(opcode, 12, 10, 11, false, false), ]; let program = Program::new(instructions, 0, 0); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); assert_eq!(runtime.registers()[Register::X12 as usize], expected); } @@ -1665,7 +1686,7 @@ pub mod tests { #[test] fn test_simple_memory_program_run() { let program = simple_memory_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); // Assert SW & LW case diff --git a/core/src/runtime/opcode.rs b/core/src/runtime/opcode.rs index eb9cb03ecb..3eaf8caa88 100644 --- a/core/src/runtime/opcode.rs +++ b/core/src/runtime/opcode.rs @@ -69,7 +69,7 @@ impl Display for Opcode { } impl Opcode { - pub fn mnemonic(&self) -> &str { + pub const fn mnemonic(&self) -> &str { match self { Opcode::ADD => "add", Opcode::SUB => "sub", diff --git a/core/src/runtime/record.rs b/core/src/runtime/record.rs index 83210fcb22..67a2464f99 100644 --- a/core/src/runtime/record.rs +++ b/core/src/runtime/record.rs @@ -24,7 +24,7 @@ use crate::syscall::precompiles::sha256::{ShaCompressEvent, ShaExtendEvent}; use crate::syscall::precompiles::uint256::Uint256MulEvent; use crate::syscall::precompiles::ECDecompressEvent; use crate::syscall::precompiles::{ECAddEvent, ECDoubleEvent}; -use crate::utils::env; +use crate::utils::SP1CoreOpts; /// A record of the execution of a program. Contains event data for everything that happened during /// the execution of the shard. @@ -134,7 +134,7 @@ impl ShardingConfig { impl Default for ShardingConfig { fn default() -> Self { - let shard_size = env::shard_size(); + let shard_size = SP1CoreOpts::default().shard_size; Self { shard_size, add_len: shard_size, diff --git a/core/src/runtime/state.rs b/core/src/runtime/state.rs index 09f6236cc4..8b1c289ee9 100644 --- a/core/src/runtime/state.rs +++ b/core/src/runtime/state.rs @@ -25,6 +25,10 @@ pub struct ExecutionState { /// executed in this shard. pub clk: u32, + /// The channel alternates between 0 and [crate::bytes::NUM_BYTE_LOOKUP_CHANNELS], + /// used to controll byte lookup multiplicity. + pub channel: u32, + /// The program counter. pub pc: u32, @@ -65,6 +69,7 @@ impl ExecutionState { // Start at shard 1 since shard 0 is reserved for memory initialization. current_shard: 1, clk: 0, + channel: 0, pc: pc_start, memory: HashMap::default(), uninitialized_memory: HashMap::default(), diff --git a/core/src/runtime/syscall.rs b/core/src/runtime/syscall.rs index 6f89b374e8..4915f2640f 100644 --- a/core/src/runtime/syscall.rs +++ b/core/src/runtime/syscall.rs @@ -196,6 +196,10 @@ impl<'a> SyscallContext<'a> { self.rt.state.current_shard } + pub fn current_channel(&self) -> u32 { + self.rt.state.channel + } + pub fn mr(&mut self, addr: u32) -> (MemoryReadRecord, u32) { let record = self.rt.mr(addr, self.current_shard, self.clk); (record, record.value) diff --git a/core/src/runtime/utils.rs b/core/src/runtime/utils.rs index 6f4feab738..009353abbb 100644 --- a/core/src/runtime/utils.rs +++ b/core/src/runtime/utils.rs @@ -3,7 +3,7 @@ use std::io::Write; use super::{Instruction, Runtime}; use crate::runtime::Register; -pub fn align(addr: u32) -> u32 { +pub const fn align(addr: u32) -> u32 { addr - addr % 4 } diff --git a/core/src/stark/chip.rs b/core/src/stark/chip.rs index 70264350cb..4a31646431 100644 --- a/core/src/stark/chip.rs +++ b/core/src/stark/chip.rs @@ -127,12 +127,12 @@ where } #[inline] - pub fn quotient_width(&self) -> usize { + pub const fn quotient_width(&self) -> usize { 1 << self.log_quotient_degree } #[inline] - pub fn logup_batch_size(&self) -> usize { + pub const fn logup_batch_size(&self) -> usize { 1 << self.log_quotient_degree } } diff --git a/core/src/stark/machine.rs b/core/src/stark/machine.rs index 8616915586..672226030b 100644 --- a/core/src/stark/machine.rs +++ b/core/src/stark/machine.rs @@ -30,6 +30,7 @@ use crate::stark::DebugConstraintBuilder; use crate::stark::ProverConstraintFolder; use crate::stark::ShardProof; use crate::stark::VerifierConstraintFolder; +use crate::utils::SP1CoreOpts; use super::Chip; use super::Com; @@ -55,7 +56,7 @@ pub struct StarkMachine { } impl StarkMachine { - pub fn new(config: SC, chips: Vec, A>>, num_pv_elts: usize) -> Self { + pub const fn new(config: SC, chips: Vec, A>>, num_pv_elts: usize) -> Self { Self { config, chips, @@ -111,7 +112,7 @@ impl>> StarkMachine { &self.chips } - pub fn num_pv_elts(&self) -> usize { + pub const fn num_pv_elts(&self) -> usize { self.num_pv_elts } @@ -159,7 +160,7 @@ impl>> StarkMachine { /// /// Given a program, this function generates the proving and verifying keys. The keys correspond /// to the program code and other preprocessed colunms such as lookup tables. - #[instrument("setup machine", level = "info", skip_all)] + #[instrument("setup machine", level = "debug", skip_all)] pub fn setup(&self, program: &A::Program) -> (StarkProvingKey, StarkVerifyingKey) { let mut named_preprocessed_traces = tracing::debug_span!("generate preprocessed traces") .in_scope(|| { @@ -258,7 +259,7 @@ impl>> StarkMachine { // Display some statistics about the workload. let stats = record.stats(); - log::info!("Shard: {:?}", stats); + log::info!("shard: {:?}", stats); // For each chip, shard the events into segments. record.shard(config) @@ -273,6 +274,7 @@ impl>> StarkMachine { pk: &StarkProvingKey, record: A::Record, challenger: &mut SC::Challenger, + opts: SP1CoreOpts, ) -> MachineProof where A: for<'a> Air> @@ -284,7 +286,7 @@ impl>> StarkMachine { .in_scope(|| self.shard(record, &::Config::default())); tracing::info_span!("prove_shards") - .in_scope(|| P::prove_shards(self, pk, shards, challenger)) + .in_scope(|| P::prove_shards(self, pk, shards, challenger, opts)) } pub const fn config(&self) -> &SC { @@ -423,12 +425,12 @@ impl>> StarkMachine { let permutation_width = permutation_traces[i].width(); let total_width = trace_width + permutation_width; tracing::debug!( - "{:<11} | Main Cols = {:<5} | Perm Cols = {:<5} | Rows = {:<10} | Cells = {:<10}", - chips[i].name(), - trace_width, - permutation_width, - traces[i].0.height(), - total_width * traces[i].0.height(), + "{:<11} | Main Cols = {:<5} | Perm Cols = {:<5} | Rows = {:<10} | Cells = {:<10}", + chips[i].name(), + trace_width, + permutation_width, + traces[i].0.height(), + total_width * traces[i].0.height(), ); } @@ -529,6 +531,7 @@ pub mod tests { use crate::utils::run_test; use crate::utils::setup_logger; use crate::utils::BabyBearPoseidon2; + use crate::utils::SP1CoreOpts; #[test] fn test_simple_prove() { @@ -676,7 +679,13 @@ pub mod tests { setup_logger(); let program = fibonacci_program(); let stdin = SP1Stdin::new(); - prove(program, &stdin, BabyBearPoseidon2::new()).unwrap(); + prove( + program, + &stdin, + BabyBearPoseidon2::new(), + SP1CoreOpts::default(), + ) + .unwrap(); } #[test] diff --git a/core/src/stark/permutation.rs b/core/src/stark/permutation.rs index 4536856ade..a76b4c8995 100644 --- a/core/src/stark/permutation.rs +++ b/core/src/stark/permutation.rs @@ -9,25 +9,6 @@ use rayon_scan::ScanParallelIterator; use crate::{air::MultiTableAirBuilder, lookup::Interaction}; -/// Generates powers of a random element based on how many interactions there are in the chip. -/// -/// These elements are used to uniquely fingerprint each interaction. -#[inline] -pub fn generate_interaction_rlc_elements( - sends: &[Interaction], - receives: &[Interaction], - random_element: AF, -) -> Vec { - let n = sends - .iter() - .chain(receives.iter()) - .map(|interaction| interaction.argument_index()) - .max() - .unwrap_or(0) - + 1; - random_element.powers().skip(1).take(n).collect::>() -} - #[inline] #[allow(clippy::too_many_arguments)] pub fn populate_permutation_row>( @@ -36,7 +17,7 @@ pub fn populate_permutation_row>( main_row: &[F], sends: &[Interaction], receives: &[Interaction], - alphas: &[EF], + alpha: EF, betas: Powers, batch_size: usize, ) { @@ -50,9 +31,11 @@ pub fn populate_permutation_row>( *value = chunk .into_iter() .map(|(interaction, is_send)| { - let alpha = alphas[interaction.argument_index()]; let mut denominator = alpha; - for (columns, beta) in interaction.values.iter().zip(betas.clone()) { + let mut betas = betas.clone(); + denominator += + betas.next().unwrap() * EF::from_canonical_usize(interaction.argument_index()); + for (columns, beta) in interaction.values.iter().zip(betas) { denominator += beta * columns.apply::(preprocessed_row, main_row) } let mut mult = interaction @@ -87,7 +70,7 @@ pub(crate) fn generate_permutation_trace>( batch_size: usize, ) -> RowMajorMatrix { // Generate the RLC elements to uniquely identify each interaction. - let alphas = generate_interaction_rlc_elements(sends, receives, random_elements[0]); + let alpha = random_elements[0]; // Generate the RLC elements to uniquely identify each item in the looked up tuple. let betas = random_elements[1].powers(); @@ -122,7 +105,7 @@ pub(crate) fn generate_permutation_trace>( main_row.collect::>().as_slice(), sends, receives, - &alphas, + alpha, betas.clone(), batch_size, ) @@ -139,7 +122,7 @@ pub(crate) fn generate_permutation_trace>( main_row, sends, receives, - &alphas, + alpha, betas.clone(), batch_size, ) @@ -208,9 +191,6 @@ pub fn eval_permutation_constraints( let perm_next = perm.row_slice(1); let perm_next: &[AB::VarEF] = (*perm_next).borrow(); - let alphas = generate_interaction_rlc_elements(sends, receives, alpha); - let betas = beta.powers(); - // Ensure that each batch sum m_i/f_i is computed correctly. let interaction_chunks = &sends .iter() @@ -244,12 +224,14 @@ pub fn eval_permutation_constraints( let mut rlcs: Vec = Vec::with_capacity(batch_size); let mut multiplicities: Vec = Vec::with_capacity(batch_size); for (interaction, is_send) in chunk { - let mut rlc = AB::ExprEF::zero(); + let mut rlc = alpha.clone(); + let mut betas = beta.powers(); + rlc += betas.next().unwrap() + * AB::ExprEF::from_canonical_usize(interaction.argument_index()); for (field, beta) in interaction.values.iter().zip(betas.clone()) { let elem = field.apply::(&preprocessed_local, main_local); rlc += beta * elem; } - rlc += alphas[interaction.argument_index()].clone(); rlcs.push(rlc); let send_factor = if is_send { AB::F::one() } else { -AB::F::one() }; diff --git a/core/src/stark/prover.rs b/core/src/stark/prover.rs index 2ca5237e09..7c22161e1f 100644 --- a/core/src/stark/prover.rs +++ b/core/src/stark/prover.rs @@ -27,7 +27,7 @@ use crate::stark::record::MachineRecord; use crate::stark::MachineChip; use crate::stark::PackedChallenge; use crate::stark::ProverConstraintFolder; -use crate::utils::env; +use crate::utils::SP1CoreOpts; fn chunk_vec(mut vec: Vec, chunk_size: usize) -> Vec> { let mut result = Vec::new(); @@ -45,6 +45,7 @@ pub trait Prover>> { pk: &StarkProvingKey, shards: Vec, challenger: &mut SC::Challenger, + opts: SP1CoreOpts, ) -> MachineProof where A: for<'a> Air> @@ -68,6 +69,7 @@ where pk: &StarkProvingKey, shards: Vec, challenger: &mut SC::Challenger, + opts: SP1CoreOpts, ) -> MachineProof where A: for<'a> Air> @@ -77,7 +79,7 @@ where // Observe the preprocessed commitment. pk.observe_into(challenger); // Generate and commit the traces for each segment. - let (shard_commits, shard_data) = Self::commit_shards(machine, &shards); + let (shard_commits, shard_data) = Self::commit_shards(machine, &shards, opts); // Observe the challenges for each segment. tracing::debug_span!("observing all challenges").in_scope(|| { @@ -95,10 +97,10 @@ where // Generate a proof for each segment. Note that we clone the challenger so we can observe // identical global challenges across the segments. - let chunking_multiplier = env::shard_chunking_multiplier(); + let chunking_multiplier = opts.shard_chunking_multiplier; let chunk_size = std::cmp::max(chunking_multiplier * shards.len() / num_cpus::get(), 1); let config = machine.config(); - let reconstruct_commitments = env::reconstruct_commitments(); + let reconstruct_commitments = opts.reconstruct_commitments; let shard_data_chunks = chunk_vec(shard_data, chunk_size); let shard_chunks = chunk_vec(shards, chunk_size); let parent_span = tracing::debug_span!("open_shards"); @@ -543,6 +545,7 @@ where pub fn commit_shards( machine: &StarkMachine, shards: &[A::Record], + opts: SP1CoreOpts, ) -> (Vec>, Vec>) where F: PrimeField32, @@ -556,7 +559,7 @@ where // Get the number of shards that is the threshold for saving shards to disk instead of // keeping all the shards in memory. - let reconstruct_commitments = env::reconstruct_commitments(); + let reconstruct_commitments = opts.reconstruct_commitments; let finished = AtomicU32::new(0); let chunk_size = std::cmp::max(shards.len() / num_cpus::get(), 1); let parent_span = tracing::debug_span!("commit to all shards"); diff --git a/core/src/stark/types.rs b/core/src/stark/types.rs index d11e462b64..67f07cc032 100644 --- a/core/src/stark/types.rs +++ b/core/src/stark/types.rs @@ -30,7 +30,7 @@ pub struct ShardMainData { } impl ShardMainData { - pub fn new( + pub const fn new( traces: Vec>>, main_commit: Com, main_data: PcsProverData, @@ -64,7 +64,7 @@ impl ShardMainData { Ok(ShardMainDataWrapper::TempFile(file, bytes_written)) } - pub fn to_in_memory(self) -> ShardMainDataWrapper { + pub const fn to_in_memory(self) -> ShardMainDataWrapper { ShardMainDataWrapper::InMemory(self) } } diff --git a/core/src/stark/verifier.rs b/core/src/stark/verifier.rs index 6f5bad846d..17e3753336 100644 --- a/core/src/stark/verifier.rs +++ b/core/src/stark/verifier.rs @@ -176,7 +176,6 @@ impl>> Verifier { .map_err(|e| VerificationError::InvalidopeningArgument(e))?; // Verify the constrtaint evaluations. - for (chip, trace_domain, qc_domains, values) in izip!( chips.iter(), trace_domains, @@ -199,6 +198,12 @@ impl>> Verifier { ) .map_err(|_| VerificationError::OodEvaluationMismatch(chip.name()))?; } + + let nb_cpu_chips = chips.iter().filter(|chip| chip.name() == "CPU").count(); + if nb_cpu_chips != 1 { + return Err(VerificationError::MissingCpuChip); + } + Ok(()) } @@ -411,6 +416,7 @@ pub enum VerificationError { OodEvaluationMismatch(String), /// The shape of the opening arguments is invalid. OpeningShapeError(String, OpeningShapeError), + MissingCpuChip, } impl Debug for OpeningShapeError { @@ -474,6 +480,9 @@ impl Debug for VerificationError { VerificationError::OpeningShapeError(chip, e) => { write!(f, "Invalid opening shape for chip {}: {:?}", chip, e) } + VerificationError::MissingCpuChip => { + write!(f, "Missing CPU chip") + } } } } @@ -490,6 +499,9 @@ impl Display for VerificationError { VerificationError::OpeningShapeError(chip, e) => { write!(f, "Invalid opening shape for chip {}: {}", chip, e) } + VerificationError::MissingCpuChip => { + write!(f, "Missing CPU chip in shard") + } } } } diff --git a/core/src/syscall/commit.rs b/core/src/syscall/commit.rs index 66fd251c34..7c8fcabc15 100644 --- a/core/src/syscall/commit.rs +++ b/core/src/syscall/commit.rs @@ -4,7 +4,7 @@ use crate::runtime::{Syscall, SyscallContext}; pub struct SyscallCommit; impl SyscallCommit { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } @@ -29,7 +29,7 @@ impl Syscall for SyscallCommit { pub struct SyscallCommitDeferred; impl SyscallCommitDeferred { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } diff --git a/core/src/syscall/halt.rs b/core/src/syscall/halt.rs index 9572beecb8..8da62614db 100644 --- a/core/src/syscall/halt.rs +++ b/core/src/syscall/halt.rs @@ -3,7 +3,7 @@ use crate::runtime::{Syscall, SyscallContext}; pub struct SyscallHalt; impl SyscallHalt { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } diff --git a/core/src/syscall/hint.rs b/core/src/syscall/hint.rs index e79fedfec1..8cf8a2d614 100644 --- a/core/src/syscall/hint.rs +++ b/core/src/syscall/hint.rs @@ -4,7 +4,7 @@ pub struct SyscallHintLen; /// SyscallHintLen returns the length of the next slice in the hint input stream. impl SyscallHintLen { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } @@ -22,7 +22,7 @@ pub struct SyscallHintRead; /// SyscallHintRead returns the length of the next slice in the hint input stream. impl SyscallHintRead { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } @@ -75,7 +75,7 @@ mod tests { use crate::{ io::SP1Stdin, runtime::Program, - utils::{prove, setup_logger, BabyBearPoseidon2}, + utils::{prove, setup_logger, BabyBearPoseidon2, SP1CoreOpts}, }; const HINT_IO_ELF: &[u8] = @@ -96,6 +96,6 @@ mod tests { let program = Program::from(HINT_IO_ELF); let config = BabyBearPoseidon2::new(); - prove(program, &stdin, config).unwrap(); + prove(program, &stdin, config, SP1CoreOpts::default()).unwrap(); } } diff --git a/core/src/syscall/precompiles/blake3/compress/air.rs b/core/src/syscall/precompiles/blake3/compress/air.rs index 6037d46791..a5876866e3 100644 --- a/core/src/syscall/precompiles/blake3/compress/air.rs +++ b/core/src/syscall/precompiles/blake3/compress/air.rs @@ -39,6 +39,7 @@ where // TODO: constraint clk column to increment by 1 within same invocation of syscall. builder.receive_syscall( local.shard, + local.channel, local.clk, AB::F::from_canonical_u32(SyscallCode::BLAKE3_COMPRESS_INNER.syscall_id()), local.state_ptr, @@ -145,6 +146,7 @@ impl Blake3CompressInnerChip { for i in 0..NUM_STATE_WORDS_PER_CALL { builder.eval_memory_access( local.shard, + local.channel, local.clk, local.state_ptr + local.state_index[i] * AB::F::from_canonical_usize(WORD_SIZE), &local.state_reads_writes[i], @@ -181,6 +183,7 @@ impl Blake3CompressInnerChip { for i in 0..NUM_MSG_WORDS_PER_CALL { builder.eval_memory_access( local.shard, + local.channel, local.clk, local.message_ptr + local.msg_schedule[i] * AB::F::from_canonical_usize(WORD_SIZE), &local.message_reads[i], @@ -209,7 +212,14 @@ impl Blake3CompressInnerChip { ]; // Call the g function. - GOperation::::eval(builder, input, local.g, local.shard, local.is_real); + GOperation::::eval( + builder, + input, + local.g, + local.shard, + local.channel, + local.is_real, + ); // Finally, the results of the g function should be written to the memory. for i in 0..NUM_STATE_WORDS_PER_CALL { diff --git a/core/src/syscall/precompiles/blake3/compress/columns.rs b/core/src/syscall/precompiles/blake3/compress/columns.rs index 12ea0139c9..bf7bbe4e1e 100644 --- a/core/src/syscall/precompiles/blake3/compress/columns.rs +++ b/core/src/syscall/precompiles/blake3/compress/columns.rs @@ -17,6 +17,7 @@ pub const NUM_BLAKE3_COMPRESS_INNER_COLS: usize = size_of:: { pub shard: T, + pub channel: T, pub clk: T, pub ecall_receive: T, diff --git a/core/src/syscall/precompiles/blake3/compress/execute.rs b/core/src/syscall/precompiles/blake3/compress/execute.rs index 113c126783..35298b0415 100644 --- a/core/src/syscall/precompiles/blake3/compress/execute.rs +++ b/core/src/syscall/precompiles/blake3/compress/execute.rs @@ -57,11 +57,13 @@ impl Syscall for Blake3CompressInnerChip { } let shard = rt.current_shard(); + let channel = rt.current_channel(); rt.record_mut() .blake3_compress_inner_events .push(Blake3CompressInnerEvent { shard, + channel, clk: start_clk, state_ptr, message_reads, diff --git a/core/src/syscall/precompiles/blake3/compress/g.rs b/core/src/syscall/precompiles/blake3/compress/g.rs index 53f93e5ca0..06e8c30348 100644 --- a/core/src/syscall/precompiles/blake3/compress/g.rs +++ b/core/src/syscall/precompiles/blake3/compress/g.rs @@ -49,6 +49,7 @@ impl GOperation { &mut self, record: &mut ExecutionRecord, shard: u32, + channel: u32, input: [u32; 6], ) -> [u32; 4] { let mut a = input[0]; @@ -61,37 +62,41 @@ impl GOperation { // First 4 steps. { // a = a + b + x. - a = self.a_plus_b.populate(record, shard, a, b); - a = self.a_plus_b_plus_x.populate(record, shard, a, x); + a = self.a_plus_b.populate(record, shard, channel, a, b); + a = self.a_plus_b_plus_x.populate(record, shard, channel, a, x); // d = (d ^ a).rotate_right(16). - d = self.d_xor_a.populate(record, shard, d, a); + d = self.d_xor_a.populate(record, shard, channel, d, a); d = d.rotate_right(16); // c = c + d. - c = self.c_plus_d.populate(record, shard, c, d); + c = self.c_plus_d.populate(record, shard, channel, c, d); // b = (b ^ c).rotate_right(12). - b = self.b_xor_c.populate(record, shard, b, c); - b = self.b_xor_c_rotate_right_12.populate(record, shard, b, 12); + b = self.b_xor_c.populate(record, shard, channel, b, c); + b = self + .b_xor_c_rotate_right_12 + .populate(record, shard, channel, b, 12); } // Second 4 steps. { // a = a + b + y. - a = self.a_plus_b_2.populate(record, shard, a, b); - a = self.a_plus_b_2_add_y.populate(record, shard, a, y); + a = self.a_plus_b_2.populate(record, shard, channel, a, b); + a = self.a_plus_b_2_add_y.populate(record, shard, channel, a, y); // d = (d ^ a).rotate_right(8). - d = self.d_xor_a_2.populate(record, shard, d, a); + d = self.d_xor_a_2.populate(record, shard, channel, d, a); d = d.rotate_right(8); // c = c + d. - c = self.c_plus_d_2.populate(record, shard, c, d); + c = self.c_plus_d_2.populate(record, shard, channel, c, d); // b = (b ^ c).rotate_right(7). - b = self.b_xor_c_2.populate(record, shard, b, c); - b = self.b_xor_c_2_rotate_right_7.populate(record, shard, b, 7); + b = self.b_xor_c_2.populate(record, shard, channel, b, c); + b = self + .b_xor_c_2_rotate_right_7 + .populate(record, shard, channel, b, 7); } let result = [a, b, c, d]; @@ -105,6 +110,7 @@ impl GOperation { input: [Word; 6], cols: GOperation, shard: AB::Var, + channel: impl Into + Clone, is_real: AB::Var, ) { builder.assert_bool(is_real); @@ -118,23 +124,63 @@ impl GOperation { // First 4 steps. { // a = a + b + x. - AddOperation::::eval(builder, a, b, cols.a_plus_b, shard, is_real.into()); + AddOperation::::eval( + builder, + a, + b, + cols.a_plus_b, + shard, + channel.clone(), + is_real.into(), + ); a = cols.a_plus_b.value; - AddOperation::::eval(builder, a, x, cols.a_plus_b_plus_x, shard, is_real.into()); + AddOperation::::eval( + builder, + a, + x, + cols.a_plus_b_plus_x, + shard, + channel.clone(), + is_real.into(), + ); a = cols.a_plus_b_plus_x.value; // d = (d ^ a).rotate_right(16). - XorOperation::::eval(builder, d, a, cols.d_xor_a, shard, is_real); + XorOperation::::eval( + builder, + d, + a, + cols.d_xor_a, + shard, + channel.clone(), + is_real, + ); d = cols.d_xor_a.value; // Rotate right by 16 bits. d = Word([d[2], d[3], d[0], d[1]]); // c = c + d. - AddOperation::::eval(builder, c, d, cols.c_plus_d, shard, is_real.into()); + AddOperation::::eval( + builder, + c, + d, + cols.c_plus_d, + shard, + channel.clone(), + is_real.into(), + ); c = cols.c_plus_d.value; // b = (b ^ c).rotate_right(12). - XorOperation::::eval(builder, b, c, cols.b_xor_c, shard, is_real); + XorOperation::::eval( + builder, + b, + c, + cols.b_xor_c, + shard, + channel.clone(), + is_real, + ); b = cols.b_xor_c.value; FixedRotateRightOperation::::eval( builder, @@ -142,6 +188,7 @@ impl GOperation { 12, cols.b_xor_c_rotate_right_12, shard, + channel.clone(), is_real, ); b = cols.b_xor_c_rotate_right_12.value; @@ -150,7 +197,15 @@ impl GOperation { // Second 4 steps. { // a = a + b + y. - AddOperation::::eval(builder, a, b, cols.a_plus_b_2, shard, is_real.into()); + AddOperation::::eval( + builder, + a, + b, + cols.a_plus_b_2, + shard, + channel.clone(), + is_real.into(), + ); a = cols.a_plus_b_2.value; AddOperation::::eval( builder, @@ -158,22 +213,47 @@ impl GOperation { y, cols.a_plus_b_2_add_y, shard, + channel.clone(), is_real.into(), ); a = cols.a_plus_b_2_add_y.value; // d = (d ^ a).rotate_right(8). - XorOperation::::eval(builder, d, a, cols.d_xor_a_2, shard, is_real); + XorOperation::::eval( + builder, + d, + a, + cols.d_xor_a_2, + shard, + channel.clone(), + is_real, + ); d = cols.d_xor_a_2.value; // Rotate right by 8 bits. d = Word([d[1], d[2], d[3], d[0]]); // c = c + d. - AddOperation::::eval(builder, c, d, cols.c_plus_d_2, shard, is_real.into()); + AddOperation::::eval( + builder, + c, + d, + cols.c_plus_d_2, + shard, + channel.clone(), + is_real.into(), + ); c = cols.c_plus_d_2.value; // b = (b ^ c).rotate_right(7). - XorOperation::::eval(builder, b, c, cols.b_xor_c_2, shard, is_real); + XorOperation::::eval( + builder, + b, + c, + cols.b_xor_c_2, + shard, + channel.clone(), + is_real, + ); b = cols.b_xor_c_2.value; FixedRotateRightOperation::::eval( builder, @@ -181,6 +261,7 @@ impl GOperation { 7, cols.b_xor_c_2_rotate_right_7, shard, + channel.clone(), is_real, ); b = cols.b_xor_c_2_rotate_right_7.value; diff --git a/core/src/syscall/precompiles/blake3/compress/mod.rs b/core/src/syscall/precompiles/blake3/compress/mod.rs index e8c1f8c3e1..a89b9bcc34 100644 --- a/core/src/syscall/precompiles/blake3/compress/mod.rs +++ b/core/src/syscall/precompiles/blake3/compress/mod.rs @@ -72,7 +72,7 @@ pub(crate) const G_INDEX: [[usize; NUM_STATE_WORDS_PER_CALL]; OPERATION_COUNT] = [3, 4, 9, 14], ]; -pub(crate) fn g_func(input: [u32; 6]) -> [u32; 4] { +pub(crate) const fn g_func(input: [u32; 6]) -> [u32; 4] { let mut a = input[0]; let mut b = input[1]; let mut c = input[2]; @@ -94,6 +94,7 @@ pub(crate) fn g_func(input: [u32; 6]) -> [u32; 4] { pub struct Blake3CompressInnerEvent { pub clk: u32, pub shard: u32, + pub channel: u32, pub state_ptr: u32, pub message_ptr: u32, pub message_reads: [[[MemoryReadRecord; NUM_MSG_WORDS_PER_CALL]; OPERATION_COUNT]; ROUND_COUNT], @@ -104,7 +105,7 @@ pub struct Blake3CompressInnerEvent { pub struct Blake3CompressInnerChip {} impl Blake3CompressInnerChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } diff --git a/core/src/syscall/precompiles/blake3/compress/trace.rs b/core/src/syscall/precompiles/blake3/compress/trace.rs index dec27f7939..14994cb031 100644 --- a/core/src/syscall/precompiles/blake3/compress/trace.rs +++ b/core/src/syscall/precompiles/blake3/compress/trace.rs @@ -37,6 +37,7 @@ impl MachineAir for Blake3CompressInnerChip { for i in 0..input.blake3_compress_inner_events.len() { let event = input.blake3_compress_inner_events[i].clone(); let shard = event.shard; + let channel = event.channel; let mut clk = event.clk; for round in 0..ROUND_COUNT { for operation in 0..OPERATION_COUNT { @@ -46,6 +47,7 @@ impl MachineAir for Blake3CompressInnerChip { // Assign basic values to the columns. { cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(clk); cols.round_index = F::from_canonical_u32(round as u32); @@ -73,6 +75,7 @@ impl MachineAir for Blake3CompressInnerChip { cols.message_ptr = F::from_canonical_u32(event.message_ptr); for i in 0..NUM_MSG_WORDS_PER_CALL { cols.message_reads[i].populate( + channel, event.message_reads[round][operation][i], &mut new_byte_lookup_events, ); @@ -81,6 +84,7 @@ impl MachineAir for Blake3CompressInnerChip { cols.state_ptr = F::from_canonical_u32(event.state_ptr); for i in 0..NUM_STATE_WORDS_PER_CALL { cols.state_reads_writes[i].populate( + channel, MemoryRecordEnum::Write(event.state_writes[round][operation][i]), &mut new_byte_lookup_events, ); @@ -98,7 +102,7 @@ impl MachineAir for Blake3CompressInnerChip { event.message_reads[round][operation][1].value, ]; - cols.g.populate(output, shard, input); + cols.g.populate(output, shard, channel, input); } clk += 1; diff --git a/core/src/syscall/precompiles/edwards/ed_add.rs b/core/src/syscall/precompiles/edwards/ed_add.rs index db820faac6..f4e15423a7 100644 --- a/core/src/syscall/precompiles/edwards/ed_add.rs +++ b/core/src/syscall/precompiles/edwards/ed_add.rs @@ -52,6 +52,7 @@ pub const NUM_ED_ADD_COLS: usize = size_of::>(); pub struct EdAddAssignCols { pub is_real: T, pub shard: T, + pub channel: T, pub clk: T, pub p_ptr: T, pub q_ptr: T, @@ -73,14 +74,17 @@ pub struct EdAddAssignChip { } impl EdAddAssignChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { _marker: PhantomData, } } + + #[allow(clippy::too_many_arguments)] fn populate_field_ops( record: &mut impl ByteRecord, shard: u32, + channel: u32, cols: &mut EdAddAssignCols, p_x: BigUint, p_y: BigUint, @@ -90,34 +94,41 @@ impl EdAddAssignChip { let x3_numerator = cols.x3_numerator.populate( record, shard, + channel, &[p_x.clone(), q_x.clone()], &[q_y.clone(), p_y.clone()], ); let y3_numerator = cols.y3_numerator.populate( record, shard, + channel, &[p_y.clone(), p_x.clone()], &[q_y.clone(), q_x.clone()], ); - let x1_mul_y1 = cols - .x1_mul_y1 - .populate(record, shard, &p_x, &p_y, FieldOperation::Mul); - let x2_mul_y2 = cols - .x2_mul_y2 - .populate(record, shard, &q_x, &q_y, FieldOperation::Mul); - let f = cols - .f - .populate(record, shard, &x1_mul_y1, &x2_mul_y2, FieldOperation::Mul); + let x1_mul_y1 = + cols.x1_mul_y1 + .populate(record, shard, channel, &p_x, &p_y, FieldOperation::Mul); + let x2_mul_y2 = + cols.x2_mul_y2 + .populate(record, shard, channel, &q_x, &q_y, FieldOperation::Mul); + let f = cols.f.populate( + record, + shard, + channel, + &x1_mul_y1, + &x2_mul_y2, + FieldOperation::Mul, + ); let d = E::d_biguint(); let d_mul_f = cols .d_mul_f - .populate(record, shard, &f, &d, FieldOperation::Mul); + .populate(record, shard, channel, &f, &d, FieldOperation::Mul); cols.x3_ins - .populate(record, shard, &x3_numerator, &d_mul_f, true); + .populate(record, shard, channel, &x3_numerator, &d_mul_f, true); cols.y3_ins - .populate(record, shard, &y3_numerator, &d_mul_f, false); + .populate(record, shard, channel, &y3_numerator, &d_mul_f, false); } } @@ -168,6 +179,7 @@ impl MachineAir for Ed // Populate basic columns. cols.is_real = F::one(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.p_ptr = F::from_canonical_u32(event.p_ptr); cols.q_ptr = F::from_canonical_u32(event.q_ptr); @@ -176,6 +188,7 @@ impl MachineAir for Ed Self::populate_field_ops( &mut new_byte_lookup_events, event.shard, + event.channel, cols, p_x, p_y, @@ -185,12 +198,18 @@ impl MachineAir for Ed // Populate the memory access columns. for i in 0..WORDS_CURVE_POINT { - cols.q_access[i] - .populate(event.q_memory_records[i], &mut new_byte_lookup_events); + cols.q_access[i].populate( + event.channel, + event.q_memory_records[i], + &mut new_byte_lookup_events, + ); } for i in 0..WORDS_CURVE_POINT { - cols.p_access[i] - .populate(event.p_memory_records[i], &mut new_byte_lookup_events); + cols.p_access[i].populate( + event.channel, + event.p_memory_records[i], + &mut new_byte_lookup_events, + ); } (row, new_byte_lookup_events) @@ -208,6 +227,7 @@ impl MachineAir for Ed Self::populate_field_ops( &mut vec![], 0, + 0, cols, zero.clone(), zero.clone(), @@ -250,12 +270,24 @@ where let y2 = limbs_from_prev_access(&row.q_access[8..16]); // x3_numerator = x1 * y2 + x2 * y1. - row.x3_numerator - .eval(builder, &[x1, x2], &[y2, y1], row.shard, row.is_real); + row.x3_numerator.eval( + builder, + &[x1, x2], + &[y2, y1], + row.shard, + row.channel, + row.is_real, + ); // y3_numerator = y1 * y2 + x1 * x2. - row.y3_numerator - .eval(builder, &[y1, x1], &[y2, x2], row.shard, row.is_real); + row.y3_numerator.eval( + builder, + &[y1, x1], + &[y2, x2], + row.shard, + row.channel, + row.is_real, + ); // f = x1 * x2 * y1 * y2. row.x1_mul_y1.eval( @@ -264,6 +296,7 @@ where &y1, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); row.x2_mul_y2.eval( @@ -272,6 +305,7 @@ where &y2, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -283,6 +317,7 @@ where &x2_mul_y2, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -296,6 +331,7 @@ where &d_const, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -308,6 +344,7 @@ where &d_mul_f, true, row.shard, + row.channel, row.is_real, ); @@ -318,6 +355,7 @@ where &d_mul_f, false, row.shard, + row.channel, row.is_real, ); @@ -334,6 +372,7 @@ where builder.eval_memory_access_slice( row.shard, + row.channel, row.clk.into(), row.q_ptr, &row.q_access, @@ -342,6 +381,7 @@ where builder.eval_memory_access_slice( row.shard, + row.channel, row.clk + AB::F::from_canonical_u32(1), row.p_ptr, &row.p_access, @@ -350,6 +390,7 @@ where builder.receive_syscall( row.shard, + row.channel, row.clk, AB::F::from_canonical_u32(SyscallCode::ED_ADD.syscall_id()), row.p_ptr, diff --git a/core/src/syscall/precompiles/edwards/ed_decompress.rs b/core/src/syscall/precompiles/edwards/ed_decompress.rs index 62da4f9c3e..be62467c00 100644 --- a/core/src/syscall/precompiles/edwards/ed_decompress.rs +++ b/core/src/syscall/precompiles/edwards/ed_decompress.rs @@ -54,6 +54,7 @@ use super::{WordsFieldElement, WORDS_FIELD_ELEMENT}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct EdDecompressEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub ptr: u32, pub sign: bool, @@ -75,6 +76,7 @@ pub const NUM_ED_DECOMPRESS_COLS: usize = size_of::>(); pub struct EdDecompressCols { pub is_real: T, pub shard: T, + pub channel: T, pub clk: T, pub ptr: T, pub sign: T, @@ -99,16 +101,25 @@ impl EdDecompressCols { let mut new_byte_lookup_events = Vec::new(); self.is_real = F::from_bool(true); self.shard = F::from_canonical_u32(event.shard); + self.channel = F::from_canonical_u32(event.channel); self.clk = F::from_canonical_u32(event.clk); self.ptr = F::from_canonical_u32(event.ptr); self.sign = F::from_bool(event.sign); for i in 0..8 { - self.x_access[i].populate(event.x_memory_records[i], &mut new_byte_lookup_events); - self.y_access[i].populate(event.y_memory_records[i], &mut new_byte_lookup_events); + self.x_access[i].populate( + event.channel, + event.x_memory_records[i], + &mut new_byte_lookup_events, + ); + self.y_access[i].populate( + event.channel, + event.y_memory_records[i], + &mut new_byte_lookup_events, + ); } let y = &BigUint::from_bytes_le(&event.y_bytes); - self.populate_field_ops::(&mut new_byte_lookup_events, event.shard, y); + self.populate_field_ops::(&mut new_byte_lookup_events, event.shard, event.channel, y); record.add_byte_lookup_events(new_byte_lookup_events); } @@ -117,28 +128,42 @@ impl EdDecompressCols { &mut self, blu_events: &mut Vec, shard: u32, + channel: u32, y: &BigUint, ) { let one = BigUint::one(); - self.y_range.populate(blu_events, shard, y); + self.y_range.populate(blu_events, shard, channel, y); let yy = self .yy - .populate(blu_events, shard, y, y, FieldOperation::Mul); + .populate(blu_events, shard, channel, y, y, FieldOperation::Mul); let u = self .u - .populate(blu_events, shard, &yy, &one, FieldOperation::Sub); - let dyy = self - .dyy - .populate(blu_events, shard, &E::d_biguint(), &yy, FieldOperation::Mul); + .populate(blu_events, shard, channel, &yy, &one, FieldOperation::Sub); + let dyy = self.dyy.populate( + blu_events, + shard, + channel, + &E::d_biguint(), + &yy, + FieldOperation::Mul, + ); let v = self .v - .populate(blu_events, shard, &one, &dyy, FieldOperation::Add); - let u_div_v = self - .u_div_v - .populate(blu_events, shard, &u, &v, FieldOperation::Div); - let x = self.x.populate(blu_events, shard, &u_div_v, ed25519_sqrt); - self.neg_x - .populate(blu_events, shard, &BigUint::zero(), &x, FieldOperation::Sub); + .populate(blu_events, shard, channel, &one, &dyy, FieldOperation::Add); + let u_div_v = + self.u_div_v + .populate(blu_events, shard, channel, &u, &v, FieldOperation::Div); + let x = self + .x + .populate(blu_events, shard, channel, &u_div_v, ed25519_sqrt); + self.neg_x.populate( + blu_events, + shard, + channel, + &BigUint::zero(), + &x, + FieldOperation::Sub, + ); } } @@ -152,13 +177,15 @@ impl EdDecompressCols { builder.assert_bool(self.sign); let y: Limbs = limbs_from_prev_access(&self.y_access); - self.y_range.eval(builder, &y, self.shard, self.is_real); + self.y_range + .eval(builder, &y, self.shard, self.channel, self.is_real); self.yy.eval( builder, &y, &y, FieldOperation::Mul, self.shard, + self.channel, self.is_real, ); self.u.eval( @@ -167,6 +194,7 @@ impl EdDecompressCols { &[AB::Expr::one()].iter(), FieldOperation::Sub, self.shard, + self.channel, self.is_real, ); let d_biguint = E::d_biguint(); @@ -177,6 +205,7 @@ impl EdDecompressCols { &self.yy.result, FieldOperation::Mul, self.shard, + self.channel, self.is_real, ); self.v.eval( @@ -185,6 +214,7 @@ impl EdDecompressCols { &self.dyy.result, FieldOperation::Add, self.shard, + self.channel, self.is_real, ); self.u_div_v.eval( @@ -193,6 +223,7 @@ impl EdDecompressCols { &self.v.result, FieldOperation::Div, self.shard, + self.channel, self.is_real, ); self.x.eval( @@ -200,6 +231,7 @@ impl EdDecompressCols { &self.u_div_v.result, AB::F::zero(), self.shard, + self.channel, self.is_real, ); self.neg_x.eval( @@ -208,11 +240,13 @@ impl EdDecompressCols { &self.x.multiplication.result, FieldOperation::Sub, self.shard, + self.channel, self.is_real, ); builder.eval_memory_access_slice( self.shard, + self.channel, self.clk, self.ptr, &self.x_access, @@ -220,6 +254,7 @@ impl EdDecompressCols { ); builder.eval_memory_access_slice( self.shard, + self.channel, self.clk, self.ptr.into() + AB::F::from_canonical_u32(32), &self.y_access, @@ -239,6 +274,7 @@ impl EdDecompressCols { builder.receive_syscall( self.shard, + self.channel, self.clk, AB::F::from_canonical_u32(SyscallCode::ED_DECOMPRESS.syscall_id()), self.ptr, @@ -291,10 +327,12 @@ impl Syscall for EdDecompressChip { let x_memory_records: [MemoryWriteRecord; 8] = x_memory_records_vec.try_into().unwrap(); let shard = rt.current_shard(); + let channel = rt.current_channel(); rt.record_mut() .ed_decompress_events .push(EdDecompressEvent { shard, + channel, clk: start_clk, ptr: slice_ptr, sign: sign_bool, @@ -312,7 +350,7 @@ impl Syscall for EdDecompressChip { } impl EdDecompressChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { _phantom: PhantomData, } @@ -348,7 +386,7 @@ impl MachineAir for EdDecompressChip = row.as_mut_slice().borrow_mut(); let zero = BigUint::zero(); - cols.populate_field_ops::(&mut vec![], 0, &zero); + cols.populate_field_ops::(&mut vec![], 0, 0, &zero); row }); diff --git a/core/src/syscall/precompiles/keccak256/air.rs b/core/src/syscall/precompiles/keccak256/air.rs index ceda18305c..9e67c12490 100644 --- a/core/src/syscall/precompiles/keccak256/air.rs +++ b/core/src/syscall/precompiles/keccak256/air.rs @@ -54,6 +54,7 @@ where builder.eval_memory_access( local.shard, + local.channel, local.clk + final_step, // The clk increments by 1 after a final step local.state_addr + AB::Expr::from_canonical_u32(i * 4), &local.state_mem[i as usize], @@ -65,6 +66,7 @@ where builder.assert_eq(local.receive_ecall, first_step * local.is_real); builder.receive_syscall( local.shard, + local.channel, local.clk, AB::F::from_canonical_u32(SyscallCode::KECCAK_PERMUTE.syscall_id()), local.state_addr, @@ -134,6 +136,7 @@ mod test { use crate::io::{SP1PublicValues, SP1Stdin}; use crate::runtime::Program; use crate::stark::{RiscvAir, StarkGenericConfig}; + use crate::utils::SP1CoreOpts; use crate::utils::{prove, setup_logger, tests::KECCAK256_ELF, BabyBearPoseidon2}; use rand::Rng; @@ -169,7 +172,8 @@ mod test { let config = BabyBearPoseidon2::new(); let program = Program::from(KECCAK256_ELF); - let (proof, public_values) = prove(program, &stdin, config).unwrap(); + let (proof, public_values) = + prove(program, &stdin, config, SP1CoreOpts::default()).unwrap(); let mut public_values = SP1PublicValues::from(&public_values); let config = BabyBearPoseidon2::new(); diff --git a/core/src/syscall/precompiles/keccak256/columns.rs b/core/src/syscall/precompiles/keccak256/columns.rs index 68e4035d18..a3e2dd3044 100644 --- a/core/src/syscall/precompiles/keccak256/columns.rs +++ b/core/src/syscall/precompiles/keccak256/columns.rs @@ -18,6 +18,7 @@ pub(crate) struct KeccakMemCols { pub keccak: KeccakCols, pub shard: T, + pub channel: T, pub clk: T, pub state_addr: T, diff --git a/core/src/syscall/precompiles/keccak256/execute.rs b/core/src/syscall/precompiles/keccak256/execute.rs index bf30c43a9f..d6c306c45f 100644 --- a/core/src/syscall/precompiles/keccak256/execute.rs +++ b/core/src/syscall/precompiles/keccak256/execute.rs @@ -98,10 +98,12 @@ impl Syscall for KeccakPermuteChip { // Push the Keccak permute event. let shard = rt.current_shard(); + let channel = rt.current_channel(); rt.record_mut() .keccak_permute_events .push(KeccakPermuteEvent { shard, + channel, clk: start_clk, pre_state: saved_state.as_slice().try_into().unwrap(), post_state: state.as_slice().try_into().unwrap(), diff --git a/core/src/syscall/precompiles/keccak256/mod.rs b/core/src/syscall/precompiles/keccak256/mod.rs index b44ce53f05..4110707a83 100644 --- a/core/src/syscall/precompiles/keccak256/mod.rs +++ b/core/src/syscall/precompiles/keccak256/mod.rs @@ -16,6 +16,7 @@ const STATE_NUM_WORDS: usize = STATE_SIZE * 2; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct KeccakPermuteEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub pre_state: [u64; STATE_SIZE], pub post_state: [u64; STATE_SIZE], @@ -29,7 +30,7 @@ pub struct KeccakPermuteChip { } impl KeccakPermuteChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { p3_keccak: KeccakAir {}, } @@ -39,7 +40,7 @@ impl KeccakPermuteChip { #[cfg(test)] pub mod permute_tests { use crate::runtime::SyscallCode; - use crate::utils::run_test; + use crate::utils::{run_test, SP1CoreOpts}; use crate::{ runtime::{Instruction, Opcode, Program, Runtime}, utils::{self, tests::KECCAK_PERMUTE_ELF}, @@ -74,7 +75,7 @@ pub mod permute_tests { pub fn test_keccak_permute_program_execute() { utils::setup_logger(); let program = keccak_permute_program(); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); } diff --git a/core/src/syscall/precompiles/keccak256/trace.rs b/core/src/syscall/precompiles/keccak256/trace.rs index bad43967df..01b07fb743 100644 --- a/core/src/syscall/precompiles/keccak256/trace.rs +++ b/core/src/syscall/precompiles/keccak256/trace.rs @@ -56,6 +56,7 @@ impl MachineAir for KeccakPermuteChip { let event = &input.keccak_permute_events[*event_index]; let start_clk = event.clk; let shard = event.shard; + let channel = event.channel; // Create all the rows for the permutation. for i in 0..NUM_ROUNDS { @@ -68,6 +69,7 @@ impl MachineAir for KeccakPermuteChip { let cols: &mut KeccakMemCols = row.as_mut_slice().borrow_mut(); cols.shard = F::from_canonical_u32(shard); + cols.channel = F::from_canonical_u32(channel); cols.clk = F::from_canonical_u32(start_clk); cols.state_addr = F::from_canonical_u32(event.state_addr); cols.is_real = F::one(); @@ -76,8 +78,11 @@ impl MachineAir for KeccakPermuteChip { if i == 0 { for (j, read_record) in event.state_read_records.iter().enumerate() { - cols.state_mem[j] - .populate_read(*read_record, &mut new_byte_lookup_events); + cols.state_mem[j].populate_read( + channel, + *read_record, + &mut new_byte_lookup_events, + ); } cols.do_memory_check = F::one(); @@ -89,8 +94,11 @@ impl MachineAir for KeccakPermuteChip { for (j, write_record) in event.state_write_records.iter().enumerate() { - cols.state_mem[j] - .populate_write(*write_record, &mut new_byte_lookup_events); + cols.state_mem[j].populate_write( + channel, + *write_record, + &mut new_byte_lookup_events, + ); } cols.do_memory_check = F::one(); diff --git a/core/src/syscall/precompiles/mod.rs b/core/src/syscall/precompiles/mod.rs index f33626e7b1..7b107e2d5b 100644 --- a/core/src/syscall/precompiles/mod.rs +++ b/core/src/syscall/precompiles/mod.rs @@ -21,6 +21,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ECAddEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub p_ptr: u32, pub p: Vec, @@ -68,6 +69,7 @@ pub fn create_ec_add_event( ECAddEvent { shard: rt.current_shard(), + channel: rt.current_channel(), clk: start_clk, p_ptr, p, @@ -82,6 +84,7 @@ pub fn create_ec_add_event( #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ECDoubleEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub p_ptr: u32, pub p: Vec, @@ -117,6 +120,7 @@ pub fn create_ec_double_event( ECDoubleEvent { shard: rt.current_shard(), + channel: rt.current_channel(), clk: start_clk, p_ptr, p, @@ -128,6 +132,7 @@ pub fn create_ec_double_event( #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ECDecompressEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub ptr: u32, pub is_odd: bool, @@ -172,6 +177,7 @@ pub fn create_ec_decompress_event( ECDecompressEvent { shard: rt.current_shard(), + channel: rt.current_channel(), clk: start_clk, ptr: slice_ptr, is_odd: is_odd != 0, diff --git a/core/src/syscall/precompiles/sha256/compress/air.rs b/core/src/syscall/precompiles/sha256/compress/air.rs index 031b08a308..2f4bd5000a 100644 --- a/core/src/syscall/precompiles/sha256/compress/air.rs +++ b/core/src/syscall/precompiles/sha256/compress/air.rs @@ -44,6 +44,7 @@ where ); builder.receive_syscall( local.shard, + local.channel, local.clk, AB::F::from_canonical_u32(SyscallCode::SHA_COMPRESS.syscall_id()), local.w_ptr, @@ -203,6 +204,7 @@ impl ShaCompressChip { let is_finalize = local.octet_num[9]; builder.eval_memory_access( local.shard, + local.channel, local.clk + is_finalize, local.mem_addr, &local.mem, @@ -292,6 +294,7 @@ impl ShaCompressChip { 6, local.e_rr_6, local.shard, + local.channel, local.is_compression, ); // Calculate e rightrotate 11. @@ -301,6 +304,7 @@ impl ShaCompressChip { 11, local.e_rr_11, local.shard, + local.channel, local.is_compression, ); // Calculate e rightrotate 25. @@ -310,6 +314,7 @@ impl ShaCompressChip { 25, local.e_rr_25, local.shard, + local.channel, local.is_compression, ); // Calculate (e rightrotate 6) xor (e rightrotate 11). @@ -319,6 +324,7 @@ impl ShaCompressChip { local.e_rr_11.value, local.s1_intermediate, local.shard, + local.channel, local.is_compression, ); // Calculate S1 := ((e rightrotate 6) xor (e rightrotate 11)) xor (e rightrotate 25). @@ -328,6 +334,7 @@ impl ShaCompressChip { local.e_rr_25.value, local.s1, local.shard, + local.channel, local.is_compression, ); @@ -339,6 +346,7 @@ impl ShaCompressChip { local.f, local.e_and_f, local.shard, + local.channel, local.is_compression, ); // Calculate not e. @@ -347,6 +355,7 @@ impl ShaCompressChip { local.e, local.e_not, local.shard, + local.channel, local.is_compression, ); // Calculate (not e) and g. @@ -356,6 +365,7 @@ impl ShaCompressChip { local.g, local.e_not_and_g, local.shard, + local.channel, local.is_compression, ); // Calculate ch := (e and f) xor ((not e) and g). @@ -365,6 +375,7 @@ impl ShaCompressChip { local.e_not_and_g.value, local.ch, local.shard, + local.channel, local.is_compression, ); @@ -379,6 +390,7 @@ impl ShaCompressChip { local.mem.access.value, ], local.shard, + local.channel, local.is_compression, local.temp1, ); @@ -391,6 +403,7 @@ impl ShaCompressChip { 2, local.a_rr_2, local.shard, + local.channel, local.is_compression, ); // Calculate a rightrotate 13. @@ -400,6 +413,7 @@ impl ShaCompressChip { 13, local.a_rr_13, local.shard, + local.channel, local.is_compression, ); // Calculate a rightrotate 22. @@ -409,6 +423,7 @@ impl ShaCompressChip { 22, local.a_rr_22, local.shard, + local.channel, local.is_compression, ); // Calculate (a rightrotate 2) xor (a rightrotate 13). @@ -418,6 +433,7 @@ impl ShaCompressChip { local.a_rr_13.value, local.s0_intermediate, local.shard, + local.channel, local.is_compression, ); // Calculate S0 := ((a rightrotate 2) xor (a rightrotate 13)) xor (a rightrotate 22). @@ -427,6 +443,7 @@ impl ShaCompressChip { local.a_rr_22.value, local.s0, local.shard, + local.channel, local.is_compression, ); @@ -438,6 +455,7 @@ impl ShaCompressChip { local.b, local.a_and_b, local.shard, + local.channel, local.is_compression, ); // Calculate a and c. @@ -447,6 +465,7 @@ impl ShaCompressChip { local.c, local.a_and_c, local.shard, + local.channel, local.is_compression, ); // Calculate b and c. @@ -456,6 +475,7 @@ impl ShaCompressChip { local.c, local.b_and_c, local.shard, + local.channel, local.is_compression, ); // Calculate (a and b) xor (a and c). @@ -465,6 +485,7 @@ impl ShaCompressChip { local.a_and_c.value, local.maj_intermediate, local.shard, + local.channel, local.is_compression, ); // Calculate maj := ((a and b) xor (a and c)) xor (b and c). @@ -474,6 +495,7 @@ impl ShaCompressChip { local.b_and_c.value, local.maj, local.shard, + local.channel, local.is_compression, ); @@ -484,6 +506,7 @@ impl ShaCompressChip { local.maj.value, local.temp2, local.shard, + local.channel, local.is_compression.into(), ); @@ -494,6 +517,7 @@ impl ShaCompressChip { local.temp1.value, local.d_add_temp1, local.shard, + local.channel, local.is_compression.into(), ); @@ -504,6 +528,7 @@ impl ShaCompressChip { local.temp2.value, local.temp1_add_temp2, local.shard, + local.channel, local.is_compression.into(), ); @@ -581,6 +606,7 @@ impl ShaCompressChip { local.finalized_operand, local.finalize_add, local.shard, + local.channel, is_finalize.into(), ); diff --git a/core/src/syscall/precompiles/sha256/compress/columns.rs b/core/src/syscall/precompiles/sha256/compress/columns.rs index cf990e0385..94a200aedd 100644 --- a/core/src/syscall/precompiles/sha256/compress/columns.rs +++ b/core/src/syscall/precompiles/sha256/compress/columns.rs @@ -25,6 +25,7 @@ pub const NUM_SHA_COMPRESS_COLS: usize = size_of::>(); pub struct ShaCompressCols { /// Inputs. pub shard: T, + pub channel: T, pub clk: T, pub w_ptr: T, pub h_ptr: T, diff --git a/core/src/syscall/precompiles/sha256/compress/execute.rs b/core/src/syscall/precompiles/sha256/compress/execute.rs index 72ee312a5e..a019abbd4c 100644 --- a/core/src/syscall/precompiles/sha256/compress/execute.rs +++ b/core/src/syscall/precompiles/sha256/compress/execute.rs @@ -77,8 +77,10 @@ impl Syscall for ShaCompressChip { // Push the SHA extend event. let shard = rt.current_shard(); + let channel = rt.current_channel(); rt.record_mut().sha_compress_events.push(ShaCompressEvent { shard, + channel, clk: start_clk, w_ptr, h_ptr, diff --git a/core/src/syscall/precompiles/sha256/compress/mod.rs b/core/src/syscall/precompiles/sha256/compress/mod.rs index e95669cee4..fd6c50f0fc 100644 --- a/core/src/syscall/precompiles/sha256/compress/mod.rs +++ b/core/src/syscall/precompiles/sha256/compress/mod.rs @@ -21,6 +21,7 @@ pub const SHA_COMPRESS_K: [u32; 64] = [ #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ShaCompressEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub w_ptr: u32, pub h_ptr: u32, @@ -42,7 +43,7 @@ pub struct ShaCompressEvent { pub struct ShaCompressChip; impl ShaCompressChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } diff --git a/core/src/syscall/precompiles/sha256/compress/trace.rs b/core/src/syscall/precompiles/sha256/compress/trace.rs index 9f877fd874..bd0b8f8177 100644 --- a/core/src/syscall/precompiles/sha256/compress/trace.rs +++ b/core/src/syscall/precompiles/sha256/compress/trace.rs @@ -34,6 +34,7 @@ impl MachineAir for ShaCompressChip { for i in 0..input.sha_compress_events.len() { let mut event = input.sha_compress_events[i].clone(); let shard = event.shard; + let channel = event.channel; let og_h = event.h; @@ -45,6 +46,7 @@ impl MachineAir for ShaCompressChip { let cols: &mut ShaCompressCols = row.as_mut_slice().borrow_mut(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.w_ptr = F::from_canonical_u32(event.w_ptr); cols.h_ptr = F::from_canonical_u32(event.h_ptr); @@ -52,8 +54,11 @@ impl MachineAir for ShaCompressChip { cols.octet[j] = F::one(); cols.octet_num[octet_num_idx] = F::one(); - cols.mem - .populate_read(event.h_read_records[j], &mut new_byte_lookup_events); + cols.mem.populate_read( + channel, + event.h_read_records[j], + &mut new_byte_lookup_events, + ); cols.mem_addr = F::from_canonical_u32(event.h_ptr + (j * 4) as u32); cols.a = Word::from(event.h_read_records[0].value); @@ -84,11 +89,15 @@ impl MachineAir for ShaCompressChip { cols.octet_num[octet_num_idx] = F::one(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.w_ptr = F::from_canonical_u32(event.w_ptr); cols.h_ptr = F::from_canonical_u32(event.h_ptr); - cols.mem - .populate_read(event.w_i_read_records[j], &mut new_byte_lookup_events); + cols.mem.populate_read( + channel, + event.w_i_read_records[j], + &mut new_byte_lookup_events, + ); cols.mem_addr = F::from_canonical_u32(event.w_ptr + (j * 4) as u32); let a = event.h[0]; @@ -108,43 +117,60 @@ impl MachineAir for ShaCompressChip { cols.g = Word::from(g); cols.h = Word::from(h); - let e_rr_6 = cols.e_rr_6.populate(output, shard, e, 6); - let e_rr_11 = cols.e_rr_11.populate(output, shard, e, 11); - let e_rr_25 = cols.e_rr_25.populate(output, shard, e, 25); + let e_rr_6 = cols.e_rr_6.populate(output, shard, channel, e, 6); + let e_rr_11 = cols.e_rr_11.populate(output, shard, channel, e, 11); + let e_rr_25 = cols.e_rr_25.populate(output, shard, channel, e, 25); let s1_intermediate = cols .s1_intermediate - .populate(output, shard, e_rr_6, e_rr_11); - let s1 = cols.s1.populate(output, shard, s1_intermediate, e_rr_25); - - let e_and_f = cols.e_and_f.populate(output, shard, e, f); - let e_not = cols.e_not.populate(output, shard, e); - let e_not_and_g = cols.e_not_and_g.populate(output, shard, e_not, g); - let ch = cols.ch.populate(output, shard, e_and_f, e_not_and_g); - - let temp1 = - cols.temp1 - .populate(output, shard, h, s1, ch, event.w[j], SHA_COMPRESS_K[j]); - - let a_rr_2 = cols.a_rr_2.populate(output, shard, a, 2); - let a_rr_13 = cols.a_rr_13.populate(output, shard, a, 13); - let a_rr_22 = cols.a_rr_22.populate(output, shard, a, 22); + .populate(output, shard, channel, e_rr_6, e_rr_11); + let s1 = cols + .s1 + .populate(output, shard, channel, s1_intermediate, e_rr_25); + + let e_and_f = cols.e_and_f.populate(output, shard, channel, e, f); + let e_not = cols.e_not.populate(output, shard, channel, e); + let e_not_and_g = cols.e_not_and_g.populate(output, shard, channel, e_not, g); + let ch = cols + .ch + .populate(output, shard, channel, e_and_f, e_not_and_g); + + let temp1 = cols.temp1.populate( + output, + shard, + channel, + h, + s1, + ch, + event.w[j], + SHA_COMPRESS_K[j], + ); + + let a_rr_2 = cols.a_rr_2.populate(output, shard, channel, a, 2); + let a_rr_13 = cols.a_rr_13.populate(output, shard, channel, a, 13); + let a_rr_22 = cols.a_rr_22.populate(output, shard, channel, a, 22); let s0_intermediate = cols .s0_intermediate - .populate(output, shard, a_rr_2, a_rr_13); - let s0 = cols.s0.populate(output, shard, s0_intermediate, a_rr_22); - - let a_and_b = cols.a_and_b.populate(output, shard, a, b); - let a_and_c = cols.a_and_c.populate(output, shard, a, c); - let b_and_c = cols.b_and_c.populate(output, shard, b, c); + .populate(output, shard, channel, a_rr_2, a_rr_13); + let s0 = cols + .s0 + .populate(output, shard, channel, s0_intermediate, a_rr_22); + + let a_and_b = cols.a_and_b.populate(output, shard, channel, a, b); + let a_and_c = cols.a_and_c.populate(output, shard, channel, a, c); + let b_and_c = cols.b_and_c.populate(output, shard, channel, b, c); let maj_intermediate = cols .maj_intermediate - .populate(output, shard, a_and_b, a_and_c); - let maj = cols.maj.populate(output, shard, maj_intermediate, b_and_c); + .populate(output, shard, channel, a_and_b, a_and_c); + let maj = cols + .maj + .populate(output, shard, channel, maj_intermediate, b_and_c); - let temp2 = cols.temp2.populate(output, shard, s0, maj); + let temp2 = cols.temp2.populate(output, shard, channel, s0, maj); - let d_add_temp1 = cols.d_add_temp1.populate(output, shard, d, temp1); - let temp1_add_temp2 = cols.temp1_add_temp2.populate(output, shard, temp1, temp2); + let d_add_temp1 = cols.d_add_temp1.populate(output, shard, channel, d, temp1); + let temp1_add_temp2 = cols + .temp1_add_temp2 + .populate(output, shard, channel, temp1, temp2); event.h[7] = g; event.h[6] = f; @@ -174,6 +200,7 @@ impl MachineAir for ShaCompressChip { let cols: &mut ShaCompressCols = row.as_mut_slice().borrow_mut(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.w_ptr = F::from_canonical_u32(event.w_ptr); cols.h_ptr = F::from_canonical_u32(event.h_ptr); @@ -182,9 +209,12 @@ impl MachineAir for ShaCompressChip { cols.octet_num[octet_num_idx] = F::one(); cols.finalize_add - .populate(output, shard, og_h[j], event.h[j]); - cols.mem - .populate_write(event.h_write_records[j], &mut new_byte_lookup_events); + .populate(output, shard, channel, og_h[j], event.h[j]); + cols.mem.populate_write( + channel, + event.h_write_records[j], + &mut new_byte_lookup_events, + ); cols.mem_addr = F::from_canonical_u32(event.h_ptr + (j * 4) as u32); v[j] = event.h[j]; diff --git a/core/src/syscall/precompiles/sha256/extend/air.rs b/core/src/syscall/precompiles/sha256/extend/air.rs index 6058afd3d3..9da6048048 100644 --- a/core/src/syscall/precompiles/sha256/extend/air.rs +++ b/core/src/syscall/precompiles/sha256/extend/air.rs @@ -50,6 +50,7 @@ where // Read w[i-15]. builder.eval_memory_access( local.shard, + local.channel, local.clk + (local.i - i_start), local.w_ptr + (local.i - AB::F::from_canonical_u32(15)) * nb_bytes_in_word, &local.w_i_minus_15, @@ -59,6 +60,7 @@ where // Read w[i-2]. builder.eval_memory_access( local.shard, + local.channel, local.clk + (local.i - i_start), local.w_ptr + (local.i - AB::F::from_canonical_u32(2)) * nb_bytes_in_word, &local.w_i_minus_2, @@ -68,6 +70,7 @@ where // Read w[i-16]. builder.eval_memory_access( local.shard, + local.channel, local.clk + (local.i - i_start), local.w_ptr + (local.i - AB::F::from_canonical_u32(16)) * nb_bytes_in_word, &local.w_i_minus_16, @@ -77,6 +80,7 @@ where // Read w[i-7]. builder.eval_memory_access( local.shard, + local.channel, local.clk + (local.i - i_start), local.w_ptr + (local.i - AB::F::from_canonical_u32(7)) * nb_bytes_in_word, &local.w_i_minus_7, @@ -91,6 +95,7 @@ where 7, local.w_i_minus_15_rr_7, local.shard, + local.channel, local.is_real, ); // w[i-15] rightrotate 18. @@ -100,6 +105,7 @@ where 18, local.w_i_minus_15_rr_18, local.shard, + local.channel, local.is_real, ); // w[i-15] rightshift 3. @@ -109,6 +115,7 @@ where 3, local.w_i_minus_15_rs_3, local.shard, + local.channel, local.is_real, ); // (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) @@ -118,6 +125,7 @@ where local.w_i_minus_15_rr_18.value, local.s0_intermediate, local.shard, + local.channel, local.is_real, ); // s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3) @@ -127,6 +135,7 @@ where local.w_i_minus_15_rs_3.value, local.s0, local.shard, + local.channel, local.is_real, ); @@ -138,6 +147,7 @@ where 17, local.w_i_minus_2_rr_17, local.shard, + local.channel, local.is_real, ); // w[i-2] rightrotate 19. @@ -147,6 +157,7 @@ where 19, local.w_i_minus_2_rr_19, local.shard, + local.channel, local.is_real, ); // w[i-2] rightshift 10. @@ -156,6 +167,7 @@ where 10, local.w_i_minus_2_rs_10, local.shard, + local.channel, local.is_real, ); // (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) @@ -165,6 +177,7 @@ where local.w_i_minus_2_rr_19.value, local.s1_intermediate, local.shard, + local.channel, local.is_real, ); // s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10) @@ -174,6 +187,7 @@ where local.w_i_minus_2_rs_10.value, local.s1, local.shard, + local.channel, local.is_real, ); @@ -185,6 +199,7 @@ where *local.w_i_minus_7.value(), local.s1.value, local.shard, + local.channel, local.is_real, local.s2, ); @@ -192,6 +207,7 @@ where // Write `s2` to `w[i]`. builder.eval_memory_access( local.shard, + local.channel, local.clk + (local.i - i_start), local.w_ptr + local.i * nb_bytes_in_word, &local.w_i, @@ -201,6 +217,7 @@ where // Receive syscall event in first row of 48-cycle. builder.receive_syscall( local.shard, + local.channel, local.clk, AB::F::from_canonical_u32(SyscallCode::SHA_EXTEND.syscall_id()), local.w_ptr, diff --git a/core/src/syscall/precompiles/sha256/extend/columns.rs b/core/src/syscall/precompiles/sha256/extend/columns.rs index a4197ce7f5..5eb99e1f4d 100644 --- a/core/src/syscall/precompiles/sha256/extend/columns.rs +++ b/core/src/syscall/precompiles/sha256/extend/columns.rs @@ -17,6 +17,7 @@ pub const NUM_SHA_EXTEND_COLS: usize = size_of::>(); pub struct ShaExtendCols { /// Inputs. pub shard: T, + pub channel: T, pub clk: T, pub w_ptr: T, diff --git a/core/src/syscall/precompiles/sha256/extend/execute.rs b/core/src/syscall/precompiles/sha256/extend/execute.rs index 467029bd9d..bd163c26c9 100644 --- a/core/src/syscall/precompiles/sha256/extend/execute.rs +++ b/core/src/syscall/precompiles/sha256/extend/execute.rs @@ -61,8 +61,10 @@ impl Syscall for ShaExtendChip { // Push the SHA extend event. let shard = rt.current_shard(); + let channel = rt.current_channel(); rt.record_mut().sha_extend_events.push(ShaExtendEvent { shard, + channel, clk: clk_init, w_ptr: w_ptr_init, w_i_minus_15_reads, diff --git a/core/src/syscall/precompiles/sha256/extend/mod.rs b/core/src/syscall/precompiles/sha256/extend/mod.rs index 529e7c2687..4caff508b9 100644 --- a/core/src/syscall/precompiles/sha256/extend/mod.rs +++ b/core/src/syscall/precompiles/sha256/extend/mod.rs @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ShaExtendEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub w_ptr: u32, pub w_i_minus_15_reads: Vec, @@ -30,7 +31,7 @@ pub struct ShaExtendEvent { pub struct ShaExtendChip; impl ShaExtendChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } @@ -90,7 +91,7 @@ pub mod extend_tests { #[test] fn generate_trace() { let mut shard = ExecutionRecord::default(); - shard.add_events = vec![AluEvent::new(0, 0, Opcode::ADD, 14, 8, 6)]; + shard.add_events = vec![AluEvent::new(0, 0, 0, Opcode::ADD, 14, 8, 6)]; let chip = ShaExtendChip::new(); let trace: RowMajorMatrix = chip.generate_trace(&shard, &mut ExecutionRecord::default()); diff --git a/core/src/syscall/precompiles/sha256/extend/trace.rs b/core/src/syscall/precompiles/sha256/extend/trace.rs index 819b0d6146..2a976ef0d6 100644 --- a/core/src/syscall/precompiles/sha256/extend/trace.rs +++ b/core/src/syscall/precompiles/sha256/extend/trace.rs @@ -37,68 +37,105 @@ impl MachineAir for ShaExtendChip { cols.is_real = F::one(); cols.populate_flags(j); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.w_ptr = F::from_canonical_u32(event.w_ptr); - cols.w_i_minus_15 - .populate(event.w_i_minus_15_reads[j], &mut new_byte_lookup_events); - cols.w_i_minus_2 - .populate(event.w_i_minus_2_reads[j], &mut new_byte_lookup_events); - cols.w_i_minus_16 - .populate(event.w_i_minus_16_reads[j], &mut new_byte_lookup_events); - cols.w_i_minus_7 - .populate(event.w_i_minus_7_reads[j], &mut new_byte_lookup_events); + cols.w_i_minus_15.populate( + event.channel, + event.w_i_minus_15_reads[j], + &mut new_byte_lookup_events, + ); + cols.w_i_minus_2.populate( + event.channel, + event.w_i_minus_2_reads[j], + &mut new_byte_lookup_events, + ); + cols.w_i_minus_16.populate( + event.channel, + event.w_i_minus_16_reads[j], + &mut new_byte_lookup_events, + ); + cols.w_i_minus_7.populate( + event.channel, + event.w_i_minus_7_reads[j], + &mut new_byte_lookup_events, + ); // `s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3)`. let w_i_minus_15 = event.w_i_minus_15_reads[j].value; let w_i_minus_15_rr_7 = cols.w_i_minus_15_rr_7 - .populate(output, shard, w_i_minus_15, 7); - let w_i_minus_15_rr_18 = - cols.w_i_minus_15_rr_18 - .populate(output, shard, w_i_minus_15, 18); + .populate(output, shard, event.channel, w_i_minus_15, 7); + let w_i_minus_15_rr_18 = cols.w_i_minus_15_rr_18.populate( + output, + shard, + event.channel, + w_i_minus_15, + 18, + ); let w_i_minus_15_rs_3 = cols.w_i_minus_15_rs_3 - .populate(output, shard, w_i_minus_15, 3); + .populate(output, shard, event.channel, w_i_minus_15, 3); let s0_intermediate = cols.s0_intermediate.populate( output, shard, + event.channel, w_i_minus_15_rr_7, w_i_minus_15_rr_18, ); - let s0 = cols - .s0 - .populate(output, shard, s0_intermediate, w_i_minus_15_rs_3); + let s0 = cols.s0.populate( + output, + shard, + event.channel, + s0_intermediate, + w_i_minus_15_rs_3, + ); // `s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10)`. let w_i_minus_2 = event.w_i_minus_2_reads[j].value; let w_i_minus_2_rr_17 = cols.w_i_minus_2_rr_17 - .populate(output, shard, w_i_minus_2, 17); + .populate(output, shard, event.channel, w_i_minus_2, 17); let w_i_minus_2_rr_19 = cols.w_i_minus_2_rr_19 - .populate(output, shard, w_i_minus_2, 19); + .populate(output, shard, event.channel, w_i_minus_2, 19); let w_i_minus_2_rs_10 = cols.w_i_minus_2_rs_10 - .populate(output, shard, w_i_minus_2, 10); + .populate(output, shard, event.channel, w_i_minus_2, 10); let s1_intermediate = cols.s1_intermediate.populate( output, shard, + event.channel, w_i_minus_2_rr_17, w_i_minus_2_rr_19, ); - let s1 = cols - .s1 - .populate(output, shard, s1_intermediate, w_i_minus_2_rs_10); + let s1 = cols.s1.populate( + output, + shard, + event.channel, + s1_intermediate, + w_i_minus_2_rs_10, + ); // Compute `s2`. let w_i_minus_7 = event.w_i_minus_7_reads[j].value; let w_i_minus_16 = event.w_i_minus_16_reads[j].value; - cols.s2 - .populate(output, shard, w_i_minus_16, s0, w_i_minus_7, s1); + cols.s2.populate( + output, + shard, + event.channel, + w_i_minus_16, + s0, + w_i_minus_7, + s1, + ); - cols.w_i - .populate(event.w_i_writes[j], &mut new_byte_lookup_events); + cols.w_i.populate( + event.channel, + event.w_i_writes[j], + &mut new_byte_lookup_events, + ); rows.push(row); } diff --git a/core/src/syscall/precompiles/uint256/air.rs b/core/src/syscall/precompiles/uint256/air.rs index aa422afc7e..498ac78c6c 100644 --- a/core/src/syscall/precompiles/uint256/air.rs +++ b/core/src/syscall/precompiles/uint256/air.rs @@ -34,6 +34,7 @@ const NUM_COLS: usize = size_of::>(); #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Uint256MulEvent { pub shard: u32, + pub channel: u32, pub clk: u32, pub x_ptr: u32, pub x: Vec, @@ -49,7 +50,7 @@ pub struct Uint256MulEvent { pub struct Uint256MulChip; impl Uint256MulChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } @@ -64,6 +65,9 @@ pub struct Uint256MulCols { /// The shard number of the syscall. pub shard: T, + /// The byte lookup channel. + pub channel: T, + /// The clock cycle of the syscall. pub clk: T, @@ -124,17 +128,25 @@ impl MachineAir for Uint256MulChip { // Assign basic values to the columns. cols.is_real = F::one(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.x_ptr = F::from_canonical_u32(event.x_ptr); cols.y_ptr = F::from_canonical_u32(event.y_ptr); // Populate memory columns. for i in 0..WORDS_FIELD_ELEMENT { - cols.x_memory[i] - .populate(event.x_memory_records[i], &mut new_byte_lookup_events); - cols.y_memory[i] - .populate(event.y_memory_records[i], &mut new_byte_lookup_events); + cols.x_memory[i].populate( + event.channel, + event.x_memory_records[i], + &mut new_byte_lookup_events, + ); + cols.y_memory[i].populate( + event.channel, + event.y_memory_records[i], + &mut new_byte_lookup_events, + ); cols.modulus_memory[i].populate( + event.channel, event.modulus_memory_records[i], &mut new_byte_lookup_events, ); @@ -153,6 +165,7 @@ impl MachineAir for Uint256MulChip { cols.output.populate_with_modulus( &mut new_byte_lookup_events, event.shard, + event.channel, &x, &y, &effective_modulus, @@ -182,7 +195,7 @@ impl MachineAir for Uint256MulChip { let x = BigUint::zero(); let y = BigUint::zero(); cols.output - .populate(&mut vec![], 0, &x, &y, FieldOperation::Mul); + .populate(&mut vec![], 0, 0, &x, &y, FieldOperation::Mul); row }); @@ -245,9 +258,11 @@ impl Syscall for Uint256MulChip { let x_memory_records = rt.mw_slice(x_ptr, &result); let shard = rt.current_shard(); + let channel = rt.current_channel(); let clk = rt.clk; rt.record_mut().uint256_mul_events.push(Uint256MulEvent { shard, + channel, clk, x_ptr, x, @@ -316,9 +331,9 @@ where &x_limbs, &y_limbs, &p_modulus, - // &modulus_limbs, FieldOperation::Mul, local.shard, + local.channel, local.is_real, ); @@ -330,6 +345,7 @@ where // Read and write x. builder.eval_memory_access_slice( local.shard, + local.channel, local.clk.into(), local.x_ptr, &local.x_memory, @@ -340,6 +356,7 @@ where // we read it contiguously from the y_ptr memory location. builder.eval_memory_access_slice( local.shard, + local.channel, local.clk.into(), local.y_ptr, &[local.y_memory, local.modulus_memory].concat(), @@ -349,6 +366,7 @@ where // Receive the arguments. builder.receive_syscall( local.shard, + local.channel, local.clk, AB::F::from_canonical_u32(SyscallCode::UINT256_MUL.syscall_id()), local.x_ptr, diff --git a/core/src/syscall/precompiles/weierstrass/weierstrass_add.rs b/core/src/syscall/precompiles/weierstrass/weierstrass_add.rs index f2282632b8..ac049a5be4 100644 --- a/core/src/syscall/precompiles/weierstrass/weierstrass_add.rs +++ b/core/src/syscall/precompiles/weierstrass/weierstrass_add.rs @@ -52,6 +52,7 @@ pub const fn num_weierstrass_add_cols() -> usize pub struct WeierstrassAddAssignCols { pub is_real: T, pub shard: T, + pub channel: T, pub clk: T, pub p_ptr: T, pub q_ptr: T, @@ -91,15 +92,17 @@ impl Syscall for WeierstrassAddAssignChip { } impl WeierstrassAddAssignChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { _marker: PhantomData, } } + #[allow(clippy::too_many_arguments)] fn populate_field_ops( blu_events: &mut Vec, shard: u32, + channel: u32, cols: &mut WeierstrassAddAssignCols, p_x: BigUint, p_y: BigUint, @@ -111,17 +114,28 @@ impl WeierstrassAddAssignChip { // slope = (q.y - p.y) / (q.x - p.x). let slope = { - let slope_numerator = - cols.slope_numerator - .populate(blu_events, shard, &q_y, &p_y, FieldOperation::Sub); + let slope_numerator = cols.slope_numerator.populate( + blu_events, + shard, + channel, + &q_y, + &p_y, + FieldOperation::Sub, + ); - let slope_denominator = - cols.slope_denominator - .populate(blu_events, shard, &q_x, &p_x, FieldOperation::Sub); + let slope_denominator = cols.slope_denominator.populate( + blu_events, + shard, + channel, + &q_x, + &p_x, + FieldOperation::Sub, + ); cols.slope.populate( blu_events, shard, + channel, &slope_numerator, &slope_denominator, FieldOperation::Div, @@ -130,15 +144,26 @@ impl WeierstrassAddAssignChip { // x = slope * slope - (p.x + q.x). let x = { - let slope_squared = - cols.slope_squared - .populate(blu_events, shard, &slope, &slope, FieldOperation::Mul); - let p_x_plus_q_x = - cols.p_x_plus_q_x - .populate(blu_events, shard, &p_x, &q_x, FieldOperation::Add); + let slope_squared = cols.slope_squared.populate( + blu_events, + shard, + channel, + &slope, + &slope, + FieldOperation::Mul, + ); + let p_x_plus_q_x = cols.p_x_plus_q_x.populate( + blu_events, + shard, + channel, + &p_x, + &q_x, + FieldOperation::Add, + ); cols.x3_ins.populate( blu_events, shard, + channel, &slope_squared, &p_x_plus_q_x, FieldOperation::Sub, @@ -147,12 +172,18 @@ impl WeierstrassAddAssignChip { // y = slope * (p.x - x_3n) - p.y. { - let p_x_minus_x = - cols.p_x_minus_x - .populate(blu_events, shard, &p_x, &x, FieldOperation::Sub); + let p_x_minus_x = cols.p_x_minus_x.populate( + blu_events, + shard, + channel, + &p_x, + &x, + FieldOperation::Sub, + ); let slope_times_p_x_minus_x = cols.slope_times_p_x_minus_x.populate( blu_events, shard, + channel, &slope, &p_x_minus_x, FieldOperation::Mul, @@ -160,6 +191,7 @@ impl WeierstrassAddAssignChip { cols.y3_ins.populate( blu_events, shard, + channel, &slope_times_p_x_minus_x, &p_y, FieldOperation::Sub, @@ -218,6 +250,7 @@ where // Populate basic columns. cols.is_real = F::one(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.p_ptr = F::from_canonical_u32(event.p_ptr); cols.q_ptr = F::from_canonical_u32(event.q_ptr); @@ -225,6 +258,7 @@ where Self::populate_field_ops( &mut new_byte_lookup_events, event.shard, + event.channel, cols, p_x, p_y, @@ -234,10 +268,18 @@ where // Populate the memory access columns. for i in 0..cols.q_access.len() { - cols.q_access[i].populate(event.q_memory_records[i], &mut new_byte_lookup_events); + cols.q_access[i].populate( + event.channel, + event.q_memory_records[i], + &mut new_byte_lookup_events, + ); } for i in 0..cols.p_access.len() { - cols.p_access[i].populate(event.p_memory_records[i], &mut new_byte_lookup_events); + cols.p_access[i].populate( + event.channel, + event.p_memory_records[i], + &mut new_byte_lookup_events, + ); } rows.push(row); @@ -252,6 +294,7 @@ where Self::populate_field_ops( &mut vec![], 0, + 0, cols, zero.clone(), zero.clone(), @@ -310,6 +353,7 @@ where &p_y, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); @@ -319,6 +363,7 @@ where &p_x, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); @@ -328,6 +373,7 @@ where &row.slope_denominator.result, FieldOperation::Div, row.shard, + row.channel, row.is_real, ); @@ -342,6 +388,7 @@ where slope, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -351,6 +398,7 @@ where &q_x, FieldOperation::Add, row.shard, + row.channel, row.is_real, ); @@ -360,6 +408,7 @@ where &row.p_x_plus_q_x.result, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); @@ -374,6 +423,7 @@ where x, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); @@ -383,6 +433,7 @@ where &row.p_x_minus_x.result, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -392,6 +443,7 @@ where &p_y, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); } @@ -410,6 +462,7 @@ where builder.eval_memory_access_slice( row.shard, + row.channel, row.clk.into(), row.q_ptr, &row.q_access, @@ -417,6 +470,7 @@ where ); builder.eval_memory_access_slice( row.shard, + row.channel, row.clk + AB::F::from_canonical_u32(1), // We read p at +1 since p, q could be the same. row.p_ptr, &row.p_access, @@ -437,6 +491,7 @@ where builder.receive_syscall( row.shard, + row.channel, row.clk, syscall_id_felt, row.p_ptr, diff --git a/core/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs b/core/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs index 04e3e125dd..ef610267f6 100644 --- a/core/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs +++ b/core/src/syscall/precompiles/weierstrass/weierstrass_decompress.rs @@ -53,6 +53,7 @@ pub const fn num_weierstrass_decompress_cols() -> pub struct WeierstrassDecompressCols { pub is_real: T, pub shard: T, + pub channel: T, pub clk: T, pub ptr: T, pub is_odd: T, @@ -88,7 +89,7 @@ impl Syscall for WeierstrassDecompressChip { } impl WeierstrassDecompressChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { _marker: PhantomData::, } @@ -97,32 +98,40 @@ impl WeierstrassDecompressChip { fn populate_field_ops( record: &mut impl ByteRecord, shard: u32, + channel: u32, cols: &mut WeierstrassDecompressCols, x: BigUint, ) { // Y = sqrt(x^3 + b) - cols.range_x.populate(record, shard, &x); - let x_2 = cols - .x_2 - .populate(record, shard, &x.clone(), &x.clone(), FieldOperation::Mul); + cols.range_x.populate(record, shard, channel, &x); + let x_2 = cols.x_2.populate( + record, + shard, + channel, + &x.clone(), + &x.clone(), + FieldOperation::Mul, + ); let x_3 = cols .x_3 - .populate(record, shard, &x_2, &x, FieldOperation::Mul); + .populate(record, shard, channel, &x_2, &x, FieldOperation::Mul); let b = E::b_int(); - let x_3_plus_b = cols - .x_3_plus_b - .populate(record, shard, &x_3, &b, FieldOperation::Add); + let x_3_plus_b = + cols.x_3_plus_b + .populate(record, shard, channel, &x_3, &b, FieldOperation::Add); let sqrt_fn = match E::CURVE_TYPE { CurveType::Secp256k1 => secp256k1_sqrt, CurveType::Bls12381 => bls12381_sqrt, _ => panic!("Unsupported curve"), }; - let y = cols.y.populate(record, shard, &x_3_plus_b, sqrt_fn); + let y = cols + .y + .populate(record, shard, channel, &x_3_plus_b, sqrt_fn); let zero = BigUint::zero(); cols.neg_y - .populate(record, shard, &zero, &y, FieldOperation::Sub); + .populate(record, shard, channel, &zero, &y, FieldOperation::Sub); } } @@ -165,19 +174,34 @@ where cols.is_real = F::from_bool(true); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.ptr = F::from_canonical_u32(event.ptr); cols.is_odd = F::from_canonical_u32(event.is_odd as u32); let x = BigUint::from_bytes_le(&event.x_bytes); - Self::populate_field_ops(&mut new_byte_lookup_events, event.shard, cols, x); + Self::populate_field_ops( + &mut new_byte_lookup_events, + event.shard, + event.channel, + cols, + x, + ); for i in 0..cols.x_access.len() { - cols.x_access[i].populate(event.x_memory_records[i], &mut new_byte_lookup_events); + cols.x_access[i].populate( + event.channel, + event.x_memory_records[i], + &mut new_byte_lookup_events, + ); } for i in 0..cols.y_access.len() { - cols.y_access[i] - .populate_write(event.y_memory_records[i], &mut new_byte_lookup_events); + cols.y_access[i].populate_write( + event.channel, + event.y_memory_records[i], + &mut new_byte_lookup_events, + ); } rows.push(row); @@ -197,7 +221,7 @@ where cols.x_access[i].access.value = words[i].into(); } - Self::populate_field_ops(&mut vec![], 0, cols, dummy_value); + Self::populate_field_ops(&mut vec![], 0, 0, cols, dummy_value); row }); @@ -239,15 +263,24 @@ where let x: Limbs::Limbs> = limbs_from_prev_access(&row.x_access); - row.range_x.eval(builder, &x, row.shard, row.is_real); - row.x_2 - .eval(builder, &x, &x, FieldOperation::Mul, row.shard, row.is_real); + row.range_x + .eval(builder, &x, row.shard, row.channel, row.is_real); + row.x_2.eval( + builder, + &x, + &x, + FieldOperation::Mul, + row.shard, + row.channel, + row.is_real, + ); row.x_3.eval( builder, &row.x_2.result, &x, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); let b = E::b_int(); @@ -258,6 +291,7 @@ where &b_const, FieldOperation::Add, row.shard, + row.channel, row.is_real, ); @@ -267,6 +301,7 @@ where &row.y.multiplication.result, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); @@ -278,6 +313,7 @@ where &row.x_3_plus_b.result, row.y.lsb, row.shard, + row.channel, row.is_real, ); @@ -295,6 +331,7 @@ where for i in 0..num_words_field_element { builder.eval_memory_access( row.shard, + row.channel, row.clk, row.ptr.into() + AB::F::from_canonical_u32((i as u32) * 4 + num_limbs as u32), &row.x_access[i], @@ -304,6 +341,7 @@ where for i in 0..num_words_field_element { builder.eval_memory_access( row.shard, + row.channel, row.clk, row.ptr.into() + AB::F::from_canonical_u32((i as u32) * 4), &row.y_access[i], @@ -323,6 +361,7 @@ where builder.receive_syscall( row.shard, + row.channel, row.clk, syscall_id, row.ptr, diff --git a/core/src/syscall/precompiles/weierstrass/weierstrass_double.rs b/core/src/syscall/precompiles/weierstrass/weierstrass_double.rs index 2730c4924e..241a9b6143 100644 --- a/core/src/syscall/precompiles/weierstrass/weierstrass_double.rs +++ b/core/src/syscall/precompiles/weierstrass/weierstrass_double.rs @@ -53,6 +53,7 @@ pub const fn num_weierstrass_double_cols() -> usi pub struct WeierstrassDoubleAssignCols { pub is_real: T, pub shard: T, + pub channel: T, pub clk: T, pub p_ptr: T, pub p_access: GenericArray, P::WordsCurvePoint>, @@ -92,7 +93,7 @@ impl Syscall for WeierstrassDoubleAssi } impl WeierstrassDoubleAssignChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { _marker: PhantomData, } @@ -101,6 +102,7 @@ impl WeierstrassDoubleAssignChip { fn populate_field_ops( blu_events: &mut Vec, shard: u32, + channel: u32, cols: &mut WeierstrassDoubleAssignCols, p_x: BigUint, p_y: BigUint, @@ -113,12 +115,18 @@ impl WeierstrassDoubleAssignChip { let slope = { // slope_numerator = a + (p.x * p.x) * 3. let slope_numerator = { - let p_x_squared = - cols.p_x_squared - .populate(blu_events, shard, &p_x, &p_x, FieldOperation::Mul); + let p_x_squared = cols.p_x_squared.populate( + blu_events, + shard, + channel, + &p_x, + &p_x, + FieldOperation::Mul, + ); let p_x_squared_times_3 = cols.p_x_squared_times_3.populate( blu_events, shard, + channel, &p_x_squared, &BigUint::from(3u32), FieldOperation::Mul, @@ -126,6 +134,7 @@ impl WeierstrassDoubleAssignChip { cols.slope_numerator.populate( blu_events, shard, + channel, &a, &p_x_squared_times_3, FieldOperation::Add, @@ -136,6 +145,7 @@ impl WeierstrassDoubleAssignChip { let slope_denominator = cols.slope_denominator.populate( blu_events, shard, + channel, &BigUint::from(2u32), &p_y, FieldOperation::Mul, @@ -144,6 +154,7 @@ impl WeierstrassDoubleAssignChip { cols.slope.populate( blu_events, shard, + channel, &slope_numerator, &slope_denominator, FieldOperation::Div, @@ -152,15 +163,26 @@ impl WeierstrassDoubleAssignChip { // x = slope * slope - (p.x + p.x). let x = { - let slope_squared = - cols.slope_squared - .populate(blu_events, shard, &slope, &slope, FieldOperation::Mul); - let p_x_plus_p_x = - cols.p_x_plus_p_x - .populate(blu_events, shard, &p_x, &p_x, FieldOperation::Add); + let slope_squared = cols.slope_squared.populate( + blu_events, + shard, + channel, + &slope, + &slope, + FieldOperation::Mul, + ); + let p_x_plus_p_x = cols.p_x_plus_p_x.populate( + blu_events, + shard, + channel, + &p_x, + &p_x, + FieldOperation::Add, + ); cols.x3_ins.populate( blu_events, shard, + channel, &slope_squared, &p_x_plus_p_x, FieldOperation::Sub, @@ -169,12 +191,18 @@ impl WeierstrassDoubleAssignChip { // y = slope * (p.x - x) - p.y. { - let p_x_minus_x = - cols.p_x_minus_x - .populate(blu_events, shard, &p_x, &x, FieldOperation::Sub); + let p_x_minus_x = cols.p_x_minus_x.populate( + blu_events, + shard, + channel, + &p_x, + &x, + FieldOperation::Sub, + ); let slope_times_p_x_minus_x = cols.slope_times_p_x_minus_x.populate( blu_events, shard, + channel, &slope, &p_x_minus_x, FieldOperation::Mul, @@ -182,6 +210,7 @@ impl WeierstrassDoubleAssignChip { cols.y3_ins.populate( blu_events, shard, + channel, &slope_times_p_x_minus_x, &p_y, FieldOperation::Sub, @@ -244,12 +273,14 @@ where // Populate basic columns. cols.is_real = F::one(); cols.shard = F::from_canonical_u32(event.shard); + cols.channel = F::from_canonical_u32(event.channel); cols.clk = F::from_canonical_u32(event.clk); cols.p_ptr = F::from_canonical_u32(event.p_ptr); Self::populate_field_ops( &mut new_byte_lookup_events, event.shard, + event.channel, cols, p_x, p_y, @@ -257,8 +288,11 @@ where // Populate the memory access columns. for i in 0..cols.p_access.len() { - cols.p_access[i] - .populate(event.p_memory_records[i], &mut new_byte_lookup_events); + cols.p_access[i].populate( + event.channel, + event.p_memory_records[i], + &mut new_byte_lookup_events, + ); } row }) @@ -280,7 +314,7 @@ where let cols: &mut WeierstrassDoubleAssignCols = row.as_mut_slice().borrow_mut(); let zero = BigUint::zero(); - Self::populate_field_ops(&mut vec![], 0, cols, zero.clone(), zero.clone()); + Self::populate_field_ops(&mut vec![], 0, 0, cols, zero.clone(), zero.clone()); row }); @@ -335,6 +369,7 @@ where &p_x, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -344,6 +379,7 @@ where &E::BaseField::to_limbs_field::(&BigUint::from(3u32)), FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -353,6 +389,7 @@ where &row.p_x_squared_times_3.result, FieldOperation::Add, row.shard, + row.channel, row.is_real, ); }; @@ -364,6 +401,7 @@ where &p_y, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); @@ -373,6 +411,7 @@ where &row.slope_denominator.result, FieldOperation::Div, row.shard, + row.channel, row.is_real, ); @@ -387,6 +426,7 @@ where slope, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); row.p_x_plus_p_x.eval( @@ -395,6 +435,7 @@ where &p_x, FieldOperation::Add, row.shard, + row.channel, row.is_real, ); row.x3_ins.eval( @@ -403,6 +444,7 @@ where &row.p_x_plus_p_x.result, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); &row.x3_ins.result @@ -416,6 +458,7 @@ where x, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); row.slope_times_p_x_minus_x.eval( @@ -424,6 +467,7 @@ where &row.p_x_minus_x.result, FieldOperation::Mul, row.shard, + row.channel, row.is_real, ); row.y3_ins.eval( @@ -432,6 +476,7 @@ where &p_y, FieldOperation::Sub, row.shard, + row.channel, row.is_real, ); } @@ -450,6 +495,7 @@ where builder.eval_memory_access_slice( row.shard, + row.channel, row.clk.into(), row.p_ptr, &row.p_access, @@ -470,6 +516,7 @@ where builder.receive_syscall( row.shard, + row.channel, row.clk, syscall_id_felt, row.p_ptr, diff --git a/core/src/syscall/unconstrained.rs b/core/src/syscall/unconstrained.rs index e9025692bc..ab9456ce64 100644 --- a/core/src/syscall/unconstrained.rs +++ b/core/src/syscall/unconstrained.rs @@ -5,7 +5,7 @@ use crate::runtime::{ForkState, Syscall, SyscallContext}; pub struct SyscallEnterUnconstrained; impl SyscallEnterUnconstrained { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } @@ -33,7 +33,7 @@ impl Syscall for SyscallEnterUnconstrained { pub struct SyscallExitUnconstrained; impl SyscallExitUnconstrained { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } diff --git a/core/src/syscall/verify.rs b/core/src/syscall/verify.rs index 26e0e393f8..e40639aeba 100644 --- a/core/src/syscall/verify.rs +++ b/core/src/syscall/verify.rs @@ -10,7 +10,7 @@ use crate::{ pub struct SyscallVerifySP1Proof; impl SyscallVerifySP1Proof { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } diff --git a/core/src/syscall/write.rs b/core/src/syscall/write.rs index 3c68ea7fc6..2953cd33bd 100644 --- a/core/src/syscall/write.rs +++ b/core/src/syscall/write.rs @@ -6,7 +6,7 @@ use crate::{ pub struct SyscallWrite; impl SyscallWrite { - pub fn new() -> Self { + pub const fn new() -> Self { Self } } diff --git a/core/src/utils/buffer.rs b/core/src/utils/buffer.rs index c4a2a926bb..3c15899c3a 100644 --- a/core/src/utils/buffer.rs +++ b/core/src/utils/buffer.rs @@ -9,7 +9,7 @@ pub struct Buffer { } impl Buffer { - pub fn new() -> Self { + pub const fn new() -> Self { Self { data: Vec::new(), ptr: 0, diff --git a/core/src/utils/config.rs b/core/src/utils/config.rs index 9cb3583683..77e99c373a 100644 --- a/core/src/utils/config.rs +++ b/core/src/utils/config.rs @@ -36,7 +36,7 @@ pub type InnerValMmcs = FieldMerkleTreeMmcs< 8, >; pub type InnerChallengeMmcs = ExtensionMmcs; -pub type InnerChallenger = DuplexChallenger; +pub type InnerChallenger = DuplexChallenger; pub type InnerDft = Radix2DitParallel; pub type InnerPcs = TwoAdicFriPcs; pub type InnerQueryProof = QueryProof; diff --git a/core/src/utils/ec/mod.rs b/core/src/utils/ec/mod.rs index 6ec4ad0327..1d96f58c3c 100644 --- a/core/src/utils/ec/mod.rs +++ b/core/src/utils/ec/mod.rs @@ -50,7 +50,7 @@ pub struct AffinePoint { impl AffinePoint { #[allow(dead_code)] - pub fn new(x: BigUint, y: BigUint) -> Self { + pub const fn new(x: BigUint, y: BigUint) -> Self { Self { x, y, diff --git a/core/src/utils/env.rs b/core/src/utils/env.rs deleted file mode 100644 index 2ee11fef53..0000000000 --- a/core/src/utils/env.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::utils::log2_strict_usize; - -pub const MAX_SHARD_CLK: usize = (1 << 24) - 1; - -/// Gets the number of rows which by default should be used for each chip to maximize padding. -pub fn shard_size() -> usize { - let value = match std::env::var("SHARD_SIZE") { - Ok(val) => val.parse().unwrap(), - Err(_) => 1 << 22, - }; - - if value > MAX_SHARD_CLK { - panic!( - "Shard size must be at most 2^{} - 1", - log2_strict_usize(MAX_SHARD_CLK + 1) - ); - } - - assert!(value != 0 && (value & (value - 1)) == 0); - value -} - -/// A constant used to determine how many shards get chunked per core on the CPU. -pub fn shard_chunking_multiplier() -> usize { - match std::env::var("SHARD_CHUNKING_MULTIPLIER") { - Ok(val) => val.parse().unwrap(), - Err(_) => 1, - } -} - -/// Gets the flag for whether to recreate the shard commitments instead of saving them to disk. -pub fn reconstruct_commitments() -> bool { - match std::env::var("RECONSTRUCT_COMMITMENTS") { - Ok(val) => val == "true", - Err(_) => true, - } -} - -/// Gets the max number of shards that can go in one batch. If set to 0, there will only be 1 batch. -/// -/// The prover will generate the events for a whole batch at once, so this param should be the -/// largest number of shards that can be executed and proven at once, subject to memory constraints. -pub fn shard_batch_size() -> u32 { - match std::env::var("SHARD_BATCH_SIZE") { - Ok(val) => val.parse().unwrap(), - Err(_) => 128, - } -} diff --git a/core/src/utils/mod.rs b/core/src/utils/mod.rs index 0ab8a5ceea..3632cde1b8 100644 --- a/core/src/utils/mod.rs +++ b/core/src/utils/mod.rs @@ -1,8 +1,8 @@ mod buffer; mod config; pub mod ec; -pub mod env; mod logger; +mod options; mod programs; mod prove; mod tracer; @@ -10,6 +10,7 @@ mod tracer; pub use buffer::*; pub use config::*; pub use logger::*; +pub use options::*; pub use prove::*; pub use tracer::*; diff --git a/core/src/utils/options.rs b/core/src/utils/options.rs new file mode 100644 index 0000000000..432029baec --- /dev/null +++ b/core/src/utils/options.rs @@ -0,0 +1,26 @@ +#[derive(Debug, Clone, Copy)] +pub struct SP1CoreOpts { + pub shard_size: usize, + pub shard_batch_size: usize, + pub shard_chunking_multiplier: usize, + pub reconstruct_commitments: bool, +} + +impl Default for SP1CoreOpts { + fn default() -> Self { + Self { + shard_size: 1 << 22, + shard_batch_size: 16, + shard_chunking_multiplier: 1, + reconstruct_commitments: false, + } + } +} + +impl SP1CoreOpts { + pub fn recursion() -> Self { + let mut opts = Self::default(); + opts.reconstruct_commitments = false; + opts + } +} diff --git a/core/src/utils/prove.rs b/core/src/utils/prove.rs index 47a96d1c19..62eaf8b902 100644 --- a/core/src/utils/prove.rs +++ b/core/src/utils/prove.rs @@ -24,7 +24,7 @@ use crate::stark::Val; use crate::stark::VerifierConstraintFolder; use crate::stark::{Com, PcsProverData, RiscvAir, ShardProof, StarkProvingKey, UniConfig}; use crate::stark::{MachineRecord, StarkMachine}; -use crate::utils::env; +use crate::utils::SP1CoreOpts; use crate::{ runtime::{Program, Runtime}, stark::StarkGenericConfig, @@ -62,7 +62,12 @@ where // Prove the program. let mut challenger = machine.config().challenger(); let proving_start = Instant::now(); - let proof = machine.prove::>(&pk, runtime.record, &mut challenger); + let proof = machine.prove::>( + &pk, + runtime.record, + &mut challenger, + SP1CoreOpts::default(), + ); let proving_duration = proving_start.elapsed().as_millis(); let nb_bytes = bincode::serialize(&proof).unwrap().len(); @@ -82,6 +87,7 @@ pub fn prove( program: Program, stdin: &SP1Stdin, config: SC, + opts: SP1CoreOpts, ) -> Result<(MachineProof, Vec), SP1CoreProverError> where SC::Challenger: Clone, @@ -94,7 +100,7 @@ where let proving_start = Instant::now(); // Execute the program. - let mut runtime = Runtime::new(program.clone()); + let mut runtime = Runtime::new(program.clone(), opts); runtime.write_vecs(&stdin.buffer); for proof in stdin.proofs.iter() { runtime.write_proof(proof.0.clone(), proof.1.clone()); @@ -105,7 +111,7 @@ where let (pk, vk) = machine.setup(runtime.program.as_ref()); // If we don't need to batch, we can just run the program normally and prove it. - if env::shard_batch_size() == 0 { + if opts.shard_batch_size == 0 { // Execute the runtime and collect all the events.. runtime.run().map_err(SP1CoreProverError::ExecutionError)?; @@ -157,7 +163,7 @@ where let mut challenger = machine.config().challenger(); vk.observe_into(&mut challenger); for checkpoint_file in checkpoints.iter_mut() { - let mut record = trace_checkpoint(program.clone(), checkpoint_file); + let mut record = trace_checkpoint(program.clone(), checkpoint_file, opts); record.public_values = public_values; reset_seek(&mut *checkpoint_file); @@ -167,7 +173,7 @@ where // Commit to each shard. let (commitments, commit_data) = tracing::info_span!("commit") - .in_scope(|| LocalProver::commit_shards(&machine, &checkpoint_shards)); + .in_scope(|| LocalProver::commit_shards(&machine, &checkpoint_shards, opts)); shard_main_datas.push(commit_data); // Observe the commitments. @@ -181,7 +187,7 @@ where let mut shard_proofs = Vec::>::new(); for mut checkpoint_file in checkpoints.into_iter() { let checkpoint_shards = { - let mut events = trace_checkpoint(program.clone(), &checkpoint_file); + let mut events = trace_checkpoint(program.clone(), &checkpoint_file, opts); events.public_values = public_values; reset_seek(&mut checkpoint_file); tracing::debug_span!("shard").in_scope(|| machine.shard(events, &sharding_config)) @@ -230,7 +236,7 @@ pub fn run_test_io( inputs: SP1Stdin, ) -> Result> { let runtime = tracing::info_span!("runtime.run(...)").in_scope(|| { - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.write_vecs(&inputs.buffer); runtime.run().unwrap(); runtime @@ -247,7 +253,7 @@ pub fn run_test( crate::stark::MachineVerificationError, > { let runtime = tracing::info_span!("runtime.run(...)").in_scope(|| { - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.run().unwrap(); runtime }); @@ -301,7 +307,8 @@ where let start = Instant::now(); let mut challenger = machine.config().challenger(); - let proof = machine.prove::>(&pk, record, &mut challenger); + let proof = + machine.prove::>(&pk, record, &mut challenger, SP1CoreOpts::default()); let time = start.elapsed().as_millis(); let nb_bytes = bincode::serialize(&proof).unwrap().len(); @@ -319,10 +326,10 @@ where Ok(proof) } -fn trace_checkpoint(program: Program, file: &File) -> ExecutionRecord { +fn trace_checkpoint(program: Program, file: &File, opts: SP1CoreOpts) -> ExecutionRecord { let mut reader = std::io::BufReader::new(file); let state = bincode::deserialize_from(&mut reader).expect("failed to deserialize state"); - let mut runtime = Runtime::recover(program.clone(), state); + let mut runtime = Runtime::recover(program.clone(), state, opts); let (events, _) = tracing::debug_span!("runtime.trace").in_scope(|| runtime.execute_record().unwrap()); events @@ -435,7 +442,7 @@ pub mod baby_bear_poseidon2 { >; pub type ChallengeMmcs = ExtensionMmcs; pub type Dft = Radix2DitParallel; - pub type Challenger = DuplexChallenger; + pub type Challenger = DuplexChallenger; type Pcs = TwoAdicFriPcs; pub fn my_perm() -> Perm { diff --git a/derive/Cargo.toml b/derive/Cargo.toml index b479cf8b38..cd09114d95 100644 --- a/derive/Cargo.toml +++ b/derive/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-derive" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [lib] proc-macro = true diff --git a/eval/src/main.rs b/eval/src/main.rs index c11e4413fd..dbf67c51b5 100644 --- a/eval/src/main.rs +++ b/eval/src/main.rs @@ -5,7 +5,9 @@ use clap::{command, Parser}; use csv::WriterBuilder; use serde::Serialize; use sp1_core::runtime::{Program, Runtime}; -use sp1_core::utils::{prove_simple, BabyBearBlake3, BabyBearKeccak, BabyBearPoseidon2}; +use sp1_core::utils::{ + prove_simple, BabyBearBlake3, BabyBearKeccak, BabyBearPoseidon2, SP1CoreOpts, +}; use sp1_prover::utils::get_cycles; use sp1_prover::SP1Stdin; use std::fmt; @@ -137,7 +139,8 @@ fn run_evaluation(hashfn: &HashFnId, program: &Program, _elf: &[u8]) -> (f64, f6 // or end to end proving as we only support Poseidon for now. match hashfn { HashFnId::Blake3 => { - let mut runtime = Runtime::new(program.clone()); + let opts = SP1CoreOpts::default(); + let mut runtime = Runtime::new(program.clone(), opts); let execution_start = Instant::now(); runtime.run().unwrap(); let execution_duration = execution_start.elapsed().as_secs_f64(); @@ -154,7 +157,8 @@ fn run_evaluation(hashfn: &HashFnId, program: &Program, _elf: &[u8]) -> (f64, f6 (execution_duration, prove_duration, verify_duration) } HashFnId::Poseidon => { - let mut runtime = Runtime::new(program.clone()); + let opts = SP1CoreOpts::default(); + let mut runtime = Runtime::new(program.clone(), opts); let execution_start = Instant::now(); runtime.run().unwrap(); let execution_duration = execution_start.elapsed().as_secs_f64(); @@ -171,7 +175,8 @@ fn run_evaluation(hashfn: &HashFnId, program: &Program, _elf: &[u8]) -> (f64, f6 (execution_duration, prove_duration, verify_duration) } HashFnId::Keccak256 => { - let mut runtime = Runtime::new(program.clone()); + let opts = SP1CoreOpts::default(); + let mut runtime = Runtime::new(program.clone(), opts); let execution_start = Instant::now(); runtime.run().unwrap(); let execution_duration = execution_start.elapsed().as_secs_f64(); diff --git a/examples/Cargo.lock b/examples/Cargo.lock index c6684b3326..494c0d0f26 100644 --- a/examples/Cargo.lock +++ b/examples/Cargo.lock @@ -2,6 +2,16 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + [[package]] name = "addchain" version = "0.2.0" @@ -15,9 +25,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -28,6 +38,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -55,152 +76,11 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" -[[package]] -name = "alloy" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-contract", - "alloy-core", - "alloy-eips", - "alloy-genesis", - "alloy-provider", - "alloy-rpc-client", - "alloy-serde", - "alloy-signer", - "alloy-signer-wallet", - "alloy-transport-http", - "reqwest 0.12.4", -] - -[[package]] -name = "alloy-consensus" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-eips", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "serde", - "sha2 0.10.8", -] - -[[package]] -name = "alloy-contract" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-network", - "alloy-primitives", - "alloy-provider", - "alloy-rpc-types", - "alloy-sol-types", - "alloy-transport", - "futures", - "futures-util", - "thiserror", -] - -[[package]] -name = "alloy-core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e30b83573b348305b9629a094b5331093a030514cd5713433799495cb283fea1" -dependencies = [ - "alloy-dyn-abi", - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-types", -] - -[[package]] -name = "alloy-dyn-abi" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545885d9b0b2c30fd344ae291439b4bfe59e48dd62fbc862f8503d98088967dc" -dependencies = [ - "alloy-json-abi", - "alloy-primitives", - "alloy-sol-type-parser", - "alloy-sol-types", - "const-hex", - "itoa", - "serde", - "serde_json", - "winnow 0.6.8", -] - -[[package]] -name = "alloy-eips" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "c-kzg", - "once_cell", - "serde", -] - -[[package]] -name = "alloy-genesis" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-serde", - "serde", -] - -[[package]] -name = "alloy-json-abi" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786689872ec4e7d354810ab0dffd48bb40b838c047522eb031cbd47d15634849" -dependencies = [ - "alloy-primitives", - "alloy-sol-type-parser", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-json-rpc" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-network" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-json-rpc", - "alloy-primitives", - "alloy-rpc-types", - "alloy-signer", - "async-trait", - "futures-utils-wasm", - "serde", - "thiserror", -] - [[package]] name = "alloy-primitives" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525448f6afc1b70dd0f9d0a8145631bf2f5e434678ab23ab18409ca264cae6b3" +checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b" dependencies = [ "alloy-rlp", "bytes", @@ -218,149 +98,36 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-provider" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-network", - "alloy-primitives", - "alloy-rpc-client", - "alloy-rpc-types", - "alloy-rpc-types-trace", - "alloy-transport", - "alloy-transport-http", - "async-stream", - "async-trait", - "auto_impl", - "dashmap", - "futures", - "lru", - "reqwest 0.12.4", - "serde_json", - "tokio", - "tracing", - "url", -] - [[package]] name = "alloy-rlp" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" dependencies = [ - "alloy-rlp-derive", "arrayvec", "bytes", ] [[package]] -name = "alloy-rlp-derive" -version = "0.3.4" +name = "alloy-sol-macro" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +checksum = "7dbd17d67f3e89478c8a634416358e539e577899666c927bc3d2b1328ee9b6ca" dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] -name = "alloy-rpc-client" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "alloy-transport-http", - "futures", - "pin-project", - "reqwest 0.12.4", - "serde", - "serde_json", - "tokio", - "tokio-stream", - "tower", - "tracing", - "url", -] - -[[package]] -name = "alloy-rpc-types" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-eips", - "alloy-genesis", - "alloy-primitives", - "alloy-rlp", - "alloy-serde", - "alloy-sol-types", - "itertools 0.12.1", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "alloy-rpc-types-trace" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "alloy-serde", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-serde" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - -[[package]] -name = "alloy-signer" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-primitives", - "async-trait", - "auto_impl", - "elliptic-curve", - "k256", - "thiserror", -] - -[[package]] -name = "alloy-signer-wallet" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-consensus", - "alloy-network", - "alloy-primitives", - "alloy-signer", - "async-trait", - "k256", - "rand", - "thiserror", -] - -[[package]] -name = "alloy-sol-macro" -version = "0.7.2" +name = "alloy-sol-macro-expander" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c80a2cb97e7aa48611cbb63950336f9824a174cdf670527cc6465078a26ea1" +checksum = "2c6da95adcf4760bb4b108fefa51d50096c5e5fdd29ee72fed3e86ee414f2e34" dependencies = [ - "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.4.1", @@ -368,81 +135,38 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58894b58ac50979eeac6249661991ac40b9d541830d9a725f7714cc9ef08c23" +checksum = "32c8da04c1343871fb6ce5a489218f9c85323c8340a36e9106b5fc98d4dd59d5" dependencies = [ - "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", - "serde_json", - "syn 2.0.61", + "syn 2.0.66", "syn-solidity", ] -[[package]] -name = "alloy-sol-type-parser" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8e71ea68e780cc203919e03f69f59e7afe92d2696fb1dcb6662f61e4031b6" -dependencies = [ - "winnow 0.6.8", -] - [[package]] name = "alloy-sol-types" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399287f68d1081ed8b1f4903c49687658b95b142207d7cb4ae2f4813915343ef" +checksum = "40a64d2d2395c1ac636b62419a7b17ec39031d6b2367e66e9acbf566e6055e9c" dependencies = [ - "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", "serde", ] -[[package]] -name = "alloy-transport" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "base64 0.22.1", - "futures-util", - "futures-utils-wasm", - "serde", - "serde_json", - "thiserror", - "tokio", - "tower", - "url", - "wasm-bindgen-futures", -] - -[[package]] -name = "alloy-transport-http" -version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy?rev=bfd0fda#bfd0fda492e560c3463d521958793c81bbeadfc1" -dependencies = [ - "alloy-json-rpc", - "alloy-transport", - "reqwest 0.12.4", - "serde_json", - "tower", - "url", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -518,9 +242,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "ark-ff" @@ -646,12 +370,6 @@ dependencies = [ "rand", ] -[[package]] -name = "array-macro" -version = "2.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220a2c618ab466efe41d0eace94dfeff1c35e3aa47891bdb95e1c0fefffd3c99" - [[package]] name = "arrayref" version = "0.3.7" @@ -665,37 +383,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] -name = "async-stream" -version = "0.3.5" +name = "async-trait" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", + "proc-macro2", + "quote", + "syn 2.0.66", ] [[package]] -name = "async-stream-impl" -version = "0.3.5" +name = "async_io_stream" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.61", + "futures", + "pharos", + "rustc_version 0.4.0", ] [[package]] -name = "async-trait" -version = "0.1.80" +name = "atomic-waker" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.61", -] +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "auto_impl" @@ -705,7 +418,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -771,9 +484,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" dependencies = [ "addr2line", "cc", @@ -791,6 +504,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -809,6 +528,12 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bincode" version = "1.3.3" @@ -827,7 +552,7 @@ dependencies = [ "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -837,7 +562,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.61", + "syn 2.0.66", "which", ] @@ -912,12 +637,7 @@ dependencies = [ "cfg-if", "constant_time_eq", "rayon", -] - -[[package]] -name = "blake3-zkvm" -version = "0.1.0" -source = "git+https://github.com/sp1-patches/BLAKE3.git?branch=patch-blake3_zkvm/v.1.0.0#bac2d59f9122b07a4d91475560b4c3214ae62444" +] [[package]] name = "block-buffer" @@ -951,15 +671,13 @@ dependencies = [ ] [[package]] -name = "blst" -version = "0.3.11" +name = "bs58" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ - "cc", - "glob", - "threadpool", - "zeroize", + "sha2 0.10.8", + "tinyvec", ] [[package]] @@ -989,25 +707,11 @@ dependencies = [ "serde", ] -[[package]] -name = "c-kzg" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf100c4cea8f207e883ff91ca886d621d8a166cb04971dfaa9bb8fd99ed95df" -dependencies = [ - "blst", - "cc", - "glob", - "hex", - "libc", - "serde", -] - [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] @@ -1037,9 +741,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", "libc", @@ -1082,11 +786,21 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -1112,7 +826,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.11.1", + "strsim", ] [[package]] @@ -1124,7 +838,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1133,6 +847,58 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest 0.10.7", + "hmac", + "k256", + "serde", + "sha2 0.10.8", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2 0.10.8", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.7", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array 0.14.7", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.8", + "sha3", + "thiserror", +] + [[package]] name = "colorchoice" version = "1.0.1" @@ -1154,9 +920,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" dependencies = [ "cfg-if", "cpufeatures", @@ -1214,28 +980,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1255,20 +999,11 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -1308,6 +1043,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.2" @@ -1332,7 +1076,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1358,9 +1102,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" dependencies = [ "darling_core", "darling_macro", @@ -1368,40 +1112,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.61", + "strsim", + "syn 2.0.66", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", "quote", - "syn 2.0.61", -] - -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", + "syn 2.0.66", ] [[package]] @@ -1501,12 +1232,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "dotenv" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" - [[package]] name = "downcast-rs" version = "1.2.1" @@ -1514,108 +1239,400 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] -name = "dunce" -version = "1.0.4" +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der 0.7.9", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki 0.7.3", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8 0.10.2", + "signature", +] + +[[package]] +name = "ed25519-consensus" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +dependencies = [ + "curve25519-dalek-ng", + "hex", + "rand_core", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint 0.5.5", + "digest 0.10.7", + "ff 0.13.0", + "generic-array 0.14.7", + "group 0.13.0", + "pkcs8 0.10.2", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.7", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "thiserror", + "uuid", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] [[package]] -name = "ecdsa" -version = "0.16.9" +name = "ethers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" dependencies = [ - "der 0.7.9", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki 0.7.3", + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-middleware", + "ethers-providers", + "ethers-signers", ] [[package]] -name = "ed25519" -version = "2.2.3" +name = "ethers-addressbook" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" dependencies = [ - "pkcs8 0.10.2", - "signature", + "ethers-core", + "once_cell", + "serde", + "serde_json", ] [[package]] -name = "ed25519-consensus" -version = "2.1.0" +name = "ethers-contract" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8465edc8ee7436ffea81d21a019b16676ee3db267aa8d5a8d729581ecf998b" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" dependencies = [ - "curve25519-dalek-ng", - "hex", - "rand_core", - "sha2 0.9.9", - "zeroize", + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", ] [[package]] -name = "either" -version = "1.11.0" +name = "ethers-contract-abigen" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "syn 2.0.66", + "toml", + "walkdir", +] [[package]] -name = "elf" -version = "0.7.4" +name = "ethers-contract-derive" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.66", +] [[package]] -name = "elliptic-curve" -version = "0.13.8" +name = "ethers-core" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" dependencies = [ - "base16ct", - "crypto-bigint 0.5.5", - "digest 0.10.7", - "ff 0.13.0", + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", "generic-array 0.14.7", - "group 0.13.0", - "pkcs8 0.10.2", - "rand_core", - "sec1", - "subtle", - "zeroize", + "k256", + "num_enum 0.7.2", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.66", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", ] [[package]] -name = "encode_unicode" -version = "0.3.6" +name = "ethers-middleware" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] [[package]] -name = "encoding_rs" -version = "0.8.34" +name = "ethers-providers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" dependencies = [ - "cfg-if", + "async-trait", + "auto_impl", + "base64 0.21.7", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.12", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest 0.11.27", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", ] [[package]] -name = "equivalent" -version = "1.0.1" +name = "ethers-signers" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand", + "sha2 0.10.8", + "thiserror", + "tracing", +] [[package]] -name = "errno" -version = "0.3.9" +name = "eyre" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ - "libc", - "windows-sys 0.52.0", + "indenter", + "once_cell", ] [[package]] @@ -1677,9 +1694,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "fibonacci-script" @@ -1796,6 +1813,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1804,7 +1831,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -1819,6 +1846,16 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + [[package]] name = "futures-util" version = "0.3.30" @@ -1838,10 +1875,13 @@ dependencies = [ ] [[package]] -name = "futures-utils-wasm" -version = "0.1.0" +name = "fxhash" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] [[package]] name = "gcd" @@ -1883,9 +1923,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" @@ -1906,6 +1946,18 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "group" version = "0.12.1" @@ -1950,15 +2002,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http 1.1.0", "indexmap 2.2.6", "slab", @@ -2012,6 +2064,15 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "heck" version = "0.4.1" @@ -2035,9 +2096,6 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-literal" @@ -2164,7 +2222,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.4", + "h2 0.4.5", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -2224,9 +2282,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ "bytes", "futures-channel", @@ -2290,6 +2348,24 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -2301,6 +2377,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -2336,11 +2418,20 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -2426,6 +2517,20 @@ dependencies = [ "sp1-sdk", ] +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.7", + "pem", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "jubjub" version = "0.9.0" @@ -2497,9 +2602,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libgit2-sys" @@ -2541,9 +2646,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.16" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" +checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" dependencies = [ "cc", "libc", @@ -2553,9 +2658,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -2573,15 +2678,6 @@ version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" -[[package]] -name = "lru" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "matchers" version = "0.1.0" @@ -2623,9 +2719,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] @@ -2643,11 +2739,10 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2810,17 +2905,26 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", ] [[package]] name = "num_enum" -version = "0.5.11" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.7.2", ] [[package]] @@ -2835,6 +2939,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate 3.1.0", + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "num_threads" version = "0.1.7" @@ -2852,9 +2968,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.32.2" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" dependencies = [ "memchr", ] @@ -2871,6 +2987,31 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "openssl" version = "0.10.64" @@ -2894,7 +3035,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -2930,7 +3071,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p3-air" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -2939,7 +3080,7 @@ dependencies = [ [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "num-bigint 0.4.5", "p3-field", @@ -2953,7 +3094,7 @@ dependencies = [ [[package]] name = "p3-blake3" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "blake3", "p3-symmetric", @@ -2962,7 +3103,7 @@ dependencies = [ [[package]] name = "p3-bn254-fr" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "ff 0.13.0", "num-bigint 0.4.5", @@ -2976,7 +3117,7 @@ dependencies = [ [[package]] name = "p3-challenger" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -2988,7 +3129,7 @@ dependencies = [ [[package]] name = "p3-commit" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3001,7 +3142,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -3013,7 +3154,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.5", @@ -3026,7 +3167,7 @@ dependencies = [ [[package]] name = "p3-fri" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3044,7 +3185,7 @@ dependencies = [ [[package]] name = "p3-interpolation" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -3054,7 +3195,7 @@ dependencies = [ [[package]] name = "p3-keccak" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -3063,7 +3204,7 @@ dependencies = [ [[package]] name = "p3-keccak-air" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-air", "p3-field", @@ -3076,7 +3217,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3090,7 +3231,7 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "rayon", ] @@ -3098,7 +3239,7 @@ dependencies = [ [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -3112,7 +3253,7 @@ dependencies = [ [[package]] name = "p3-merkle-tree" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -3128,7 +3269,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "gcd", "p3-field", @@ -3140,7 +3281,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3150,7 +3291,7 @@ dependencies = [ [[package]] name = "p3-uni-stark" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools 0.12.1", "p3-air", @@ -3168,7 +3309,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#da0489b75025ec17f1100952694d8b7879c2b43e" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "serde", ] @@ -3210,9 +3351,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -3267,6 +3408,34 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + [[package]] name = "pem-rfc7468" version = "0.3.1" @@ -3293,6 +3462,16 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "rustc_version 0.4.0", +] + [[package]] name = "pin-project" version = "1.1.5" @@ -3310,7 +3489,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -3394,7 +3573,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -3405,6 +3584,9 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", "uint", ] @@ -3453,9 +3635,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "ec96c6a92621310b51366f1e28d05ef11489516e93be030060e5fc12024a49d6" dependencies = [ "unicode-ident", ] @@ -3482,9 +3664,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" dependencies = [ "bytes", "prost-derive", @@ -3492,22 +3674,22 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.5" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "prost-types" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" dependencies = [ "prost", ] @@ -3722,10 +3904,9 @@ dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", - "futures-channel", "futures-core", "futures-util", - "h2 0.4.4", + "h2 0.4.5", "http 1.1.0", "http-body 1.0.0", "http-body-util", @@ -3788,6 +3969,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.8" @@ -3799,10 +3995,19 @@ dependencies = [ "getrandom", "libc", "spin 0.9.8", - "untrusted", + "untrusted 0.9.0", "windows-sys 0.52.0", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rlp" version = "0.5.2" @@ -3810,16 +4015,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", + "rlp-derive", "rustc-hex", ] +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "rrs-lib" version = "0.1.0" source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" dependencies = [ "downcast-rs", - "num_enum", + "num_enum 0.5.11", "paste", ] @@ -3938,7 +4155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki", "subtle", @@ -3972,20 +4189,20 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ - "ring", + "ring 0.17.8", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -4005,6 +4222,24 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scale-info" version = "2.11.3" @@ -4053,6 +4288,18 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.8", +] + [[package]] name = "sdd" version = "0.2.0" @@ -4123,11 +4370,23 @@ dependencies = [ "pest", ] +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -4153,13 +4412,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4191,7 +4450,16 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", ] [[package]] @@ -4233,7 +4501,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4258,7 +4526,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4339,6 +4607,18 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint 0.4.5", + "num-traits", + "thiserror", + "time", +] + [[package]] name = "size" version = "0.4.1" @@ -4398,7 +4678,6 @@ dependencies = [ "arrayref", "bincode", "blake3", - "blake3-zkvm", "cfg-if", "curve25519-dalek", "elf", @@ -4433,7 +4712,6 @@ dependencies = [ "rrs-lib", "serde", "serde_with", - "serial_test", "size", "snowbridge-amcl", "sp1-derive", @@ -4516,7 +4794,6 @@ dependencies = [ "thiserror", "tokio", "tracing", - "tracing-appender", "tracing-subscriber", ] @@ -4559,8 +4836,6 @@ dependencies = [ "p3-symmetric", "p3-util", "serde", - "serde_json", - "serial_test", "sp1-core", "sp1-recursion-core", "sp1-recursion-derive", @@ -4614,17 +4889,15 @@ version = "0.1.0" dependencies = [ "bindgen", "cc", - "crossbeam", + "cfg-if", "log", "num-bigint 0.4.5", "p3-baby-bear", "p3-field", "rand", - "reqwest 0.12.4", "serde", "serde_json", "sp1-recursion-compiler", - "subtle-encoding", "tempfile", ] @@ -4632,7 +4905,6 @@ dependencies = [ name = "sp1-recursion-program" version = "0.1.0" dependencies = [ - "array-macro", "itertools 0.12.1", "p3-air", "p3-baby-bear", @@ -4659,13 +4931,15 @@ dependencies = [ name = "sp1-sdk" version = "0.1.0" dependencies = [ - "alloy", + "alloy-primitives", + "alloy-sol-types", "anyhow", "async-trait", "axum", "bincode", + "cfg-if", "dirs", - "dotenv", + "ethers", "futures", "hex", "indicatif", @@ -4675,7 +4949,6 @@ dependencies = [ "p3-field", "p3-matrix", "prost", - "prost-types", "reqwest 0.12.4", "reqwest-middleware", "serde", @@ -4736,12 +5009,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "strsim" version = "0.11.1" @@ -4753,6 +5020,9 @@ name = "strum" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" +dependencies = [ + "strum_macros", +] [[package]] name = "strum_macros" @@ -4764,7 +5034,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4801,9 +5071,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -4812,14 +5082,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa0cefd02f532035d83cfec82647c6eb53140b0485220760e669f4bad489e36" +checksum = "b8db114c44cf843a8bacd37a146e37987a0b823a0e8bc4fdc610c9c72ab397a5" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4954,22 +5224,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -4982,15 +5252,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.3.36" @@ -5075,7 +5336,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -5099,18 +5360,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", - "tokio-util", -] - [[package]] name = "tokio-util" version = "0.7.11" @@ -5124,11 +5373,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.13", +] + [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -5152,6 +5416,19 @@ dependencies = [ "winnow 0.5.40", ] +[[package]] +name = "toml_edit" +version = "0.22.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.9", +] + [[package]] name = "tower" version = "0.4.13" @@ -5192,18 +5469,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-appender" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" -dependencies = [ - "crossbeam-channel", - "thiserror", - "time", - "tracing-subscriber", -] - [[package]] name = "tracing-attributes" version = "0.1.27" @@ -5212,7 +5477,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] @@ -5238,6 +5503,16 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -5352,6 +5627,18 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -5375,6 +5662,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "valuable" version = "0.1.0" @@ -5415,6 +5712,16 @@ dependencies = [ "libc", ] +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -5451,7 +5758,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-shared", ] @@ -5485,7 +5792,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5566,6 +5873,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -5731,9 +6047,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "86c949fede1d13936a99f14fafd3e76fd642b556dd2ce96287fbe2e0151bfac6" dependencies = [ "memchr", ] @@ -5758,6 +6074,25 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version 0.4.0", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "wyz" version = "0.5.1" @@ -5784,14 +6119,14 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -5804,7 +6139,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.66", ] [[package]] diff --git a/examples/aggregation/programs/aggregation/Cargo.lock b/examples/aggregation/programs/aggregation/Cargo.lock index 9b3f983126..692e2f3662 100644 --- a/examples/aggregation/programs/aggregation/Cargo.lock +++ b/examples/aggregation/programs/aggregation/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -346,9 +346,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -360,20 +360,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -389,9 +388,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -400,11 +399,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -412,9 +410,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -428,7 +426,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "num-bigint", "p3-field", @@ -442,7 +440,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -454,7 +452,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "num-bigint", @@ -467,7 +465,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-field", @@ -481,12 +479,12 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-dft", @@ -500,7 +498,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "gcd", "p3-field", @@ -512,7 +510,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-field", @@ -522,7 +520,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#04d4c6e15a0296798331db82e696d29c455bafe1" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "serde", ] @@ -697,18 +695,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -748,7 +746,6 @@ dependencies = [ [[package]] name = "sp1-precompiles" version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?rev=v1.0.0-testnet#e721b246243e40376f7b75d7330e53c7351b727f" dependencies = [ "anyhow", "bincode", @@ -765,7 +762,6 @@ dependencies = [ [[package]] name = "sp1-primitives" version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?rev=v1.0.0-testnet#e721b246243e40376f7b75d7330e53c7351b727f" dependencies = [ "itertools", "lazy_static", @@ -778,7 +774,6 @@ dependencies = [ [[package]] name = "sp1-zkvm" version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?rev=v1.0.0-testnet#e721b246243e40376f7b75d7330e53c7351b727f" dependencies = [ "bincode", "cfg-if", diff --git a/examples/aggregation/programs/aggregation/Cargo.toml b/examples/aggregation/programs/aggregation/Cargo.toml index 0e25eec36d..d3897f5ff5 100644 --- a/examples/aggregation/programs/aggregation/Cargo.toml +++ b/examples/aggregation/programs/aggregation/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] hex = "0.4.3" sha2 = "0.10.8" -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", features = ["verify"], rev = "v1.0.0-testnet" } +sp1-zkvm = { path = "../../../../zkvm/entrypoint", features = ["verify"] } [patch.crates-io] -sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes.git", package = "sha2", branch = "patch-v0.10.8" } \ No newline at end of file +sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes.git", package = "sha2", branch = "patch-v0.10.8" } diff --git a/examples/aggregation/programs/aggregation/elf/riscv32im-succinct-zkvm-elf b/examples/aggregation/programs/aggregation/elf/riscv32im-succinct-zkvm-elf index 3bc26ea23d..1574c0edae 100755 Binary files a/examples/aggregation/programs/aggregation/elf/riscv32im-succinct-zkvm-elf and b/examples/aggregation/programs/aggregation/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/aggregation/programs/fibonacci/Cargo.lock b/examples/aggregation/programs/fibonacci/Cargo.lock index 50211a6b73..08f43eb04d 100644 --- a/examples/aggregation/programs/fibonacci/Cargo.lock +++ b/examples/aggregation/programs/fibonacci/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", @@ -612,7 +610,6 @@ dependencies = [ [[package]] name = "sp1-precompiles" version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?rev=v1.0.0-testnet#e721b246243e40376f7b75d7330e53c7351b727f" dependencies = [ "anyhow", "bincode", @@ -629,7 +626,6 @@ dependencies = [ [[package]] name = "sp1-zkvm" version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?rev=v1.0.0-testnet#e721b246243e40376f7b75d7330e53c7351b727f" dependencies = [ "bincode", "cfg-if", diff --git a/examples/aggregation/programs/fibonacci/Cargo.toml b/examples/aggregation/programs/fibonacci/Cargo.toml index af7da6cac7..6f08cf227b 100644 --- a/examples/aggregation/programs/fibonacci/Cargo.toml +++ b/examples/aggregation/programs/fibonacci/Cargo.toml @@ -5,4 +5,4 @@ name = "fibonacci-program" edition = "2021" [dependencies] -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", rev = "v1.0.0-testnet" } \ No newline at end of file +sp1-zkvm = { path = "../../../../zkvm/entrypoint" } diff --git a/examples/aggregation/programs/fibonacci/elf/riscv32im-succinct-zkvm-elf b/examples/aggregation/programs/fibonacci/elf/riscv32im-succinct-zkvm-elf index dea6e45e07..0170fd08b9 100755 Binary files a/examples/aggregation/programs/fibonacci/elf/riscv32im-succinct-zkvm-elf and b/examples/aggregation/programs/fibonacci/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/aggregation/script/Cargo.toml b/examples/aggregation/script/Cargo.toml index edd7eddec0..7f28d4c105 100644 --- a/examples/aggregation/script/Cargo.toml +++ b/examples/aggregation/script/Cargo.toml @@ -6,8 +6,8 @@ default-run = "sp1-aggregation-example-script" [dependencies] hex = "0.4.3" -sp1-sdk = { path = "../../../sdk" } +sp1-sdk = { path = "../../../sdk", features = ["plonk"] } tracing = "0.1.40" [build-dependencies] -sp1-helper = { path = "../../../helper" } \ No newline at end of file +sp1-helper = { path = "../../../helper" } diff --git a/examples/aggregation/script/src/main.rs b/examples/aggregation/script/src/main.rs index 7f48d90ed1..2520343431 100644 --- a/examples/aggregation/script/src/main.rs +++ b/examples/aggregation/script/src/main.rs @@ -11,7 +11,7 @@ const FIBONACCI_ELF: &[u8] = include_bytes!("../../programs/fibonacci/elf/riscv32im-succinct-zkvm-elf"); /// An input to the aggregation program. -/// +/// /// Consists of a proof and a verification key. struct AggregationInput { pub proof: SP1CompressedProof, @@ -93,9 +93,9 @@ fn main() { stdin.write_proof(input.proof.proof, input.vk.vk); } - // Generate the groth16 proof. + // Generate the plonk bn254 proof. client - .prove_groth16(&aggregation_pk, stdin) + .prove_plonk(&aggregation_pk, stdin) .expect("proving failed"); - }); + }); } diff --git a/examples/chess/program/Cargo.toml b/examples/chess/program/Cargo.toml index 9e5e95c3bc..fe588f0185 100644 --- a/examples/chess/program/Cargo.toml +++ b/examples/chess/program/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] chess = "3.2.0" -sp1-zkvm = { path = "../../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../../zkvm/entrypoint" } diff --git a/examples/chess/program/elf/riscv32im-succinct-zkvm-elf b/examples/chess/program/elf/riscv32im-succinct-zkvm-elf index 9484a6e6ef..6c501c33cd 100755 Binary files a/examples/chess/program/elf/riscv32im-succinct-zkvm-elf and b/examples/chess/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/cycle-tracking/program/Cargo.toml b/examples/cycle-tracking/program/Cargo.toml index b002de02b3..d00b69640c 100644 --- a/examples/cycle-tracking/program/Cargo.toml +++ b/examples/cycle-tracking/program/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../../zkvm/entrypoint" } -sp1-derive = { path = "../../../derive" } \ No newline at end of file +sp1-derive = { path = "../../../derive" } diff --git a/examples/cycle-tracking/program/elf/riscv32im-succinct-zkvm-elf b/examples/cycle-tracking/program/elf/riscv32im-succinct-zkvm-elf index 0b1f4f4972..494c24675c 100755 Binary files a/examples/cycle-tracking/program/elf/riscv32im-succinct-zkvm-elf and b/examples/cycle-tracking/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/fibonacci/program/Cargo.toml b/examples/fibonacci/program/Cargo.toml index 6b3514197b..7d92da05d9 100644 --- a/examples/fibonacci/program/Cargo.toml +++ b/examples/fibonacci/program/Cargo.toml @@ -5,4 +5,4 @@ name = "fibonacci-program" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../../zkvm/entrypoint" } diff --git a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf b/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf index 10b446cae3..6d448181ef 100755 Binary files a/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf and b/examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/fibonacci/script/Cargo.toml b/examples/fibonacci/script/Cargo.toml index 996d5d32cd..5d8bfb0c8b 100644 --- a/examples/fibonacci/script/Cargo.toml +++ b/examples/fibonacci/script/Cargo.toml @@ -13,8 +13,8 @@ sha2 = "0.10.8" sp1-helper = { path = "../../../helper" } [[bin]] -name = "groth16" -path = "bin/groth16.rs" +name = "plonk_bn254" +path = "bin/plonk_bn254.rs" [[bin]] name = "compressed" @@ -26,4 +26,4 @@ path = "bin/execute.rs" [[bin]] name = "fibonacci-script" -path = "src/main.rs" \ No newline at end of file +path = "src/main.rs" diff --git a/examples/fibonacci/script/bin/groth16.rs b/examples/fibonacci/script/bin/plonk_bn254.rs similarity index 91% rename from examples/fibonacci/script/bin/groth16.rs rename to examples/fibonacci/script/bin/plonk_bn254.rs index d7fb5f9486..7057f20fab 100644 --- a/examples/fibonacci/script/bin/groth16.rs +++ b/examples/fibonacci/script/bin/plonk_bn254.rs @@ -16,7 +16,7 @@ fn main() { // Generate the proof for the given program and input. let client = ProverClient::new(); let (pk, vk) = client.setup(ELF); - let mut proof = client.prove_groth16(&pk, stdin).unwrap(); + let mut proof = client.prove_plonk(&pk, stdin).unwrap(); println!("generated proof"); @@ -29,7 +29,7 @@ fn main() { // Verify proof and public values client - .verify_groth16(&proof, &vk) + .verify_plonk(&proof, &vk) .expect("verification failed"); // Save the proof. diff --git a/examples/io/program/Cargo.toml b/examples/io/program/Cargo.toml index 06a7935a71..c85b94b968 100644 --- a/examples/io/program/Cargo.toml +++ b/examples/io/program/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../../zkvm/entrypoint" } -serde = { version = "1.0.195", features = ["derive"] } \ No newline at end of file +serde = { version = "1.0.195", features = ["derive"] } diff --git a/examples/io/program/elf/riscv32im-succinct-zkvm-elf b/examples/io/program/elf/riscv32im-succinct-zkvm-elf index 39ebb042cf..20458bce07 100755 Binary files a/examples/io/program/elf/riscv32im-succinct-zkvm-elf and b/examples/io/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/is-prime/program/Cargo.toml b/examples/is-prime/program/Cargo.toml index 25f550f2da..e4a4d11a19 100644 --- a/examples/is-prime/program/Cargo.toml +++ b/examples/is-prime/program/Cargo.toml @@ -5,4 +5,4 @@ name = "is-prime-program" edition = "2021" [dependencies] -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git" } \ No newline at end of file +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git" } diff --git a/examples/json/lib/Cargo.toml b/examples/json/lib/Cargo.toml index d85ca839f7..8ac755b6df 100644 --- a/examples/json/lib/Cargo.toml +++ b/examples/json/lib/Cargo.toml @@ -3,7 +3,5 @@ name = "lib" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] serde = "1.0.196" diff --git a/examples/json/program/elf/riscv32im-succinct-zkvm-elf b/examples/json/program/elf/riscv32im-succinct-zkvm-elf index 218af530ad..b37c99f583 100755 Binary files a/examples/json/program/elf/riscv32im-succinct-zkvm-elf and b/examples/json/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/regex/program/elf/riscv32im-succinct-zkvm-elf b/examples/regex/program/elf/riscv32im-succinct-zkvm-elf index 6fb4469f38..3cdf60299e 100755 Binary files a/examples/regex/program/elf/riscv32im-succinct-zkvm-elf and b/examples/regex/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/rsa/program/Cargo.toml b/examples/rsa/program/Cargo.toml index 2e423767b6..a9c166d789 100644 --- a/examples/rsa/program/Cargo.toml +++ b/examples/rsa/program/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" sp1-zkvm = { path = "../../../zkvm/entrypoint" } digest = "0.10.7" rand = "0.8.5" -rsa = "0.6" # Check for the latest version -sha2 = "0.9.8" # Check for the latest version +rsa = "0.6" # Check for the latest version +sha2 = "0.9.8" # Check for the latest version [patch.crates-io] # Patch sha2 so we can use sha precompiles -sha2 = { git = "https://github.com/succinctbot/RustCrypto-hashes.git", package = "sha2", branch = "v0.9.8" } \ No newline at end of file +sha2 = { git = "https://github.com/succinctbot/RustCrypto-hashes.git", package = "sha2", branch = "v0.9.8" } diff --git a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf b/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf index 4edef68abd..9ae0321c37 100755 Binary files a/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf and b/examples/rsa/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/ssz-withdrawals/program/Cargo.toml b/examples/ssz-withdrawals/program/Cargo.toml index 1c01ef3398..4ed30cec1d 100644 --- a/examples/ssz-withdrawals/program/Cargo.toml +++ b/examples/ssz-withdrawals/program/Cargo.toml @@ -17,4 +17,4 @@ sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes.git", package = [patch.crates-io] # Patch sha2 so we can use sha precompiles -sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes.git", package = "sha2", branch = "patch-v0.10.8" } \ No newline at end of file +sha2-v0-10-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes.git", package = "sha2", branch = "patch-v0.10.8" } diff --git a/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf b/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf index ef27bf0f37..ce2ba4d05c 100755 Binary files a/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf and b/examples/ssz-withdrawals/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/tendermint/program/Cargo.toml b/examples/tendermint/program/Cargo.toml index 942997b993..5ed14c87f5 100644 --- a/examples/tendermint/program/Cargo.toml +++ b/examples/tendermint/program/Cargo.toml @@ -8,8 +8,8 @@ edition = "2021" sp1-zkvm = { path = "../../../zkvm/entrypoint" } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde = { version = "1.0", default-features = false, features = ["derive"] } -tendermint-light-client-verifier = { git = "https://github.com/i-m-aditya/tendermint-rs.git", branch = "i-m-aditya/break-loop-on-having-enough-voting-power", default-features = false, features = [ - "rust-crypto", +tendermint-light-client-verifier = { git = "https://github.com/i-m-aditya/tendermint-rs.git", branch = "i-m-aditya/break-loop-on-having-enough-voting-power", default-features = false, features = [ + "rust-crypto", ] } # tendermint-light-client-verifier = { version = "0.34.0", default-features = false, features = [ # "rust-crypto", diff --git a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf b/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf index 6ecc25003e..1173f0e585 100755 Binary files a/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf and b/examples/tendermint/program/elf/riscv32im-succinct-zkvm-elf differ diff --git a/examples/tendermint/script/Cargo.toml b/examples/tendermint/script/Cargo.toml index 4c494a9562..dd43f10dbe 100644 --- a/examples/tendermint/script/Cargo.toml +++ b/examples/tendermint/script/Cargo.toml @@ -4,7 +4,7 @@ name = "tendermint-script" edition = "2021" [dependencies] -sp1-core = { path = "../../../core", features = ["neon"] } +sp1-core = { path = "../../../core", features = ["neon"] } sp1-sdk = { path = "../../../sdk" } reqwest = { version = "0.11", features = ["json"] } tokio = { version = "1", features = ["full"] } @@ -12,7 +12,7 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde = { version = "1.0", default-features = false, features = ["derive"] } tendermint = { version = "0.34.0", default-features = false } tendermint-light-client-verifier = { version = "0.34.0", default-features = false, features = [ - "rust-crypto", + "rust-crypto", ] } bincode = "1.3.3" itertools = "0.12.1" diff --git a/helper/Cargo.toml b/helper/Cargo.toml index 169cf9bf1b..1c03ce433f 100644 --- a/helper/Cargo.toml +++ b/helper/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-helper" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] cargo_metadata = "0.18.1" chrono = { version = "0.4.38", default-features = false, features = ["clock"] } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 6c629b9985..1f48703fb2 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-primitives" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] lazy_static = "1.4.0" p3-field = { workspace = true } diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 9c2e8b03a2..fb10228f5d 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-prover" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] sp1-recursion-program = { path = "../recursion/program" } sp1-recursion-circuit = { path = "../recursion/circuit" } @@ -25,7 +23,6 @@ rayon = "1.10.0" itertools = "0.12.1" tracing = "0.1.40" tracing-subscriber = "0.3.18" -tracing-appender = "0.2.3" serde_json = "1.0.117" clap = { version = "4.5.4", features = ["derive", "env"] } sha2 = "0.10.8" @@ -36,9 +33,9 @@ dirs = "5.0.1" tempfile = "3.10.1" tokio = { version = "1.37.0", features = ["full"] } reqwest = { version = "0.12.4", features = [ - "rustls-tls", - "trust-dns", - "stream", + "rustls-tls", + "trust-dns", + "stream", ] } indicatif = "0.17.8" futures = "0.3.30" @@ -48,12 +45,15 @@ num-bigint = "0.4.5" thiserror = "1.0.60" [[bin]] -name = "build_groth16" -path = "scripts/build_groth16.rs" +name = "build_plonk_bn254" +path = "scripts/build_plonk_bn254.rs" [[bin]] name = "e2e" path = "scripts/e2e.rs" [features] +default = ["plonk"] + neon = ["sp1-core/neon"] +plonk = ["sp1-recursion-gnark-ffi/plonk"] diff --git a/prover/Makefile b/prover/Makefile index 249cbce283..bc3ad6ef61 100644 --- a/prover/Makefile +++ b/prover/Makefile @@ -1,37 +1,17 @@ all: - make fibonacci-sweep - make tendermint-sweep - make fibonacci-groth16 + make build-plonk-bn254 + make release-plonk-bn254 -build-groth16: +build-plonk-bn254: + rm -rf build && \ mkdir -p build && \ RUSTFLAGS='-C target-cpu=native' \ - cargo run -p sp1-prover --release --bin build_groth16 -- \ + cargo run -p sp1-prover --release --bin build_plonk_bn254 -- \ --build-dir=./build -release-groth16: +release-plonk-bn254: bash release.sh test-e2e: RUSTFLAGS='-C target-cpu=native' \ - cargo test --package sp1-prover --lib --release -- tests::test_e2e --exact --show-output - -fibonacci-sweep: - mkdir -p scripts/results && \ - rm -f scripts/results/fibonacci_sweep.log && \ - RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \ - RUST_LOG=info \ - cargo run --package sp1-prover --release --bin fibonacci_sweep - -tendermint-sweep: - mkdir -p scripts/results && \ - rm -f scripts/results/tendermint_sweep.log && \ - RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \ - RUST_LOG=info \ - cargo run --package sp1-prover --release --bin tendermint_sweep - -fibonacci-groth16: - mkdir -p scripts/results && \ - RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \ - RUST_LOG=info \ - cargo run --package sp1-prover --release --bin fibonacci_groth16 + cargo test --package sp1-prover --lib --release -- tests::test_e2e --exact --show-output \ No newline at end of file diff --git a/prover/release.sh b/prover/release.sh index 1cf390ee96..0d8601c067 100644 --- a/prover/release.sh +++ b/prover/release.sh @@ -21,7 +21,7 @@ fi # Create archive named after the commit hash ARCHIVE_NAME="${COMMIT_HASH}.tar.gz" cd $FILE_TO_UPLOAD -tar -czvf "../$ARCHIVE_NAME" . +tar --exclude='srs.bin' --exclude='srs_lagrange.bin' -czvf "../$ARCHIVE_NAME" . cd - if [ $? -ne 0 ]; then echo "Failed to create archive." diff --git a/prover/scripts/build_groth16.rs b/prover/scripts/build_plonk_bn254.rs similarity index 74% rename from prover/scripts/build_groth16.rs rename to prover/scripts/build_plonk_bn254.rs index b95771e117..66ccb229d3 100644 --- a/prover/scripts/build_groth16.rs +++ b/prover/scripts/build_plonk_bn254.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; use clap::Parser; use sp1_core::utils::setup_logger; -use sp1_prover::build::build_groth16_artifacts_with_dummy; +use sp1_prover::build::build_plonk_bn254_artifacts_with_dummy; #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] @@ -17,5 +17,5 @@ struct Args { pub fn main() { setup_logger(); let args = Args::parse(); - build_groth16_artifacts_with_dummy(args.build_dir); + build_plonk_bn254_artifacts_with_dummy(args.build_dir); } diff --git a/prover/scripts/e2e.rs b/prover/scripts/e2e.rs index dfae892795..c4833f2202 100644 --- a/prover/scripts/e2e.rs +++ b/prover/scripts/e2e.rs @@ -14,7 +14,7 @@ use sp1_recursion_circuit::stark::build_wrap_circuit; use sp1_recursion_circuit::witness::Witnessable; use sp1_recursion_compiler::ir::Witness; use sp1_recursion_core::air::RecursionPublicValues; -use sp1_recursion_gnark_ffi::Groth16Prover; +use sp1_recursion_gnark_ffi::PlonkBn254Prover; use subtle_encoding::hex; #[derive(Parser, Debug)] @@ -70,19 +70,19 @@ pub fn main() { witness.write_vkey_hash(vkey_hash); tracing::info!("sanity check gnark test"); - Groth16Prover::test(constraints.clone(), witness.clone()); + PlonkBn254Prover::test(constraints.clone(), witness.clone()); tracing::info!("sanity check gnark build"); - Groth16Prover::build(constraints.clone(), witness.clone(), build_dir.clone()); + PlonkBn254Prover::build(constraints.clone(), witness.clone(), build_dir.clone()); tracing::info!("sanity check gnark prove"); - let groth16_prover = Groth16Prover::new(); + let plonk_bn254_prover = PlonkBn254Prover::new(); tracing::info!("gnark prove"); - let proof = groth16_prover.prove(witness.clone(), build_dir.clone()); + let proof = plonk_bn254_prover.prove(witness.clone(), build_dir.clone()); tracing::info!("verify gnark proof"); - groth16_prover.verify( + plonk_bn254_prover.verify( &proof, &vkey_hash.as_canonical_biguint(), &committed_values_digest.as_canonical_biguint(), diff --git a/prover/scripts/fibonacci_groth16.rs b/prover/scripts/fibonacci_groth16.rs index 2a5fc88d8a..a17b37bb8f 100644 --- a/prover/scripts/fibonacci_groth16.rs +++ b/prover/scripts/fibonacci_groth16.rs @@ -1,4 +1,4 @@ -//! Tests end-to-end performance of wrapping a recursion proof to Groth16. +//! Tests end-to-end performance of wrapping a recursion proof to PLONK. #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/prover/src/build.rs b/prover/src/build.rs index 8aad92a8d7..129ec454a8 100644 --- a/prover/src/build.rs +++ b/prover/src/build.rs @@ -10,66 +10,69 @@ pub use sp1_recursion_compiler::ir::Witness; use sp1_recursion_compiler::{config::OuterConfig, constraints::Constraint}; use sp1_recursion_core::air::RecursionPublicValues; pub use sp1_recursion_core::stark::utils::sp1_dev_mode; -use sp1_recursion_gnark_ffi::Groth16Prover; +use sp1_recursion_gnark_ffi::PlonkBn254Prover; -use crate::install::{install_groth16_artifacts, GROTH16_ARTIFACTS_COMMIT}; +use crate::install::{install_plonk_bn254_artifacts, PLONK_BN254_ARTIFACTS_COMMIT}; use crate::utils::{babybear_bytes_to_bn254, babybears_to_bn254, words_to_bytes}; use crate::{OuterSC, SP1Prover}; -/// Tries to install the Groth16 artifacts if they are not already installed. -pub fn try_install_groth16_artifacts() -> PathBuf { - let build_dir = groth16_artifacts_dir(); +/// Tries to install the PLONK artifacts if they are not already installed. +pub fn try_install_plonk_bn254_artifacts() -> PathBuf { + let build_dir = plonk_bn254_artifacts_dir(); if build_dir.exists() { - println!("[sp1] groth16 artifacts already seem to exist at {}. if you want to re-download them, delete the directory", build_dir.display()); + println!( + "[sp1] plonk bn254 artifacts already seem to exist at {}. if you want to re-download them, delete the directory", + build_dir.display() + ); } else { println!( - "[sp1] groth16 artifacts for commit {} do not exist at {}. downloading...", - GROTH16_ARTIFACTS_COMMIT, + "[sp1] plonk bn254 artifacts for commit {} do not exist at {}. downloading...", + PLONK_BN254_ARTIFACTS_COMMIT, build_dir.display() ); - install_groth16_artifacts(build_dir.clone()); + install_plonk_bn254_artifacts(build_dir.clone()); } build_dir } -/// Tries to build the Groth16 artifacts inside the development directory. +/// Tries to build the PLONK artifacts inside the development directory. /// /// TODO: Maybe add some additional logic here to handle rebuilding the artifacts if they are /// already built. -pub fn try_build_groth16_artifacts_dev( +pub fn try_build_plonk_bn254_artifacts_dev( template_vk: &StarkVerifyingKey, template_proof: &ShardProof, ) -> PathBuf { - let build_dir = groth16_artifacts_dev_dir(); - println!("[sp1] building groth16 artifacts in development mode"); - build_groth16_artifacts(template_vk, template_proof, &build_dir); + let build_dir = plonk_bn254_artifacts_dev_dir(); + println!("[sp1] building plonk bn254 artifacts in development mode"); + build_plonk_bn254_artifacts(template_vk, template_proof, &build_dir); build_dir } -/// Gets the directory where the Groth16 artifacts are installed. -pub fn groth16_artifacts_dir() -> PathBuf { +/// Gets the directory where the PLONK artifacts are installed. +fn plonk_bn254_artifacts_dir() -> PathBuf { dirs::home_dir() .unwrap() .join(".sp1") .join("circuits") - .join("groth16") - .join(GROTH16_ARTIFACTS_COMMIT) + .join("plonk_bn254") + .join(PLONK_BN254_ARTIFACTS_COMMIT) } -/// Gets the directory where the Groth16 artifacts are installed in development mode. -pub fn groth16_artifacts_dev_dir() -> PathBuf { +/// Gets the directory where the PLONK artifacts are installed in development mode. +pub fn plonk_bn254_artifacts_dev_dir() -> PathBuf { dirs::home_dir() .unwrap() .join(".sp1") .join("circuits") - .join("groth16") + .join("plonk_bn254") .join("dev") } -/// Build the groth16 artifacts to the given directory for the given verification key and template +/// Build the plonk bn254 artifacts to the given directory for the given verification key and template /// proof. -pub fn build_groth16_artifacts( +pub fn build_plonk_bn254_artifacts( template_vk: &StarkVerifyingKey, template_proof: &ShardProof, build_dir: impl Into, @@ -77,16 +80,16 @@ pub fn build_groth16_artifacts( let build_dir = build_dir.into(); std::fs::create_dir_all(&build_dir).expect("failed to create build directory"); let (constraints, witness) = build_constraints_and_witness(template_vk, template_proof); - Groth16Prover::build(constraints, witness, build_dir); + PlonkBn254Prover::build(constraints, witness, build_dir); } -/// Builds the groth16 artifacts to the given directory. +/// Builds the plonk bn254 artifacts to the given directory. /// /// This may take a while as it needs to first generate a dummy proof and then it needs to compile /// the circuit. -pub fn build_groth16_artifacts_with_dummy(build_dir: impl Into) { +pub fn build_plonk_bn254_artifacts_with_dummy(build_dir: impl Into) { let (wrap_vk, wrapped_proof) = dummy_proof(); - crate::build::build_groth16_artifacts(&wrap_vk, &wrapped_proof, build_dir.into()); + crate::build::build_plonk_bn254_artifacts(&wrap_vk, &wrapped_proof, build_dir.into()); } /// Build the verifier constraints and template witness for the circuit. diff --git a/prover/src/install.rs b/prover/src/install.rs index bf271ce4ae..cb4d08f168 100644 --- a/prover/src/install.rs +++ b/prover/src/install.rs @@ -6,24 +6,24 @@ use reqwest::Client; use crate::utils::block_on; -/// The base URL for the S3 bucket containing the groth16 artifacts. -pub const GROTH16_ARTIFACTS_URL_BASE: &str = "https://sp1-circuits.s3-us-east-2.amazonaws.com"; +/// The base URL for the S3 bucket containing the plonk bn254 artifacts. +pub const PLONK_BN254_ARTIFACTS_URL_BASE: &str = "https://sp1-circuits.s3-us-east-2.amazonaws.com"; -/// The current version of the groth16 artifacts. -pub const GROTH16_ARTIFACTS_COMMIT: &str = "9f43e920"; +/// The current version of the plonk bn254 artifacts. +pub const PLONK_BN254_ARTIFACTS_COMMIT: &str = "57ad9e7d"; -/// Install the latest groth16 artifacts. +/// Install the latest plonk bn254 artifacts. /// -/// This function will download the latest groth16 artifacts from the S3 bucket and extract them to -/// the directory specified by [groth16_artifacts_dir()]. -pub fn install_groth16_artifacts(build_dir: PathBuf) { +/// This function will download the latest plonk bn254 artifacts from the S3 bucket and extract them to +/// the directory specified by [plonk_bn254_artifacts_dir()]. +pub fn install_plonk_bn254_artifacts(build_dir: PathBuf) { // Create the build directory. std::fs::create_dir_all(&build_dir).expect("failed to create build directory"); // Download the artifacts. let download_url = format!( "{}/{}.tar.gz", - GROTH16_ARTIFACTS_URL_BASE, GROTH16_ARTIFACTS_COMMIT + PLONK_BN254_ARTIFACTS_URL_BASE, PLONK_BN254_ARTIFACTS_COMMIT ); let mut artifacts_tar_gz_file = tempfile::NamedTempFile::new().expect("failed to create tempfile"); @@ -56,14 +56,14 @@ pub fn install_groth16_artifacts(build_dir: PathBuf) { ); } -/// The directory where the groth16 artifacts will be stored based on [GROTH16_ARTIFACTS_VERSION] -/// and [GROTH16_ARTIFACTS_URL_BASE]. -pub fn install_groth16_artifacts_dir() -> PathBuf { +/// The directory where the plonk bn254 artifacts will be stored based on [PLONK_BN254_ARTIFACTS_VERSION] +/// and [PLONK_BN254_ARTIFACTS_URL_BASE]. +pub fn install_plonk_bn254_artifacts_dir() -> PathBuf { dirs::home_dir() .unwrap() .join(".sp1") .join("circuits") - .join(GROTH16_ARTIFACTS_COMMIT) + .join(PLONK_BN254_ARTIFACTS_COMMIT) } /// Download the file with a progress bar that indicates the progress. diff --git a/prover/src/lib.rs b/prover/src/lib.rs index eabd8270ef..22111fbbd6 100644 --- a/prover/src/lib.rs +++ b/prover/src/lib.rs @@ -5,7 +5,7 @@ //! 1. Generate shard proofs which split up and prove the valid execution of a RISC-V program. //! 2. Compress shard proofs into a single shard proof. //! 3. Wrap the shard proof into a SNARK-friendly field. -//! 4. Wrap the last shard proof, proven over the SNARK-friendly field, into a Groth16/PLONK proof. +//! 4. Wrap the last shard proof, proven over the SNARK-friendly field, into a PLONK proof. #![allow(incomplete_features)] #![feature(generic_const_exprs)] @@ -19,10 +19,8 @@ pub mod utils; pub mod verify; use std::borrow::Borrow; -use std::env; -use std::path::{Path, PathBuf}; +use std::path::Path; -use crate::utils::RECONSTRUCT_COMMITMENTS_ENV_VAR; use p3_baby_bear::BabyBear; use p3_challenger::CanObserve; use p3_field::{AbstractField, PrimeField}; @@ -33,7 +31,7 @@ pub use sp1_core::io::{SP1PublicValues, SP1Stdin}; use sp1_core::runtime::{ExecutionError, Runtime}; use sp1_core::stark::{Challenge, StarkProvingKey}; use sp1_core::stark::{Challenger, MachineVerificationError}; -use sp1_core::utils::DIGEST_SIZE; +use sp1_core::utils::{SP1CoreOpts, DIGEST_SIZE}; use sp1_core::{ runtime::Program, stark::{ @@ -52,8 +50,6 @@ use sp1_recursion_core::{ }; pub use sp1_recursion_gnark_ffi::plonk_bn254::PlonkBn254Proof; use sp1_recursion_gnark_ffi::plonk_bn254::PlonkBn254Prover; -pub use sp1_recursion_gnark_ffi::Groth16Proof; -use sp1_recursion_gnark_ffi::Groth16Prover; use sp1_recursion_program::hints::Hintable; pub use sp1_recursion_program::machine::ReduceProgramType; use sp1_recursion_program::machine::{ @@ -77,7 +73,7 @@ pub type OuterSC = BabyBearPoseidon2Outer; const REDUCE_DEGREE: usize = 3; const COMPRESS_DEGREE: usize = 9; -const WRAP_DEGREE: usize = 5; +const WRAP_DEGREE: usize = 9; pub type ReduceAir = RecursionAir; pub type CompressAir = RecursionAir; @@ -145,7 +141,7 @@ pub struct SP1Prover { impl SP1Prover { /// Initializes a new [SP1Prover]. - #[instrument(name = "initialize prover", level = "info", skip_all)] + #[instrument(name = "initialize prover", level = "debug", skip_all)] pub fn new() -> Self { let core_machine = RiscvAir::machine(CoreSC::default()); @@ -169,7 +165,7 @@ impl SP1Prover { // Get the compress program, machine, and keys. let shrink_program = SP1RootVerifier::::build(&compress_machine, &compress_vk, true); - let shrink_machine = CompressAir::machine(InnerSC::compressed()); + let shrink_machine = CompressAir::wrap_machine_dyn(InnerSC::compressed()); let (shrink_pk, shrink_vk) = shrink_machine.setup(&shrink_program); // Get the wrap program, machine, and keys. @@ -202,7 +198,7 @@ impl SP1Prover { } /// Creates a proving key and a verifying key for a given RISC-V ELF. - #[instrument(name = "setup", level = "info", skip_all)] + #[instrument(name = "setup", level = "debug", skip_all)] pub fn setup(&self, elf: &[u8]) -> (SP1ProvingKey, SP1VerifyingKey) { let program = Program::from(elf); let (pk, vk) = self.core_machine.setup(&program); @@ -219,7 +215,8 @@ impl SP1Prover { #[instrument(name = "execute", level = "info", skip_all)] pub fn execute(elf: &[u8], stdin: &SP1Stdin) -> Result { let program = Program::from(elf); - let mut runtime = Runtime::new(program); + let opts = SP1CoreOpts::default(); + let mut runtime = Runtime::new(program, opts); runtime.write_vecs(&stdin.buffer); for (proof, vkey) in stdin.proofs.iter() { runtime.write_proof(proof.clone(), vkey.clone()); @@ -238,7 +235,8 @@ impl SP1Prover { ) -> Result { let config = CoreSC::default(); let program = Program::from(&pk.elf); - let (proof, public_values_stream) = sp1_core::utils::prove(program, stdin, config)?; + let opts = SP1CoreOpts::default(); + let (proof, public_values_stream) = sp1_core::utils::prove(program, stdin, config, opts)?; let public_values = SP1PublicValues::from(&public_values_stream); Ok(SP1CoreProof { proof: SP1CoreProofData(proof.shard_proofs), @@ -383,15 +381,7 @@ impl SP1Prover { leaf_challenger.observe_slice(&proof.public_values[0..self.core_machine.num_pv_elts()]); }); - // Setup the reconstruct commitments flags to false and save its state. - let rc = env::var(RECONSTRUCT_COMMITMENTS_ENV_VAR).unwrap_or_default(); - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, "false"); - // Run the recursion and reduce programs. - - // Run the recursion programs. - let mut records = Vec::new(); - let (core_inputs, deferred_inputs) = self.get_first_layer_inputs( vk, &leaf_challenger, @@ -400,62 +390,74 @@ impl SP1Prover { batch_size, ); - for input in core_inputs { - let mut runtime = RecursionRuntime::, Challenge, _>::new( - &self.recursion_program, - self.compress_machine.config().perm.clone(), - ); - - let mut witness_stream = Vec::new(); - witness_stream.extend(input.write()); - - runtime.witness_stream = witness_stream.into(); - runtime.run(); - runtime.print_stats(); + let mut first_layer_proofs = Vec::new(); + let opts = SP1CoreOpts::recursion(); + let shard_batch_size = opts.shard_batch_size; + for inputs in core_inputs.chunks(shard_batch_size) { + let proofs = inputs + .into_par_iter() + .map(|input| { + let mut runtime = RecursionRuntime::, Challenge, _>::new( + &self.recursion_program, + self.compress_machine.config().perm.clone(), + ); - records.push((runtime.record, ReduceProgramType::Core)); + let mut witness_stream = Vec::new(); + witness_stream.extend(input.write()); + + runtime.witness_stream = witness_stream.into(); + runtime.run(); + runtime.print_stats(); + + let pk = &self.rec_pk; + let mut recursive_challenger = self.compress_machine.config().challenger(); + ( + self.compress_machine.prove::>( + pk, + runtime.record, + &mut recursive_challenger, + opts, + ), + ReduceProgramType::Core, + ) + }) + .collect::>(); + first_layer_proofs.extend(proofs); } // Run the deferred proofs programs. - for input in deferred_inputs { - let mut runtime = RecursionRuntime::, Challenge, _>::new( - &self.deferred_program, - self.compress_machine.config().perm.clone(), - ); - - let mut witness_stream = Vec::new(); - witness_stream.extend(input.write()); - - runtime.witness_stream = witness_stream.into(); - runtime.run(); - runtime.print_stats(); + for inputs in deferred_inputs.chunks(shard_batch_size) { + let proofs = inputs + .into_par_iter() + .map(|input| { + let mut runtime = RecursionRuntime::, Challenge, _>::new( + &self.deferred_program, + self.compress_machine.config().perm.clone(), + ); - records.push((runtime.record, ReduceProgramType::Deferred)); + let mut witness_stream = Vec::new(); + witness_stream.extend(input.write()); + + runtime.witness_stream = witness_stream.into(); + runtime.run(); + runtime.print_stats(); + + let pk = &self.deferred_pk; + let mut recursive_challenger = self.compress_machine.config().challenger(); + ( + self.compress_machine.prove::>( + pk, + runtime.record, + &mut recursive_challenger, + opts, + ), + ReduceProgramType::Deferred, + ) + }) + .collect::>(); + first_layer_proofs.extend(proofs); } - // Prove all recursion programs and recursion deferred programs and verify the proofs. - - // Make the recursive proofs for core and deferred proofs. - let first_layer_proofs = records - .into_par_iter() - .map(|(record, kind)| { - let pk = match kind { - ReduceProgramType::Core => &self.rec_pk, - ReduceProgramType::Deferred => &self.deferred_pk, - ReduceProgramType::Reduce => unreachable!(), - }; - let mut recursive_challenger = self.compress_machine.config().challenger(); - ( - self.compress_machine.prove::>( - pk, - record, - &mut recursive_challenger, - ), - kind, - ) - }) - .collect::>(); - // Chain all the individual shard proofs. let mut reduce_proofs = first_layer_proofs .into_iter() @@ -467,28 +469,37 @@ impl SP1Prover { loop { tracing::debug!("Recursive proof layer size: {}", reduce_proofs.len()); is_complete = reduce_proofs.len() <= batch_size; - reduce_proofs = reduce_proofs - .par_chunks(batch_size) - .map(|batch| { - let (shard_proofs, kinds) = - batch.iter().cloned().unzip::<_, _, Vec<_>, Vec<_>>(); - - let input = SP1ReduceMemoryLayout { - compress_vk: &self.compress_vk, - recursive_machine: &self.compress_machine, - shard_proofs, - kinds, - is_complete, - }; - - let proof = self.compress_machine_proof( - input, - &self.compress_program, - &self.compress_pk, - ); - (proof, ReduceProgramType::Reduce) + + let compress_inputs = reduce_proofs.chunks(batch_size).collect::>(); + let batched_compress_inputs = + compress_inputs.chunks(shard_batch_size).collect::>(); + reduce_proofs = batched_compress_inputs + .into_iter() + .flat_map(|batches| { + batches + .par_iter() + .map(|batch| { + let (shard_proofs, kinds) = + batch.iter().cloned().unzip::<_, _, Vec<_>, Vec<_>>(); + + let input = SP1ReduceMemoryLayout { + compress_vk: &self.compress_vk, + recursive_machine: &self.compress_machine, + shard_proofs, + kinds, + is_complete, + }; + + let proof = self.compress_machine_proof( + input, + &self.compress_program, + &self.compress_pk, + ); + (proof, ReduceProgramType::Reduce) + }) + .collect::>() }) - .collect(); + .collect::>(); if reduce_proofs.len() == 1 { break; @@ -497,9 +508,6 @@ impl SP1Prover { debug_assert_eq!(reduce_proofs.len(), 1); let reduce_proof = reduce_proofs.pop().unwrap(); - // Restore the prover parameters. - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, rc); - Ok(SP1ReduceProof { proof: reduce_proof.0, }) @@ -523,9 +531,10 @@ impl SP1Prover { runtime.run(); runtime.print_stats(); + let opts = SP1CoreOpts::recursion(); let mut recursive_challenger = self.compress_machine.config().challenger(); self.compress_machine - .prove::>(pk, runtime.record, &mut recursive_challenger) + .prove::>(pk, runtime.record, &mut recursive_challenger, opts) .shard_proofs .pop() .unwrap() @@ -537,10 +546,6 @@ impl SP1Prover { &self, reduced_proof: SP1ReduceProof, ) -> Result, SP1RecursionProverError> { - // Setup the prover parameters. - let rc = env::var(RECONSTRUCT_COMMITMENTS_ENV_VAR).unwrap_or_default(); - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, "false"); - // Make the compress proof. let input = SP1RootMemoryLayout { machine: &self.compress_machine, @@ -563,16 +568,15 @@ impl SP1Prover { tracing::debug!("Compress program executed successfully"); // Prove the compress program. + let opts = SP1CoreOpts::recursion(); let mut compress_challenger = self.shrink_machine.config().challenger(); let mut compress_proof = self.shrink_machine.prove::>( &self.shrink_pk, runtime.record, &mut compress_challenger, + opts, ); - // Restore the prover parameters. - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, rc); - Ok(SP1ReduceProof { proof: compress_proof.shard_proofs.pop().unwrap(), }) @@ -584,10 +588,6 @@ impl SP1Prover { &self, compressed_proof: SP1ReduceProof, ) -> Result, SP1RecursionProverError> { - // Setup the prover parameters. - let rc = env::var(RECONSTRUCT_COMMITMENTS_ENV_VAR).unwrap_or_default(); - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, "false"); - let input = SP1RootMemoryLayout { machine: &self.shrink_machine, proof: compressed_proof.proof, @@ -609,12 +609,14 @@ impl SP1Prover { tracing::debug!("Wrap program executed successfully"); // Prove the wrap program. + let opts = SP1CoreOpts::recursion(); let mut wrap_challenger = self.wrap_machine.config().challenger(); let time = std::time::Instant::now(); let mut wrap_proof = self.wrap_machine.prove::>( &self.wrap_pk, runtime.record, &mut wrap_challenger, + opts, ); let elapsed = time.elapsed(); tracing::debug!("Wrap proving time: {:?}", elapsed); @@ -631,17 +633,18 @@ impl SP1Prover { } tracing::info!("Wrapping successful"); - // Restore the prover parameters. - env::set_var(RECONSTRUCT_COMMITMENTS_ENV_VAR, rc); - Ok(SP1ReduceProof { proof: wrap_proof.shard_proofs.pop().unwrap(), }) } - /// Wrap the STARK proven over a SNARK-friendly field into a Groth16 proof. - #[instrument(name = "wrap_groth16", level = "info", skip_all)] - pub fn wrap_groth16(&self, proof: SP1ReduceProof, build_dir: &Path) -> Groth16Proof { + /// Wrap the STARK proven over a SNARK-friendly field into a PLONK proof. + #[instrument(name = "wrap_plonk_bn254", level = "info", skip_all)] + pub fn wrap_plonk_bn254( + &self, + proof: SP1ReduceProof, + build_dir: &Path, + ) -> PlonkBn254Proof { let vkey_digest = proof.sp1_vkey_digest_bn254(); let commited_values_digest = proof.sp1_commited_values_digest_bn254(); @@ -650,7 +653,7 @@ impl SP1Prover { witness.write_commited_values_digest(commited_values_digest); witness.write_vkey_hash(vkey_digest); - let prover = Groth16Prover::new(); + let prover = PlonkBn254Prover::new(); let proof = prover.prove(witness, build_dir.to_path_buf()); // Verify the proof. @@ -664,13 +667,6 @@ impl SP1Prover { proof } - pub fn wrap_plonk(&self, proof: ShardProof, build_dir: PathBuf) -> PlonkBn254Proof { - let mut witness = Witness::default(); - proof.write(&mut witness); - // TODO: write pv and vkey into witness - PlonkBn254Prover::prove(witness, build_dir) - } - /// Accumulate deferred proofs into a single digest. pub fn hash_deferred_proofs( prev_digest: [Val; DIGEST_SIZE], @@ -696,7 +692,7 @@ mod tests { use std::fs::File; use std::io::{Read, Write}; - use self::build::try_build_groth16_artifacts_dev; + use self::build::try_build_plonk_bn254_artifacts_dev; use super::*; use anyhow::Result; @@ -709,7 +705,7 @@ mod tests { /// pipeline. /// /// Add `FRI_QUERIES`=1 to your environment for faster execution. Should only take a few minutes - /// on a Mac M2. Note: This test always re-builds the groth16 artifacts, so setting SP1_DEV is + /// on a Mac M2. Note: This test always re-builds the plonk bn254 artifacts, so setting SP1_DEV is /// not needed. #[test] #[serial] @@ -769,13 +765,13 @@ mod tests { let vk_digest_bn254 = wrapped_bn254_proof.sp1_vkey_digest_bn254(); assert_eq!(vk_digest_bn254, vk.hash_bn254()); - tracing::info!("generate groth16 proof"); + tracing::info!("generate plonk bn254 proof"); let artifacts_dir = - try_build_groth16_artifacts_dev(&prover.wrap_vk, &wrapped_bn254_proof.proof); - let groth16_proof = prover.wrap_groth16(wrapped_bn254_proof, &artifacts_dir); - println!("{:?}", groth16_proof); + try_build_plonk_bn254_artifacts_dev(&prover.wrap_vk, &wrapped_bn254_proof.proof); + let plonk_bn254_proof = prover.wrap_plonk_bn254(wrapped_bn254_proof, &artifacts_dir); + println!("{:?}", plonk_bn254_proof); - prover.verify_groth16(&groth16_proof, &vk, &public_values, &artifacts_dir)?; + prover.verify_plonk_bn254(&plonk_bn254_proof, &vk, &public_values, &artifacts_dir)?; Ok(()) } diff --git a/prover/src/types.rs b/prover/src/types.rs index 198dc62660..d00f021e63 100644 --- a/prover/src/types.rs +++ b/prover/src/types.rs @@ -15,7 +15,7 @@ use sp1_core::{ }; use sp1_primitives::poseidon2_hash; use sp1_recursion_core::{air::RecursionPublicValues, stark::config::BabyBearPoseidon2Outer}; -use sp1_recursion_gnark_ffi::{plonk_bn254::PlonkBn254Proof, Groth16Proof}; +use sp1_recursion_gnark_ffi::plonk_bn254::PlonkBn254Proof; use thiserror::Error; use crate::utils::words_to_bytes_be; @@ -143,10 +143,10 @@ pub type SP1CoreProof = SP1ProofWithMetadata; /// within SP1 programs. pub type SP1ReducedProof = SP1ProofWithMetadata; -/// An SP1 proof that has been wrapped into a single Groth16 proof and can be verified onchain. -pub type SP1Groth16Proof = SP1ProofWithMetadata; +/// An SP1 proof that has been wrapped into a single PLONK proof and can be verified onchain. +pub type SP1PlonkBn254Proof = SP1ProofWithMetadata; -/// An SP1 proof that has been wrapped into a single Plonk proof and can be verified onchain. +/// An SP1 proof that has been wrapped into a single PLONK proof and can be verified onchain. pub type SP1PlonkProof = SP1ProofWithMetadata; #[derive(Serialize, Deserialize, Clone)] @@ -155,7 +155,7 @@ pub struct SP1CoreProofData(pub Vec>); pub struct SP1ReducedProofData(pub ShardProof); #[derive(Serialize, Deserialize, Clone)] -pub struct SP1Groth16ProofData(pub Groth16Proof); +pub struct SP1PlonkBn254ProofData(pub PlonkBn254Proof); #[derive(Serialize, Deserialize, Clone)] pub struct SP1PlonkProofData(pub PlonkBn254Proof); diff --git a/prover/src/utils.rs b/prover/src/utils.rs index 785b376079..653017b3e2 100644 --- a/prover/src/utils.rs +++ b/prover/src/utils.rs @@ -12,13 +12,12 @@ use sp1_core::{ air::Word, io::SP1Stdin, runtime::{Program, Runtime}, + utils::SP1CoreOpts, }; use tokio::{runtime, task::block_in_place}; use crate::SP1CoreProofData; -pub const RECONSTRUCT_COMMITMENTS_ENV_VAR: &str = "RECONSTRUCT_COMMITMENTS"; - impl SP1CoreProofData { pub fn save(&self, path: &str) -> Result<(), std::io::Error> { let data = serde_json::to_string(self).unwrap(); @@ -30,7 +29,7 @@ impl SP1CoreProofData { /// Get the number of cycles for a given program. pub fn get_cycles(elf: &[u8], stdin: &SP1Stdin) -> u64 { let program = Program::from(elf); - let mut runtime = Runtime::new(program); + let mut runtime = Runtime::new(program, SP1CoreOpts::default()); runtime.write_vecs(&stdin.buffer); runtime.dry_run(); runtime.state.global_clk diff --git a/prover/src/verify.rs b/prover/src/verify.rs index 62f12c7e9b..fedd467cfc 100644 --- a/prover/src/verify.rs +++ b/prover/src/verify.rs @@ -11,7 +11,7 @@ use sp1_core::{ utils::BabyBearPoseidon2, }; use sp1_recursion_core::{air::RecursionPublicValues, stark::config::BabyBearPoseidon2Outer}; -use sp1_recursion_gnark_ffi::{Groth16Proof, Groth16Prover}; +use sp1_recursion_gnark_ffi::{PlonkBn254Proof, PlonkBn254Prover}; use thiserror::Error; use crate::{ @@ -19,10 +19,14 @@ use crate::{ }; #[derive(Error, Debug)] -pub enum Groth16VerificationError { - #[error("the verifying key does not match the inner groth16 proof's committed verifying key")] +pub enum PlonkVerificationError { + #[error( + "the verifying key does not match the inner plonk bn254 proof's committed verifying key" + )] InvalidVerificationKey, - #[error("the public values in the sp1 proof do not match the public values in the inner groth16 proof")] + #[error( + "the public values in the sp1 proof do not match the public values in the inner plonk bn254 proof" + )] InvalidPublicValues, } @@ -212,15 +216,15 @@ impl SP1Prover { Ok(()) } - /// Verifies a Groth16 proof using the circuit artifacts in the build directory. - pub fn verify_groth16( + /// Verifies a PLONK proof using the circuit artifacts in the build directory. + pub fn verify_plonk_bn254( &self, - proof: &Groth16Proof, + proof: &PlonkBn254Proof, vk: &SP1VerifyingKey, public_values: &SP1PublicValues, build_dir: &Path, ) -> Result<()> { - let prover = Groth16Prover::new(); + let prover = PlonkBn254Prover::new(); let vkey_hash = BigUint::from_str(&proof.public_inputs[0])?; let committed_values_digest = BigUint::from_str(&proof.public_inputs[1])?; @@ -228,29 +232,29 @@ impl SP1Prover { // Verify the proof with the corresponding public inputs. prover.verify(proof, &vkey_hash, &committed_values_digest, build_dir); - verify_groth16_public_inputs(vk, public_values, &proof.public_inputs)?; + verify_plonk_bn254_public_inputs(vk, public_values, &proof.public_inputs)?; Ok(()) } } -/// Verify the vk_hash and public_values_hash in the public inputs of the Groth16Proof match the expected values. -pub fn verify_groth16_public_inputs( +/// Verify the vk_hash and public_values_hash in the public inputs of the PlonkBn254Proof match the expected values. +pub fn verify_plonk_bn254_public_inputs( vk: &SP1VerifyingKey, public_values: &SP1PublicValues, - groth16_public_inputs: &[String], + plonk_bn254_public_inputs: &[String], ) -> Result<()> { - let expected_vk_hash = BigUint::from_str(&groth16_public_inputs[0])?; - let expected_public_values_hash = BigUint::from_str(&groth16_public_inputs[1])?; + let expected_vk_hash = BigUint::from_str(&plonk_bn254_public_inputs[0])?; + let expected_public_values_hash = BigUint::from_str(&plonk_bn254_public_inputs[1])?; let vk_hash = vk.hash_bn254().as_canonical_biguint(); if vk_hash != expected_vk_hash { - return Err(Groth16VerificationError::InvalidVerificationKey.into()); + return Err(PlonkVerificationError::InvalidVerificationKey.into()); } let public_values_hash = public_values.hash(); if public_values_hash != expected_public_values_hash { - return Err(Groth16VerificationError::InvalidPublicValues.into()); + return Err(PlonkVerificationError::InvalidPublicValues.into()); } Ok(()) diff --git a/recursion/circuit/Cargo.toml b/recursion/circuit/Cargo.toml index faedfe5686..8843d11859 100644 --- a/recursion/circuit/Cargo.toml +++ b/recursion/circuit/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-recursion-circuit" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] p3-air = { workspace = true } p3-field = { workspace = true } diff --git a/recursion/circuit/src/challenger.rs b/recursion/circuit/src/challenger.rs index 29c4e282aa..b688059dd4 100644 --- a/recursion/circuit/src/challenger.rs +++ b/recursion/circuit/src/challenger.rs @@ -162,7 +162,7 @@ mod tests { use sp1_recursion_compiler::ir::SymbolicExt; use sp1_recursion_compiler::ir::{Builder, Witness}; use sp1_recursion_core::stark::config::{outer_perm, OuterChallenger}; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; use super::reduce_32; use super::split_32; @@ -182,7 +182,7 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -199,7 +199,7 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -217,7 +217,7 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -254,7 +254,7 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -296,6 +296,6 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } } diff --git a/recursion/circuit/src/constraints.rs b/recursion/circuit/src/constraints.rs index 1a456cddbc..3c724f0fe2 100644 --- a/recursion/circuit/src/constraints.rs +++ b/recursion/circuit/src/constraints.rs @@ -168,9 +168,12 @@ mod tests { use p3_challenger::{CanObserve, FieldChallenger}; use p3_commit::{Pcs, PolynomialSpace}; use serde::{de::DeserializeOwned, Serialize}; - use sp1_core::stark::{ - Chip, Com, Dom, LocalProver, OpeningProof, PcsProverData, ShardCommitment, ShardMainData, - ShardProof, StarkGenericConfig, StarkMachine, + use sp1_core::{ + stark::{ + Chip, Com, Dom, LocalProver, OpeningProof, PcsProverData, ShardCommitment, + ShardMainData, ShardProof, StarkGenericConfig, StarkMachine, + }, + utils::SP1CoreOpts, }; use sp1_recursion_compiler::{ config::OuterConfig, @@ -182,7 +185,7 @@ mod tests { runtime::Runtime, stark::{config::BabyBearPoseidon2Outer, RecursionAirWideDeg3}, }; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; use crate::stark::{tests::basic_program, StarkVerifierCircuit}; @@ -295,7 +298,12 @@ mod tests { let machine = A::machine(config); let (pk, vk) = machine.setup(&program); let mut challenger = machine.config().challenger(); - let proof = machine.prove::>(&pk, runtime.record, &mut challenger); + let proof = machine.prove::>( + &pk, + runtime.record, + &mut challenger, + SP1CoreOpts::recursion(), + ); let mut challenger = machine.config().challenger(); vk.observe_into(&mut challenger); @@ -359,6 +367,6 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } } diff --git a/recursion/circuit/src/fri.rs b/recursion/circuit/src/fri.rs index 7814a7d675..151254e2c9 100644 --- a/recursion/circuit/src/fri.rs +++ b/recursion/circuit/src/fri.rs @@ -251,7 +251,7 @@ pub mod tests { outer_perm, test_fri_config, OuterChallenge, OuterChallengeMmcs, OuterChallenger, OuterCompress, OuterDft, OuterFriProof, OuterHash, OuterPcs, OuterVal, OuterValMmcs, }; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; use super::{verify_shape_and_sample_challenges, verify_two_adic_pcs, TwoAdicPcsRoundVariable}; use crate::{ @@ -484,7 +484,7 @@ pub mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -557,6 +557,6 @@ pub mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } } diff --git a/recursion/circuit/src/lib.rs b/recursion/circuit/src/lib.rs index 045edc2770..717e2d4eda 100644 --- a/recursion/circuit/src/lib.rs +++ b/recursion/circuit/src/lib.rs @@ -30,7 +30,7 @@ mod tests { use sp1_recursion_compiler::ir::Ext; use sp1_recursion_compiler::ir::ExtConst; use sp1_recursion_compiler::ir::{Builder, Felt, Witness}; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; #[test] fn test_base_babybear() { @@ -68,7 +68,7 @@ mod tests { let constraints = backend.emit(builder.operations); let witness = Witness::default(); - Groth16Prover::test::(constraints.clone(), witness); + PlonkBn254Prover::test::(constraints.clone(), witness); } #[test] @@ -123,7 +123,7 @@ mod tests { let constraints = backend.emit(builder.operations); let witness = Witness::default(); - Groth16Prover::test::(constraints.clone(), witness); + PlonkBn254Prover::test::(constraints.clone(), witness); } #[test] @@ -143,7 +143,7 @@ mod tests { witness.write_vkey_hash(vkey_hash_bn254); witness.write_commited_values_digest(commited_values_digest_bn254); - Groth16Prover::test::(constraints.clone(), witness); + PlonkBn254Prover::test::(constraints.clone(), witness); } #[test] @@ -163,7 +163,7 @@ mod tests { let mut witness = Witness::default(); witness.write_commited_values_digest(commited_values_digest_bn254); - Groth16Prover::test::(constraints.clone(), witness); + PlonkBn254Prover::test::(constraints.clone(), witness); } #[test] @@ -183,6 +183,6 @@ mod tests { let mut witness = Witness::default(); witness.write_vkey_hash(vkey_hash_bn254); - Groth16Prover::test::(constraints.clone(), witness); + PlonkBn254Prover::test::(constraints.clone(), witness); } } diff --git a/recursion/circuit/src/poseidon2.rs b/recursion/circuit/src/poseidon2.rs index c573875631..a5a8cc1136 100644 --- a/recursion/circuit/src/poseidon2.rs +++ b/recursion/circuit/src/poseidon2.rs @@ -24,6 +24,8 @@ impl Poseidon2CircuitBuilder for Builder { } fn p2_hash(&mut self, input: &[Felt]) -> OuterDigestVariable { + assert!(C::N::bits() == p3_bn254_fr::Bn254Fr::bits()); + assert!(C::F::bits() == p3_baby_bear::BabyBear::bits()); let num_f_elms = C::N::bits() / C::F::bits(); let mut state: [Var; SPONGE_SIZE] = [ self.eval(C::N::zero()), @@ -62,7 +64,7 @@ pub mod tests { use sp1_recursion_compiler::constraints::ConstraintCompiler; use sp1_recursion_compiler::ir::{Builder, Felt, Var, Witness}; use sp1_recursion_core::stark::config::{outer_perm, OuterCompress, OuterHash}; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; use crate::poseidon2::Poseidon2CircuitBuilder; use crate::types::OuterDigestVariable; @@ -90,7 +92,7 @@ pub mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -123,7 +125,7 @@ pub mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } #[test] @@ -143,6 +145,6 @@ pub mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::(constraints.clone(), Witness::default()); + PlonkBn254Prover::test::(constraints.clone(), Witness::default()); } } diff --git a/recursion/circuit/src/stark.rs b/recursion/circuit/src/stark.rs index e7c5b530ba..48c800aa13 100644 --- a/recursion/circuit/src/stark.rs +++ b/recursion/circuit/src/stark.rs @@ -17,12 +17,12 @@ use sp1_core::{ }; use sp1_recursion_compiler::config::OuterConfig; use sp1_recursion_compiler::constraints::{Constraint, ConstraintCompiler}; -use sp1_recursion_compiler::ir::{Builder, Config, Felt, Var}; +use sp1_recursion_compiler::ir::{Builder, Config, Ext, Felt, Var}; use sp1_recursion_compiler::ir::{Usize, Witness}; use sp1_recursion_compiler::prelude::SymbolicVar; use sp1_recursion_core::air::RecursionPublicValues; use sp1_recursion_core::stark::config::{outer_fri_config, BabyBearPoseidon2Outer}; -use sp1_recursion_core::stark::RecursionAirSkinnyDeg7; +use sp1_recursion_core::stark::RecursionAirSkinnyDeg9; use sp1_recursion_program::commit::PolynomialSpaceVariable; use sp1_recursion_program::stark::RecursiveVerifierConstraintFolder; use sp1_recursion_program::types::QuotientDataValues; @@ -243,7 +243,7 @@ pub fn build_wrap_circuit( template_proof: ShardProof, ) -> Vec { let outer_config = OuterSC::new(); - let outer_machine = RecursionAirSkinnyDeg7::::wrap_machine(outer_config); + let outer_machine = RecursionAirSkinnyDeg9::::wrap_machine(outer_config); let mut builder = Builder::::default(); let mut challenger = MultiField32ChallengerVariable::new(&mut builder); @@ -340,13 +340,12 @@ pub fn build_wrap_circuit( sorted_indices, ); - // TODO: Ensure lookup bus is zero. - // let zero_ext: Ext<_, _> = builder.constant(EF::zero()); - // let cumulative_sum: Ext<_, _> = builder.eval(zero_ext); - // for chip in proof.opened_values.chips { - // builder.assign(cumulative_sum, cumulative_sum + chip.cumulative_sum); - // } - // builder.assert_ext_eq(cumulative_sum, zero_ext); + let zero_ext: Ext<_, _> = builder.constant(::EF::zero()); + let cumulative_sum: Ext<_, _> = builder.eval(zero_ext); + for chip in proof.opened_values.chips { + builder.assign(cumulative_sum, cumulative_sum + chip.cumulative_sum); + } + builder.assert_ext_eq(cumulative_sum, zero_ext); let mut backend = ConstraintCompiler::::default(); backend.emit(builder.operations) @@ -376,7 +375,7 @@ pub(crate) mod tests { "".to_string(), )]; instructions.resize( - 32, + 31, Instruction::new( Opcode::ADD, F::from_canonical_u32(3), @@ -389,6 +388,17 @@ pub(crate) mod tests { "".to_string(), ), ); + instructions.push(Instruction::new( + Opcode::HALT, + F::zero(), + zero, + zero, + F::zero(), + F::zero(), + true, + true, + "".to_string(), + )); RecursionProgram:: { instructions, traces: vec![None], diff --git a/recursion/circuit/src/utils.rs b/recursion/circuit/src/utils.rs index 98e5626b05..371e694395 100644 --- a/recursion/circuit/src/utils.rs +++ b/recursion/circuit/src/utils.rs @@ -3,7 +3,6 @@ use sp1_core::air::Word; use sp1_recursion_compiler::ir::{Builder, Config, Felt, Var}; use sp1_recursion_core::runtime::DIGEST_SIZE; -// TODO: this can be done much more efficiently, but in the meantime this should work pub fn felt2var(builder: &mut Builder, felt: Felt) -> Var { let bits = builder.num2bits_f(felt); builder.bits2num_v(&bits) @@ -25,18 +24,6 @@ pub fn babybears_to_bn254( } } result - - // TODO: Add this back. - // for i in 0..8 { - // let pv_word = pv.sp1_vk_digest[i]; - // let pv_word_bits = builder.num2bits_f_circuit(pv_word); - // let pv_word_var = builder.bits2num_v_circuit(&pv_word_bits); - // if i == 0 { - // builder.assign(pv_vkey_hash, pv_word_var); - // } else { - // builder.assign(pv_vkey_hash, pv_vkey_hash * var_2_31 + pv_word_var); - // } - // } } pub fn babybear_bytes_to_bn254( diff --git a/recursion/circuit/src/witness.rs b/recursion/circuit/src/witness.rs index 1217748ace..19046624f2 100644 --- a/recursion/circuit/src/witness.rs +++ b/recursion/circuit/src/witness.rs @@ -336,7 +336,7 @@ mod tests { ir::{Builder, ExtConst, Witness}, }; use sp1_recursion_core::stark::config::OuterChallenge; - use sp1_recursion_gnark_ffi::Groth16Prover; + use sp1_recursion_gnark_ffi::PlonkBn254Prover; #[test] fn test_witness_simple() { @@ -364,7 +364,7 @@ mod tests { let mut backend = ConstraintCompiler::::default(); let constraints = backend.emit(builder.operations); - Groth16Prover::test::( + PlonkBn254Prover::test::( constraints, Witness { vars: vec![Bn254Fr::one(), Bn254Fr::two()], diff --git a/recursion/compiler/Cargo.toml b/recursion/compiler/Cargo.toml index 23a17e796e..736013ff09 100644 --- a/recursion/compiler/Cargo.toml +++ b/recursion/compiler/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-recursion-compiler" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] p3-air = { workspace = true } p3-field = { workspace = true } @@ -18,10 +16,8 @@ sp1-core = { path = "../../core" } itertools = "0.12.1" serde = { version = "1.0.201", features = ["derive"] } sp1-recursion-derive = { path = "../derive" } -serde_json = "1.0.117" p3-bn254-fr = { workspace = true } p3-baby-bear = { workspace = true } -serial_test = "3.1.1" p3-poseidon2 = { workspace = true } backtrace = "0.3.71" tracing = "0.1.40" diff --git a/recursion/compiler/src/asm/code.rs b/recursion/compiler/src/asm/code.rs index 1f01ce1ff2..be067020f2 100644 --- a/recursion/compiler/src/asm/code.rs +++ b/recursion/compiler/src/asm/code.rs @@ -18,7 +18,7 @@ pub struct BasicBlock( impl> BasicBlock { /// Creates a new basic block. - pub fn new() -> Self { + pub const fn new() -> Self { Self(Vec::new(), Vec::new()) } @@ -42,7 +42,7 @@ pub struct AssemblyCode { impl> AssemblyCode { /// Creates a new assembly code. - pub fn new(blocks: Vec>, labels: BTreeMap) -> Self { + pub const fn new(blocks: Vec>, labels: BTreeMap) -> Self { Self { blocks, labels } } diff --git a/recursion/compiler/src/asm/compiler.rs b/recursion/compiler/src/asm/compiler.rs index da94fd9d92..5c2c9a22bf 100644 --- a/recursion/compiler/src/asm/compiler.rs +++ b/recursion/compiler/src/asm/compiler.rs @@ -1,13 +1,14 @@ use alloc::collections::BTreeMap; use alloc::vec; use backtrace::Backtrace; +use sp1_recursion_core::runtime::HEAP_PTR; +use sp1_recursion_core::runtime::HEAP_START_ADDRESS; use std::collections::BTreeSet; use p3_field::ExtensionField; use p3_field::PrimeField32; use p3_field::TwoAdicField; use sp1_recursion_core::runtime::RecursionProgram; -use sp1_recursion_core::runtime::STACK_SIZE; use super::config::AsmConfig; use super::IndexTriple; @@ -25,9 +26,6 @@ pub(crate) const ZERO: i32 = 0; /// The offset which the stack starts. pub(crate) const STACK_START_OFFSET: i32 = 16; -/// The heap pointer address. -pub(crate) const HEAP_PTR: i32 = -4; - /// The address of A0. pub(crate) const A0: i32 = -8; @@ -44,28 +42,28 @@ pub struct AsmCompiler { impl Var { /// Gets the frame pointer for a var. - pub fn fp(&self) -> i32 { + pub const fn fp(&self) -> i32 { -((self.0 as i32) * 3 + 1 + STACK_START_OFFSET) } } impl Felt { /// Gets the frame pointer for a felt. - pub fn fp(&self) -> i32 { + pub const fn fp(&self) -> i32 { -((self.0 as i32) * 3 + 2 + STACK_START_OFFSET) } } impl Ext { /// Gets the frame pointer for an extension element - pub fn fp(&self) -> i32 { + pub const fn fp(&self) -> i32 { -((self.0 as i32) * 3 + STACK_START_OFFSET) } } impl Ptr { /// Gets the frame pointer for a pointer. - pub fn fp(&self) -> i32 { + pub const fn fp(&self) -> i32 { self.address.fp() } } @@ -96,7 +94,7 @@ impl + TwoAdicField> AsmCo pub fn build(&mut self, operations: TracedVec>>) { // Set the heap pointer value according to stack size. if self.block_label().is_zero() { - let stack_size = F::from_canonical_usize(STACK_SIZE + 4); + let stack_size = F::from_canonical_usize(HEAP_START_ADDRESS); self.push(AsmInstruction::AddFI(HEAP_PTR, ZERO, stack_size), None); } @@ -469,25 +467,19 @@ impl + TwoAdicField> AsmCo } _ => unimplemented!(), }, - DslIr::Num2BitsF(_, _) => unimplemented!(), - DslIr::Num2BitsV(_, _) => unimplemented!(), DslIr::Poseidon2PermuteBabyBear(dst, src) => match (dst, src) { (Array::Dyn(dst, _), Array::Dyn(src, _)) => { self.push(AsmInstruction::Poseidon2Permute(dst.fp(), src.fp()), trace) } _ => unimplemented!(), }, - DslIr::ReverseBitsLen(_, _, _) => unimplemented!(), - DslIr::TwoAdicGenerator(_, _) => unimplemented!(), - DslIr::ExpUsizeV(_, _, _) => unimplemented!(), - DslIr::ExpUsizeF(_, _, _) => unimplemented!(), DslIr::Error() => self.push(AsmInstruction::Trap, trace), DslIr::PrintF(dst) => self.push(AsmInstruction::PrintF(dst.fp()), trace), DslIr::PrintV(dst) => self.push(AsmInstruction::PrintV(dst.fp()), trace), DslIr::PrintE(dst) => self.push(AsmInstruction::PrintE(dst.fp()), trace), - DslIr::Ext2Felt(dst, src) => match (dst, src) { + DslIr::HintExt2Felt(dst, src) => match (dst, src) { (Array::Dyn(dst, _), src) => { - self.push(AsmInstruction::Ext2Felt(dst.fp(), src.fp()), trace) + self.push(AsmInstruction::HintExt2Felt(dst.fp(), src.fp()), trace) } _ => unimplemented!(), }, @@ -708,7 +700,12 @@ impl<'a, F: PrimeField32 + TwoAdicField, EF: ExtensionField + TwoAdicField> compiler.push_to_block(last_if_block, instr, None); } - fn branch(lhs: i32, rhs: ValueOrConst, is_eq: bool, block: F) -> AsmInstruction { + const fn branch( + lhs: i32, + rhs: ValueOrConst, + is_eq: bool, + block: F, + ) -> AsmInstruction { match (rhs, is_eq) { (ValueOrConst::Const(rhs), true) => AsmInstruction::BneI(block, lhs, rhs), (ValueOrConst::Const(rhs), false) => AsmInstruction::BeqI(block, lhs, rhs), diff --git a/recursion/compiler/src/asm/instruction.rs b/recursion/compiler/src/asm/instruction.rs index c7083c81c9..0d965e6fee 100644 --- a/recursion/compiler/src/asm/instruction.rs +++ b/recursion/compiler/src/asm/instruction.rs @@ -4,10 +4,9 @@ use core::fmt; use p3_field::{ExtensionField, PrimeField32}; use sp1_recursion_core::cpu::Instruction; -use sp1_recursion_core::runtime::{Opcode, PERMUTATION_WIDTH}; +use sp1_recursion_core::runtime::{canonical_i32_to_field, Opcode, PERMUTATION_WIDTH}; use super::A0; -use crate::util::canonical_i32_to_field; #[derive(Debug, Clone)] pub enum AsmInstruction { @@ -160,7 +159,7 @@ pub enum AsmInstruction { PrintE(i32), /// Convert an extension element to field elements. - Ext2Felt(i32, i32), + HintExt2Felt(i32, i32), /// Hint the lenght of the next vector of blocks. HintLen(i32), @@ -786,8 +785,8 @@ impl> AsmInstruction { false, name, ), - AsmInstruction::Ext2Felt(dst, src) => Instruction::new( - Opcode::Ext2Felt, + AsmInstruction::HintExt2Felt(dst, src) => Instruction::new( + Opcode::HintExt2Felt, i32_f(dst), i32_f_arr(src), f_u32(F::zero()), @@ -1113,7 +1112,9 @@ impl> AsmInstruction { AsmInstruction::PrintE(dst) => { write!(f, "print_e ({})fp", dst) } - AsmInstruction::Ext2Felt(dst, src) => write!(f, "ext2felt ({})fp, {})fp", dst, src), + AsmInstruction::HintExt2Felt(dst, src) => { + write!(f, "hintExt2felt ({})fp, {})fp", dst, src) + } AsmInstruction::HintLen(dst) => write!(f, "hint_len ({})fp", dst), AsmInstruction::Hint(dst) => write!(f, "hint ({})fp", dst), AsmInstruction::FriFold(m, input_ptr) => { diff --git a/recursion/compiler/src/constraints/mod.rs b/recursion/compiler/src/constraints/mod.rs index 4ac11438ac..c5c67647a9 100644 --- a/recursion/compiler/src/constraints/mod.rs +++ b/recursion/compiler/src/constraints/mod.rs @@ -1,4 +1,3 @@ -// pub mod groth16_ffi; pub mod opcodes; use core::fmt::Debug; diff --git a/recursion/compiler/src/ir/bits.rs b/recursion/compiler/src/ir/bits.rs index 7df2f0e5e5..f69c8cee1d 100644 --- a/recursion/compiler/src/ir/bits.rs +++ b/recursion/compiler/src/ir/bits.rs @@ -1,11 +1,14 @@ -use p3_field::AbstractField; +use p3_field::{AbstractField, Field}; use sp1_recursion_core::runtime::NUM_BITS; use super::{Array, Builder, Config, DslIr, Felt, Usize, Var}; impl Builder { - /// Converts a variable to bits. + /// Converts a variable to LE bits. pub fn num2bits_v(&mut self, num: Var) -> Array> { + // This function is only used when the native field is Babybear. + assert!(C::N::bits() == NUM_BITS); + let output = self.dyn_array::>(NUM_BITS); self.push(DslIr::HintBitsV(output.clone(), num)); @@ -16,10 +19,10 @@ impl Builder { self.assign(sum, sum + bit * C::N::from_canonical_u32(1 << i)); } - // TODO: There is an edge case where the witnessed bits may slightly overflow and cause - // the output to be incorrect. This is a known issue and will be fixed in the future. self.assert_var_eq(sum, num); + self.less_than_bb_modulus(output.clone()); + output } @@ -49,22 +52,25 @@ impl Builder { }); } - // TODO: There is an edge case where the witnessed bits may slightly overflow and cause - // the output to be incorrect. This is a known issue and will be fixed in the future. self.assert_felt_eq(sum, num); + self.less_than_bb_modulus(output.clone()); + output } /// Converts a felt to bits inside a circuit. pub fn num2bits_f_circuit(&mut self, num: Felt) -> Vec> { let mut output = Vec::new(); - for _ in 0..32 { + for _ in 0..NUM_BITS { output.push(self.uninit()); } self.push(DslIr::CircuitNum2BitsF(num, output.clone())); + let output_array = self.vec(output.clone()); + self.less_than_bb_modulus(output_array); + output } @@ -149,4 +155,33 @@ impl Builder { } result_bits } + + /// Checks that the LE bit decomposition of a number is less than the babybear modulus. + /// + /// SAFETY: This function assumes that the num_bits values are already verified to be boolean. + /// + /// The babybear modulus in LE bits is: 100_000_000_000_000_000_000_000_000_111_1. + /// To check that the num_bits array is less than that value, we first check if the most significant + /// bits are all 1. If it is, then we assert that the other bits are all 0. + fn less_than_bb_modulus(&mut self, num_bits: Array>) { + let one: Var<_> = self.eval(C::N::one()); + let zero: Var<_> = self.eval(C::N::zero()); + + let mut most_sig_4_bits = one; + for i in (NUM_BITS - 4)..NUM_BITS { + let bit = self.get(&num_bits, i); + most_sig_4_bits = self.eval(bit * most_sig_4_bits); + } + + let mut sum_least_sig_bits = zero; + for i in 0..(NUM_BITS - 4) { + let bit = self.get(&num_bits, i); + sum_least_sig_bits = self.eval(bit + sum_least_sig_bits); + } + + // If the most significant 4 bits are all 1, then check the sum of the least significant bits, else return zero. + let check: Var<_> = + self.eval(most_sig_4_bits * sum_least_sig_bits + (one - most_sig_4_bits) * zero); + self.assert_var_eq(check, zero); + } } diff --git a/recursion/compiler/src/ir/builder.rs b/recursion/compiler/src/ir/builder.rs index f3bc11b386..19fb164f28 100644 --- a/recursion/compiler/src/ir/builder.rs +++ b/recursion/compiler/src/ir/builder.rs @@ -33,7 +33,7 @@ impl From> for TracedVec { } impl TracedVec { - pub fn new() -> Self { + pub const fn new() -> Self { Self { vec: Vec::new(), traces: Vec::new(), @@ -96,35 +96,36 @@ pub struct Builder { pub(crate) ext_count: u32, pub(crate) var_count: u32, pub operations: TracedVec>, - pub nb_public_values: Option>, - pub public_values_buffer: Option>>, - pub witness_var_count: u32, - pub witness_felt_count: u32, - pub witness_ext_count: u32, - pub debug: bool, - pub po2_table: Option>>, + pub(crate) nb_public_values: Option>, + pub(crate) witness_var_count: u32, + pub(crate) witness_felt_count: u32, + pub(crate) witness_ext_count: u32, + pub(crate) debug: bool, + pub(crate) is_sub_builder: bool, } impl Builder { /// Creates a new builder with a given number of counts for each type. - pub fn new( + pub fn new_sub_builder( var_count: u32, felt_count: u32, ext_count: u32, nb_public_values: Option>, + debug: bool, ) -> Self { Self { felt_count, ext_count, var_count, + // Witness counts are only used when the target is a gnark circuit. And sub-builders are + // not used when the target is a gnark circuit, so it's fine to set the witness counts to 0. witness_var_count: 0, witness_felt_count: 0, witness_ext_count: 0, operations: Default::default(), nb_public_values, - public_values_buffer: None, - debug: false, - po2_table: None, + debug, + is_sub_builder: true, } } @@ -388,6 +389,10 @@ impl Builder { } pub fn witness_var(&mut self) -> Var { + assert!( + !self.is_sub_builder, + "Cannot create a witness var with a sub builder" + ); let witness = self.uninit(); self.operations .push(DslIr::WitnessVar(witness, self.witness_var_count)); @@ -396,6 +401,10 @@ impl Builder { } pub fn witness_felt(&mut self) -> Felt { + assert!( + !self.is_sub_builder, + "Cannot create a witness felt with a sub builder" + ); let witness = self.uninit(); self.operations .push(DslIr::WitnessFelt(witness, self.witness_felt_count)); @@ -404,6 +413,10 @@ impl Builder { } pub fn witness_ext(&mut self) -> Ext { + assert!( + !self.is_sub_builder, + "Cannot create a witness ext with a sub builder" + ); let witness = self.uninit(); self.operations .push(DslIr::WitnessExt(witness, self.witness_ext_count)); @@ -431,6 +444,10 @@ impl Builder { /// Register and commits a felt as public value. This value will be constrained when verified. pub fn commit_public_value(&mut self, val: Felt) { + assert!( + !self.is_sub_builder, + "Cannot commit to a public value with a sub builder" + ); if self.nb_public_values.is_none() { self.nb_public_values = Some(self.eval(C::N::zero())); } @@ -442,6 +459,10 @@ impl Builder { /// Commits an array of felts in public values. pub fn commit_public_values(&mut self, vals: &Array>) { + assert!( + !self.is_sub_builder, + "Cannot commit to public values with a sub builder" + ); let len = vals.len(); self.range(0, len).for_each(|i, builder| { let val = builder.get(vals, i); @@ -491,11 +512,12 @@ impl<'a, C: Config> IfBuilder<'a, C> { let condition = self.condition(); // Execute the `then` block and collect the instructions. - let mut f_builder = Builder::::new( + let mut f_builder = Builder::::new_sub_builder( self.builder.var_count, self.builder.felt_count, self.builder.ext_count, self.builder.nb_public_values, + self.builder.debug, ); f(&mut f_builder); let then_instructions = f_builder.operations; @@ -538,22 +560,24 @@ impl<'a, C: Config> IfBuilder<'a, C> { ) { // Get the condition reduced from the expressions for lhs and rhs. let condition = self.condition(); - let mut then_builder = Builder::::new( + let mut then_builder = Builder::::new_sub_builder( self.builder.var_count, self.builder.felt_count, self.builder.ext_count, self.builder.nb_public_values, + self.builder.debug, ); // Execute the `then` and `else_then` blocks and collect the instructions. then_f(&mut then_builder); let then_instructions = then_builder.operations; - let mut else_builder = Builder::::new( + let mut else_builder = Builder::::new_sub_builder( self.builder.var_count, self.builder.felt_count, self.builder.ext_count, self.builder.nb_public_values, + self.builder.debug, ); else_f(&mut else_builder); let else_instructions = else_builder.operations; @@ -674,7 +698,7 @@ pub struct RangeBuilder<'a, C: Config> { } impl<'a, C: Config> RangeBuilder<'a, C> { - pub fn step_by(mut self, step_size: usize) -> Self { + pub const fn step_by(mut self, step_size: usize) -> Self { self.step_size = step_size; self } @@ -682,11 +706,12 @@ impl<'a, C: Config> RangeBuilder<'a, C> { pub fn for_each(self, mut f: impl FnMut(Var, &mut Builder)) { let step_size = C::N::from_canonical_usize(self.step_size); let loop_variable: Var = self.builder.uninit(); - let mut loop_body_builder = Builder::::new( + let mut loop_body_builder = Builder::::new_sub_builder( self.builder.var_count, self.builder.felt_count, self.builder.ext_count, self.builder.nb_public_values, + self.builder.debug, ); f(loop_variable, &mut loop_body_builder); diff --git a/recursion/compiler/src/ir/instructions.rs b/recursion/compiler/src/ir/instructions.rs index ee717b1f13..f7a5cee3e0 100644 --- a/recursion/compiler/src/ir/instructions.rs +++ b/recursion/compiler/src/ir/instructions.rs @@ -8,64 +8,111 @@ use super::{Config, Ext, Felt, Usize, Var}; #[derive(Debug, Clone)] pub enum DslIr { // Immediates. + /// Assigns an immediate to a variable (var = imm). ImmV(Var, C::N), + /// Assigns a field immediate to a field element (felt = field imm). ImmF(Felt, C::F), + /// Assigns an ext field immediate to an extension field element (ext = ext field imm). ImmE(Ext, C::EF), // Additions. + /// Add two variables (var = var + var). AddV(Var, Var, Var), + /// Add a variable and an immediate (var = var + imm). AddVI(Var, Var, C::N), + /// Add two field elements (felt = felt + felt). AddF(Felt, Felt, Felt), + /// Add a field element and a field immediate (felt = felt + field imm). AddFI(Felt, Felt, C::F), + /// Add two extension field elements (ext = ext + ext). AddE(Ext, Ext, Ext), + /// Add an extension field element and an ext field immediate (ext = ext + ext field imm). AddEI(Ext, Ext, C::EF), + /// Add an extension field element and a field element (ext = ext + felt). AddEF(Ext, Ext, Felt), + /// Add an extension field element and a field immediate (ext = ext + field imm). AddEFI(Ext, Ext, C::F), + /// Add a field element and an ext field immediate (ext = felt + ext field imm). AddEFFI(Ext, Felt, C::EF), // Subtractions. + /// Subtracts two variables (var = var - var). SubV(Var, Var, Var), + /// Subtracts a variable and an immediate (var = var - imm). SubVI(Var, Var, C::N), + /// Subtracts an immediate and a variable (var = imm - var). SubVIN(Var, C::N, Var), + /// Subtracts two field elements (felt = felt - felt). SubF(Felt, Felt, Felt), + /// Subtracts a field element and a field immediate (felt = felt - field imm). SubFI(Felt, Felt, C::F), + /// Subtracts a field immediate and a field element (felt = field imm - felt). SubFIN(Felt, C::F, Felt), + /// Subtracts two extension field elements (ext = ext - ext). SubE(Ext, Ext, Ext), + /// Subtrancts an extension field element and an extension field immediate (ext = ext - ext field imm). SubEI(Ext, Ext, C::EF), + /// Subtracts an extension field immediate and an extension field element (ext = ext field imm - ext). SubEIN(Ext, C::EF, Ext), + /// Subtracts an extension field element and a field immediate (ext = ext - field imm). SubEFI(Ext, Ext, C::F), + /// Subtracts an extension field element and a field element (ext = ext - felt). SubEF(Ext, Ext, Felt), // Multiplications. + /// Multiplies two variables (var = var * var). MulV(Var, Var, Var), + /// Multiplies a variable and an immediate (var = var * imm). MulVI(Var, Var, C::N), + /// Multiplies two field elements (felt = felt * felt). MulF(Felt, Felt, Felt), + /// Multiplies a field element and a field immediate (felt = felt * field imm). MulFI(Felt, Felt, C::F), + /// Multiplies two extension field elements (ext = ext * ext). MulE(Ext, Ext, Ext), + /// Multiplies an extension field element and an extension field immediate (ext = ext * ext field imm). MulEI(Ext, Ext, C::EF), + /// Multiplies an extension field element and a field immediate (ext = ext * field imm). MulEFI(Ext, Ext, C::F), + /// Multiplies an extension field element and a field element (ext = ext * felt). MulEF(Ext, Ext, Felt), // Divisions. + /// Divides two variables (var = var / var). DivF(Felt, Felt, Felt), + /// Divides a field element and a field immediate (felt = felt / field imm). DivFI(Felt, Felt, C::F), + /// Divides a field immediate and a field element (felt = field imm / felt). DivFIN(Felt, C::F, Felt), + /// Divides two extension field elements (ext = ext / ext). DivE(Ext, Ext, Ext), + /// Divides an extension field element and an extension field immediate (ext = ext / ext field imm). DivEI(Ext, Ext, C::EF), + /// Divides and extension field immediate and an extension field element (ext = ext field imm / ext). DivEIN(Ext, C::EF, Ext), + /// Divides an extension field element and a field immediate (ext = ext / field imm). DivEFI(Ext, Ext, C::F), + /// Divides a field immediate and an extension field element (ext = field imm / ext). DivEFIN(Ext, C::F, Ext), + /// Divides an extension field element and a field element (ext = ext / felt). DivEF(Ext, Ext, Felt), // Negations. + /// Negates a variable (var = -var). NegV(Var, Var), + /// Negates a field element (felt = -felt). NegF(Felt, Felt), + /// Negates an extension field element (ext = -ext). NegE(Ext, Ext), + /// Inverts a variable (var = 1 / var). InvV(Var, Var), + /// Inverts a field element (felt = 1 / felt). InvF(Felt, Felt), + /// Inverts an extension field element (ext = 1 / ext). InvE(Ext, Ext), // Control flow. + /// Executes a for loop with the parameters (start step value, end step value, step size, step variable, body). For( Usize, Usize, @@ -73,34 +120,51 @@ pub enum DslIr { Var, TracedVec>, ), + /// Executes an equal conditional branch with the parameters (lhs var, rhs var, then body, else body). IfEq( Var, Var, TracedVec>, TracedVec>, ), + /// Executes a not equal conditional branch with the parameters (lhs var, rhs var, then body, else body). IfNe( Var, Var, TracedVec>, TracedVec>, ), + /// Executes an equal conditional branch with the parameters (lhs var, rhs imm, then body, else body). IfEqI(Var, C::N, TracedVec>, TracedVec>), + /// Executes a not equal conditional branch with the parameters (lhs var, rhs imm, then body, else body). IfNeI(Var, C::N, TracedVec>, TracedVec>), + /// Break out of a for loop. Break, // Assertions. + /// Assert that two variables are equal (var == var). AssertEqV(Var, Var), + /// Assert that two variables are not equal (var != var). AssertNeV(Var, Var), + /// Assert that two field elements are equal (felt == felt). AssertEqF(Felt, Felt), + /// Assert that two field elements are not equal (felt != felt). AssertNeF(Felt, Felt), + /// Assert that two extension field elements are equal (ext == ext). AssertEqE(Ext, Ext), + /// Assert that two extension field elements are not equal (ext != ext). AssertNeE(Ext, Ext), + /// Assert that a variable is equal to an immediate (var == imm). AssertEqVI(Var, C::N), + /// Assert that a variable is not equal to an immediate (var != imm). AssertNeVI(Var, C::N), + /// Assert that a field element is equal to a field immediate (felt == field imm). AssertEqFI(Felt, C::F), + /// Assert that a field element is not equal to a field immediate (felt != field imm). AssertNeFI(Felt, C::F), + /// Assert that an extension field element is equal to an extension field immediate (ext == ext field imm). AssertEqEI(Ext, C::EF), + /// Assert that an extension field element is not equal to an extension field immediate (ext != ext field imm). AssertNeEI(Ext, C::EF), // Memory instructions. @@ -114,68 +178,103 @@ pub enum DslIr { LoadE(Ext, Ptr, MemIndex), /// Store variable at address StoreV(Var, Ptr, MemIndex), - /// Store field element at adress + /// Store field element at address StoreF(Felt, Ptr, MemIndex), - /// Store extension field at adress + /// Store extension field at address StoreE(Ext, Ptr, MemIndex), // Bits. - Num2BitsV(Array>, Usize), - Num2BitsF(Array>, Felt), + /// Decompose a variable into size bits (bits = num2bits(var, size)). Should only be used when target is a gnark circuit. CircuitNum2BitsV(Var, usize, Vec>), + /// Decompose a field element into bits (bits = num2bits(felt)). Should only be used when target is a gnark circuit. CircuitNum2BitsF(Felt, Vec>), - ReverseBitsLen(Usize, Usize, Usize), // Hashing. + /// Permutes an array of baby bear elements using Poseidon2 (output = p2_permute(array)). Poseidon2PermuteBabyBear(Array>, Array>), + /// Compresses two baby bear element arrays using Poseidon2 (output = p2_compress(array1, array2)). Poseidon2CompressBabyBear( Array>, Array>, Array>, ), + /// Permutes an array of Bn254 elements using Poseidon2 (output = p2_permute(array)). Should only + /// be used when target is a gnark circuit. CircuitPoseidon2Permute([Var; 3]), // Miscellaneous instructions. + /// Decompose hint operation of a usize into an array. (output = num2bits(usize)). HintBitsU(Array>, Usize), + /// Decompose hint operation of a variable into an array. (output = num2bits(var)). HintBitsV(Array>, Var), + /// Decompose hint operation of a field element into an array. (output = num2bits(felt)). HintBitsF(Array>, Felt), + /// Prints a variable. PrintV(Var), + /// Prints a field element. PrintF(Felt), + /// Prints an extension field element. PrintE(Ext), + /// Throws an error. Error(), - TwoAdicGenerator(Felt, Usize), - ExpUsizeV(Var, Var, Usize), - ExpUsizeF(Felt, Felt, Usize), - Ext2Felt(Array>, Ext), + + /// Converts an ext to a slice of felts. + HintExt2Felt(Array>, Ext), + /// Hint the length of the next array. HintLen(Var), + /// Hint an array of variables. HintVars(Array>), + /// Hint an array of field elements. HintFelts(Array>), + /// Hint an array of extension field elements. HintExts(Array>), + /// Witness a variable. Should only be used when target is a gnark circuit. WitnessVar(Var, u32), + /// Witness a field element. Should only be used when target is a gnark circuit. WitnessFelt(Felt, u32), + /// Witness an extension field element. Should only be used when target is a gnark circuit. WitnessExt(Ext, u32), + /// Label a field element as the ith public input. Commit(Felt, Var), + /// Registers a field element to the public inputs. RegisterPublicValue(Felt), + /// Operation to halt the program. Should be the last instruction in the program. Halt, // Public inputs for circuits. + /// Asserts that the inputted var is equal the circuit's vkey hash public input. Should only be + /// used when target is a gnark circuit. CircuitCommitVkeyHash(Var), + /// Asserts that the inputted var is equal the circuit's commited values digest public input. Should + /// only be used when target is a gnark circuit. CircuitCommitCommitedValuesDigest(Var), // FRI specific instructions. + /// Executes a FRI fold operation. 1st field is the size of the fri fold input array. 2nd field + /// is the fri fold input array. See [`FriFoldInput`] for more details. FriFold(Var, Array>), + /// Select's a variable based on a condition. (select(cond, true_val, false_val) => output). + /// Should only be used when target is a gnark circuit. CircuitSelectV(Var, Var, Var, Var), + /// Select's a field element based on a condition. (select(cond, true_val, false_val) => output). + /// Should only be used when target is a gnark circuit. CircuitSelectF(Var, Felt, Felt, Felt), + /// Select's an extension field element based on a condition. (select(cond, true_val, false_val) => output). + /// Should only be used when target is a gnark circuit. CircuitSelectE( Var, Ext, Ext, Ext, ), + /// Converts an ext to a slice of felts. Should only be used when target is a gnark circuit. CircuitExt2Felt([Felt; 4], Ext), + /// Converts a slice of felts to an ext. Should only be used when target is a gnark circuit. CircuitFelts2Ext([Felt; 4], Ext), // Debugging instructions. + /// Executes less than (var = var < var). This operation is NOT constrained. LessThan(Var, Var, Var), + /// Tracks the number of cycles used by a block of code annotated by the string input. CycleTracker(String), } diff --git a/recursion/compiler/src/ir/symbolic.rs b/recursion/compiler/src/ir/symbolic.rs index 37beac2a8e..6b2fbfd4e1 100644 --- a/recursion/compiler/src/ir/symbolic.rs +++ b/recursion/compiler/src/ir/symbolic.rs @@ -135,7 +135,7 @@ impl PartialEq for SymbolicExt { impl Eq for SymbolicExt {} impl SymbolicVar { - pub(crate) fn digest(&self) -> Digest { + pub(crate) const fn digest(&self) -> Digest { match self { SymbolicVar::Const(_, d) => *d, SymbolicVar::Val(_, d) => *d, @@ -148,7 +148,7 @@ impl SymbolicVar { } impl SymbolicFelt { - pub(crate) fn digest(&self) -> Digest { + pub(crate) const fn digest(&self) -> Digest { match self { SymbolicFelt::Const(_, d) => *d, SymbolicFelt::Val(_, d) => *d, @@ -162,7 +162,7 @@ impl SymbolicFelt { } impl SymbolicExt { - pub(crate) fn digest(&self) -> Digest { + pub(crate) const fn digest(&self) -> Digest { match self { SymbolicExt::Const(_, d) => *d, SymbolicExt::Base(_, d) => *d, diff --git a/recursion/compiler/src/ir/types.rs b/recursion/compiler/src/ir/types.rs index 96d999e96e..c30c8fa4a4 100644 --- a/recursion/compiler/src/ir/types.rs +++ b/recursion/compiler/src/ir/types.rs @@ -96,7 +96,7 @@ impl From for Usize { } impl Var { - pub fn new(id: u32) -> Self { + pub const fn new(id: u32) -> Self { Self(id, PhantomData) } @@ -110,7 +110,7 @@ impl Var { } impl Felt { - pub fn new(id: u32) -> Self { + pub const fn new(id: u32) -> Self { Self(id, PhantomData) } @@ -131,7 +131,7 @@ impl Felt { } impl Ext { - pub fn new(id: u32) -> Self { + pub const fn new(id: u32) -> Self { Self(id, PhantomData) } @@ -857,7 +857,6 @@ impl MemVariable for Felt { } impl> Ext { - // Todo: refactor base fn assign_with_caches>( &self, src: SymbolicExt, diff --git a/recursion/compiler/src/ir/utils.rs b/recursion/compiler/src/ir/utils.rs index 56e8f38805..bea55c21b4 100644 --- a/recursion/compiler/src/ir/utils.rs +++ b/recursion/compiler/src/ir/utils.rs @@ -202,7 +202,19 @@ impl Builder { /// Converts an ext to a slice of felts. pub fn ext2felt(&mut self, value: Ext) -> Array> { let result = self.dyn_array(4); - self.operations.push(DslIr::Ext2Felt(result.clone(), value)); + self.operations + .push(DslIr::HintExt2Felt(result.clone(), value)); + + // Verify that the decomposed extension element is correct. + let mut reconstructed_ext: Ext = self.constant(C::EF::zero()); + for i in 0..4 { + let felt = self.get(&result, i); + let monomial: Ext = self.constant(C::EF::monomial(i)); + reconstructed_ext = self.eval(reconstructed_ext + monomial * felt); + } + + self.assert_ext_eq(reconstructed_ext, value); + result } diff --git a/recursion/compiler/src/lib.rs b/recursion/compiler/src/lib.rs index a8d26dacdf..210d4b22a6 100644 --- a/recursion/compiler/src/lib.rs +++ b/recursion/compiler/src/lib.rs @@ -7,7 +7,6 @@ pub mod asm; pub mod config; pub mod constraints; pub mod ir; -pub mod util; pub mod prelude { pub use crate::asm::AsmCompiler; diff --git a/recursion/compiler/src/util.rs b/recursion/compiler/src/util.rs deleted file mode 100644 index c0e746b611..0000000000 --- a/recursion/compiler/src/util.rs +++ /dev/null @@ -1,11 +0,0 @@ -use p3_field::PrimeField32; - -pub fn canonical_i32_to_field(x: i32) -> F { - let modulus = F::ORDER_U32; - assert!(x < modulus as i32 && x >= -(modulus as i32)); - if x < 0 { - -F::from_canonical_u32((-x) as u32) - } else { - F::from_canonical_u32(x as u32) - } -} diff --git a/recursion/core/Cargo.toml b/recursion/core/Cargo.toml index adc4cfb976..4a227deb2a 100644 --- a/recursion/core/Cargo.toml +++ b/recursion/core/Cargo.toml @@ -32,4 +32,4 @@ arrayref = "0.3.7" static_assertions = "1.1.0" [dev-dependencies] -rand = "0.8.5" \ No newline at end of file +rand = "0.8.5" diff --git a/recursion/core/src/air/public_values.rs b/recursion/core/src/air/public_values.rs index 97bcf0b940..484342f17f 100644 --- a/recursion/core/src/air/public_values.rs +++ b/recursion/core/src/air/public_values.rs @@ -1,4 +1,4 @@ -use crate::runtime::{DIGEST_SIZE, PERMUTATION_WIDTH}; +use crate::runtime::{DIGEST_SIZE, HASH_RATE, PERMUTATION_WIDTH}; use core::fmt::Debug; use p3_challenger::DuplexChallenger; @@ -49,7 +49,7 @@ pub struct ChallengerPublicValues { impl ChallengerPublicValues { pub fn set_challenger>( &self, - challenger: &mut DuplexChallenger, + challenger: &mut DuplexChallenger, ) where T: PrimeField32, { @@ -77,9 +77,6 @@ pub struct RecursionPublicValues { /// The expected start pc for the next shard. pub next_pc: T, - /// The exit code of the program. - pub exit_code: T, - /// First shard being proven. pub start_shard: T, @@ -113,6 +110,10 @@ pub struct RecursionPublicValues { /// Whether the proof completely proves the program execution. pub is_complete: T, - /// The digest of all the public values elements. + /// The digest of all the previous public values elements. pub digest: [T; DIGEST_SIZE], + + /// The exit code of the program. Note that this is not part of the public values digest, since + /// it's value will be individually constrained. + pub exit_code: T, } diff --git a/recursion/core/src/cpu/air/alu.rs b/recursion/core/src/cpu/air/alu.rs index 61c34e91c3..377fc4fe82 100644 --- a/recursion/core/src/cpu/air/alu.rs +++ b/recursion/core/src/cpu/air/alu.rs @@ -8,7 +8,7 @@ use crate::{ memory::MemoryCols, }; -impl CpuChip { +impl CpuChip { /// Eval the ALU instructions. pub fn eval_alu(&self, builder: &mut AB, local: &CpuCols) where diff --git a/recursion/core/src/cpu/air/branch.rs b/recursion/core/src/cpu/air/branch.rs index d97e6653e5..91bebfa65e 100644 --- a/recursion/core/src/cpu/air/branch.rs +++ b/recursion/core/src/cpu/air/branch.rs @@ -8,7 +8,7 @@ use crate::{ memory::MemoryCols, }; -impl CpuChip { +impl CpuChip { /// Eval the BRANCH operations. pub fn eval_branch( &self, diff --git a/recursion/core/src/cpu/air/heap.rs b/recursion/core/src/cpu/air/heap.rs new file mode 100644 index 0000000000..170f3246f9 --- /dev/null +++ b/recursion/core/src/cpu/air/heap.rs @@ -0,0 +1,29 @@ +use p3_field::{AbstractField, Field}; + +use crate::{ + air::SP1RecursionAirBuilder, + cpu::{CpuChip, CpuCols}, + memory::MemoryCols, + runtime::HEAP_START_ADDRESS, +}; + +impl CpuChip { + /// Eval the heap ptr. + ///s + /// This function will ensure that the heap size never goes above 2^28. + pub fn eval_heap_ptr(&self, builder: &mut AB, local: &CpuCols) + where + AB: SP1RecursionAirBuilder, + { + let heap_columns = local.opcode_specific.heap_expand(); + + let heap_size = local.a.value()[0] - AB::Expr::from_canonical_usize(HEAP_START_ADDRESS); + + builder.eval_range_check_28bits( + heap_size, + heap_columns.diff_16bit_limb, + heap_columns.diff_12bit_limb, + local.selectors.is_heap_expand, + ); + } +} diff --git a/recursion/core/src/cpu/air/jump.rs b/recursion/core/src/cpu/air/jump.rs index 7accec831f..bf86a70cce 100644 --- a/recursion/core/src/cpu/air/jump.rs +++ b/recursion/core/src/cpu/air/jump.rs @@ -8,7 +8,7 @@ use crate::{ runtime::STACK_SIZE, }; -impl CpuChip { +impl CpuChip { /// Eval the JUMP instructions. /// /// This method will verify the fp column values and add to the `next_pc` expression. diff --git a/recursion/core/src/cpu/air/memory.rs b/recursion/core/src/cpu/air/memory.rs index fa3085fe5f..c0a3a2b639 100644 --- a/recursion/core/src/cpu/air/memory.rs +++ b/recursion/core/src/cpu/air/memory.rs @@ -8,7 +8,7 @@ use crate::{ memory::MemoryCols, }; -impl CpuChip { +impl CpuChip { // Eval the MEMORY instructions. pub fn eval_memory(&self, builder: &mut AB, local: &CpuCols) where diff --git a/recursion/core/src/cpu/air/mod.rs b/recursion/core/src/cpu/air/mod.rs index 132c7e03cb..28343367c8 100644 --- a/recursion/core/src/cpu/air/mod.rs +++ b/recursion/core/src/cpu/air/mod.rs @@ -1,5 +1,6 @@ mod alu; mod branch; +mod heap; mod jump; mod memory; mod operands; @@ -19,7 +20,7 @@ use crate::{ memory::MemoryCols, }; -impl Air for CpuChip +impl Air for CpuChip where AB: SP1RecursionAirBuilder, { @@ -87,14 +88,24 @@ where self.eval_clk(builder, local, next); // Constrain the system instructions (TRAP, HALT). - self.eval_system_instructions(builder, local, next); + self.eval_system_instructions(builder, local, next, public_values); + + // Verify the heap size. + self.eval_heap_ptr(builder, local); // Constrain the is_real_flag. self.eval_is_real(builder, local, next); + + // Create a dummy constraint of the given degree to compress the permutation columns. + let mut expr = local.is_real * local.is_real; + for _ in 0..(L - 2) { + expr *= local.is_real.into(); + } + builder.assert_eq(expr.clone(), expr.clone()); } } -impl CpuChip { +impl CpuChip { /// Eval the clk. /// /// For all instructions except for FRI fold, the next clk is the current clk + 4. @@ -183,6 +194,8 @@ impl CpuChip { + local.selectors.is_fri_fold + local.selectors.is_poseidon + local.selectors.is_store + + local.selectors.is_noop + + local.selectors.is_ext_to_felt } /// Expr to check for instructions that are commit instructions. @@ -192,4 +205,12 @@ impl CpuChip { { local.selectors.is_commit.into() } + + /// Expr to check for system instructions. + pub fn is_system_instruction(&self, local: &CpuCols) -> AB::Expr + where + AB: SP1RecursionAirBuilder, + { + local.selectors.is_trap + local.selectors.is_halt + } } diff --git a/recursion/core/src/cpu/air/operands.rs b/recursion/core/src/cpu/air/operands.rs index 9b45abb02b..e67cea6dd1 100644 --- a/recursion/core/src/cpu/air/operands.rs +++ b/recursion/core/src/cpu/air/operands.rs @@ -7,7 +7,7 @@ use crate::{ memory::MemoryCols, }; -impl CpuChip { +impl CpuChip { /// Eval the operands. pub fn eval_operands(&self, builder: &mut AB, local: &CpuCols) where diff --git a/recursion/core/src/cpu/air/public_values.rs b/recursion/core/src/cpu/air/public_values.rs index 4f1a9c924c..15a23828f9 100644 --- a/recursion/core/src/cpu/air/public_values.rs +++ b/recursion/core/src/cpu/air/public_values.rs @@ -8,7 +8,7 @@ use crate::{ runtime::DIGEST_SIZE, }; -impl CpuChip { +impl CpuChip { /// Eval the COMMIT instructions. /// /// This method will verify the committed public value. diff --git a/recursion/core/src/cpu/air/system.rs b/recursion/core/src/cpu/air/system.rs index 39be8a5fd8..db20bf201e 100644 --- a/recursion/core/src/cpu/air/system.rs +++ b/recursion/core/src/cpu/air/system.rs @@ -3,32 +3,49 @@ use p3_field::Field; use sp1_core::air::BaseAirBuilder; use crate::{ - air::SP1RecursionAirBuilder, + air::{RecursionPublicValues, SP1RecursionAirBuilder}, cpu::{CpuChip, CpuCols}, }; -impl CpuChip { +impl CpuChip { /// Eval the system instructions (TRAP, HALT). - /// - /// This method will contrain the following: - /// 1) Ensure that none of the instructions are TRAP. - /// 2) Ensure that the last real instruction is a HALT. pub fn eval_system_instructions( &self, builder: &mut AB, local: &CpuCols, next: &CpuCols, + public_values: &RecursionPublicValues, ) where - AB: SP1RecursionAirBuilder, + AB: SP1RecursionAirBuilder, { + let is_system_instruction = self.is_system_instruction::(local); + + // Verify that the last real row is either TRAP or HALT. + builder + .when_transition() + .when(local.is_real) + .when_not(next.is_real) + .assert_one(is_system_instruction.clone()); + builder + .when_last_row() .when(local.is_real) - .assert_zero(local.selectors.is_trap); + .assert_one(is_system_instruction.clone()); + // Verify that all other real rows are not TRAP or HALT. builder .when_transition() .when(local.is_real) - .when_not(next.is_real) - .assert_one(local.selectors.is_halt); + .when(next.is_real) + .assert_zero(is_system_instruction); + + // Verify the correct public value exit code. + builder + .when(local.selectors.is_trap) + .assert_one(public_values.exit_code.clone()); + + builder + .when(local.selectors.is_halt) + .assert_zero(public_values.exit_code.clone()); } } diff --git a/recursion/core/src/cpu/columns/heap_expand.rs b/recursion/core/src/cpu/columns/heap_expand.rs new file mode 100644 index 0000000000..fcdaa882d9 --- /dev/null +++ b/recursion/core/src/cpu/columns/heap_expand.rs @@ -0,0 +1,8 @@ +use sp1_derive::AlignedBorrow; + +#[derive(AlignedBorrow, Default, Debug, Clone, Copy)] +#[repr(C)] +pub struct HeapExpandCols { + pub diff_16bit_limb: T, + pub diff_12bit_limb: T, +} diff --git a/recursion/core/src/cpu/columns/mod.rs b/recursion/core/src/cpu/columns/mod.rs index c7eae3cbea..5655a9661a 100644 --- a/recursion/core/src/cpu/columns/mod.rs +++ b/recursion/core/src/cpu/columns/mod.rs @@ -6,6 +6,7 @@ use sp1_core::utils::indices_arr; use sp1_derive::AlignedBorrow; mod branch; +mod heap_expand; mod instruction; mod memory; mod opcode; @@ -14,6 +15,7 @@ mod public_values; pub use instruction::*; pub use opcode::*; +pub use public_values::*; use self::opcode_specific::OpcodeSpecificCols; @@ -28,7 +30,7 @@ const fn make_col_map() -> CpuCols { pub(crate) const CPU_COL_MAP: CpuCols = make_col_map(); -impl BaseAir for CpuChip { +impl BaseAir for CpuChip { fn width(&self) -> usize { NUM_CPU_COLS } diff --git a/recursion/core/src/cpu/columns/opcode.rs b/recursion/core/src/cpu/columns/opcode.rs index fcea11ce71..6fb0026948 100644 --- a/recursion/core/src/cpu/columns/opcode.rs +++ b/recursion/core/src/cpu/columns/opcode.rs @@ -1,7 +1,10 @@ -use p3_field::Field; +use p3_field::PrimeField32; use sp1_derive::AlignedBorrow; -use crate::{cpu::Instruction, runtime::Opcode}; +use crate::{ + cpu::Instruction, + runtime::{instruction_is_heap_expand, Opcode}, +}; const OPCODE_COUNT: usize = core::mem::size_of::>(); @@ -40,9 +43,12 @@ pub struct OpcodeSelectorCols { pub is_poseidon: T, pub is_fri_fold: T, pub is_commit: T, + pub is_ext_to_felt: T, + + pub is_heap_expand: T, } -impl OpcodeSelectorCols { +impl OpcodeSelectorCols { /// Populates the opcode columns with the given instruction. /// /// The opcode flag should be set to 1 for the relevant opcode and 0 for the rest. We already @@ -65,14 +71,19 @@ impl OpcodeSelectorCols { Opcode::HALT => self.is_halt = F::one(), Opcode::FRIFold => self.is_fri_fold = F::one(), Opcode::Poseidon2Compress => self.is_poseidon = F::one(), - // TODO: Double-check that `is_noop` is constrained properly in the CPU air. - Opcode::Ext2Felt => self.is_noop = F::one(), - Opcode::HintBits => self.is_noop = F::one(), - Opcode::PrintF => self.is_noop = F::one(), - Opcode::PrintE => self.is_noop = F::one(), Opcode::Commit => self.is_commit = F::one(), - Opcode::RegisterPublicValue => self.is_noop = F::one(), - _ => {} + Opcode::HintExt2Felt => self.is_ext_to_felt = F::one(), + + Opcode::Hint + | Opcode::HintBits + | Opcode::PrintF + | Opcode::PrintE + | Opcode::RegisterPublicValue + | Opcode::CycleTracker => { + self.is_noop = F::one(); + } + + Opcode::HintLen | Opcode::LessThanF => {} } if matches!( @@ -81,6 +92,10 @@ impl OpcodeSelectorCols { ) { self.is_ext = F::one(); } + + if instruction_is_heap_expand(instruction) { + self.is_heap_expand = F::one(); + } } } @@ -109,6 +124,8 @@ impl IntoIterator for &OpcodeSelectorCols { self.is_poseidon, self.is_fri_fold, self.is_commit, + self.is_ext_to_felt, + self.is_heap_expand, ] .into_iter() } diff --git a/recursion/core/src/cpu/columns/opcode_specific.rs b/recursion/core/src/cpu/columns/opcode_specific.rs index 1b577cde2d..47a6d38acf 100644 --- a/recursion/core/src/cpu/columns/opcode_specific.rs +++ b/recursion/core/src/cpu/columns/opcode_specific.rs @@ -2,6 +2,7 @@ use std::fmt::{Debug, Formatter}; use std::mem::{size_of, transmute}; use super::branch::BranchCols; +use super::heap_expand::HeapExpandCols; use super::memory::MemoryCols; use super::public_values::PublicValuesCols; @@ -14,6 +15,7 @@ pub union OpcodeSpecificCols { branch: BranchCols, memory: MemoryCols, public_values: PublicValuesCols, + heap_expand: HeapExpandCols, } impl Default for OpcodeSpecificCols { @@ -56,4 +58,12 @@ impl OpcodeSpecificCols { pub fn public_values_mut(&mut self) -> &mut PublicValuesCols { unsafe { &mut self.public_values } } + + pub fn heap_expand(&self) -> &HeapExpandCols { + unsafe { &self.heap_expand } + } + + pub fn heap_expand_mut(&mut self) -> &mut HeapExpandCols { + unsafe { &mut self.heap_expand } + } } diff --git a/recursion/core/src/cpu/mod.rs b/recursion/core/src/cpu/mod.rs index 17a5d296e3..2b866b7819 100644 --- a/recursion/core/src/cpu/mod.rs +++ b/recursion/core/src/cpu/mod.rs @@ -23,7 +23,7 @@ pub struct CpuEvent { } #[derive(Default)] -pub struct CpuChip { +pub struct CpuChip { pub fixed_log2_rows: Option, pub _phantom: std::marker::PhantomData, } diff --git a/recursion/core/src/cpu/trace.rs b/recursion/core/src/cpu/trace.rs index 318d291943..c07a355d04 100644 --- a/recursion/core/src/cpu/trace.rs +++ b/recursion/core/src/cpu/trace.rs @@ -11,12 +11,15 @@ use tracing::instrument; use crate::{ air::BinomialExtensionUtils, memory::MemoryCols, - runtime::{ExecutionRecord, Opcode, RecursionProgram, D}, + runtime::{ + get_heap_size_range_check_events, instruction_is_heap_expand, ExecutionRecord, Opcode, + RecursionProgram, D, + }, }; use super::{CpuChip, CpuCols, CPU_COL_MAP, NUM_CPU_COLS}; -impl> MachineAir for CpuChip { +impl, const L: usize> MachineAir for CpuChip { type Record = ExecutionRecord; type Program = RecursionProgram; @@ -69,6 +72,16 @@ impl> MachineAir for CpuChip { memory_cols.memory_addr = record.addr; } + // Populate the heap columns. + if instruction_is_heap_expand(&event.instruction) { + let (u16_range_check, u12_range_check) = + get_heap_size_range_check_events(cols.a.value()[0]); + + let heap_cols = cols.opcode_specific.heap_expand_mut(); + heap_cols.diff_16bit_limb = F::from_canonical_u16(u16_range_check.val); + heap_cols.diff_12bit_limb = F::from_canonical_u16(u12_range_check.val); + } + // Populate the branch columns. if matches!( event.instruction.opcode, diff --git a/recursion/core/src/fri_fold/mod.rs b/recursion/core/src/fri_fold/mod.rs index 02ef07db1d..d59668d1e9 100644 --- a/recursion/core/src/fri_fold/mod.rs +++ b/recursion/core/src/fri_fold/mod.rs @@ -359,11 +359,11 @@ impl FriFoldChip { ); } - pub fn do_receive_table(local: &FriFoldCols) -> T { + pub const fn do_receive_table(local: &FriFoldCols) -> T { local.is_last_iteration } - pub fn do_memory_access(local: &FriFoldCols) -> T { + pub const fn do_memory_access(local: &FriFoldCols) -> T { local.is_real } } diff --git a/recursion/core/src/memory/air.rs b/recursion/core/src/memory/air.rs index 45ba60fc26..9fe4161fac 100644 --- a/recursion/core/src/memory/air.rs +++ b/recursion/core/src/memory/air.rs @@ -18,7 +18,7 @@ pub(crate) const NUM_MEMORY_INIT_COLS: usize = size_of::>(); #[allow(dead_code)] impl MemoryGlobalChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self { fixed_log2_rows: None, } diff --git a/recursion/core/src/multi/mod.rs b/recursion/core/src/multi/mod.rs index f0acb982ce..23173f7de9 100644 --- a/recursion/core/src/multi/mod.rs +++ b/recursion/core/src/multi/mod.rs @@ -125,6 +125,13 @@ where let local: &MultiCols = (*local).borrow(); let next: &MultiCols = (*next).borrow(); + // Add some dummy constraints to compress the interactions. + let mut expr = local.is_fri_fold * local.is_fri_fold; + for _ in 0..(DEGREE - 2) { + expr *= local.is_fri_fold.into(); + } + builder.assert_eq(expr.clone(), expr.clone()); + let next_is_real = next.is_fri_fold + next.is_poseidon2; let local_is_real = local.is_fri_fold + local.is_poseidon2; @@ -280,6 +287,7 @@ mod tests { BabyBear, Poseidon2, 16, + 8, > = config.challenger(); let start = Instant::now(); uni_stark_verify(&config, &chip, &mut challenger, &proof) diff --git a/recursion/core/src/poseidon2/columns.rs b/recursion/core/src/poseidon2/columns.rs index 9322c5d809..12fa730477 100644 --- a/recursion/core/src/poseidon2/columns.rs +++ b/recursion/core/src/poseidon2/columns.rs @@ -45,7 +45,6 @@ impl RoundSpecificCols { pub struct ComputationCols { pub input: [T; WIDTH], pub add_rc: [T; WIDTH], - pub sbox_deg_3: [T; WIDTH], pub sbox_deg_7: [T; WIDTH], pub output: [T; WIDTH], } diff --git a/recursion/core/src/poseidon2/external.rs b/recursion/core/src/poseidon2/external.rs index 72e0cd51f0..c871bd873d 100644 --- a/recursion/core/src/poseidon2/external.rs +++ b/recursion/core/src/poseidon2/external.rs @@ -196,12 +196,7 @@ impl Poseidon2Chip { let sbox_deg_3 = computation_cols.add_rc[i] * computation_cols.add_rc[i] * computation_cols.add_rc[i]; - builder - .when(is_initial.clone() + is_external_layer.clone() + is_internal_layer.clone()) - .assert_eq(sbox_deg_3, computation_cols.sbox_deg_3[i]); - let sbox_deg_7 = computation_cols.sbox_deg_3[i] - * computation_cols.sbox_deg_3[i] - * computation_cols.add_rc[i]; + let sbox_deg_7 = sbox_deg_3.clone() * sbox_deg_3.clone() * computation_cols.add_rc[i]; builder .when(is_initial.clone() + is_external_layer.clone() + is_internal_layer.clone()) .assert_eq(sbox_deg_7, computation_cols.sbox_deg_7[i]); @@ -311,7 +306,7 @@ impl Poseidon2Chip { ); } - pub fn do_receive_table(local: &Poseidon2Cols) -> T { + pub const fn do_receive_table(local: &Poseidon2Cols) -> T { local.rounds[0] } @@ -445,6 +440,7 @@ mod tests { BabyBear, Poseidon2, 16, + 8, > = config.challenger(); let start = Instant::now(); uni_stark_verify(&config, &chip, &mut challenger, &proof) diff --git a/recursion/core/src/poseidon2/trace.rs b/recursion/core/src/poseidon2/trace.rs index 619c8c7743..cc6a41d94f 100644 --- a/recursion/core/src/poseidon2/trace.rs +++ b/recursion/core/src/poseidon2/trace.rs @@ -128,12 +128,11 @@ impl MachineAir for Poseidon2Chip { // Apply the sbox. for j in 0..WIDTH { - computation_cols.sbox_deg_3[j] = computation_cols.add_rc[j] + let sbox_deg_3 = computation_cols.add_rc[j] * computation_cols.add_rc[j] * computation_cols.add_rc[j]; - computation_cols.sbox_deg_7[j] = computation_cols.sbox_deg_3[j] - * computation_cols.sbox_deg_3[j] - * computation_cols.add_rc[j]; + computation_cols.sbox_deg_7[j] = + sbox_deg_3 * sbox_deg_3 * computation_cols.add_rc[j]; } // What state to use for the linear layer. diff --git a/recursion/core/src/poseidon2_wide/columns.rs b/recursion/core/src/poseidon2_wide/columns.rs index 6ea939053e..371b9d620d 100644 --- a/recursion/core/src/poseidon2_wide/columns.rs +++ b/recursion/core/src/poseidon2_wide/columns.rs @@ -51,7 +51,7 @@ impl Poseidon2ColType { } /// Returns the external sbox columns for the given round. - pub fn get_external_sbox(&self, round: usize) -> Option<&[T; WIDTH]> { + pub const fn get_external_sbox(&self, round: usize) -> Option<&[T; WIDTH]> { match self { Poseidon2ColType::Wide(cols) => Some(&cols.external_rounds_sbox[round]), Poseidon2ColType::Narrow(_) => None, @@ -59,7 +59,7 @@ impl Poseidon2ColType { } /// Returns the internal sbox columns. - pub fn get_internal_sbox(&self) -> Option<&[T; NUM_INTERNAL_ROUNDS]> { + pub const fn get_internal_sbox(&self) -> Option<&[T; NUM_INTERNAL_ROUNDS]> { match self { Poseidon2ColType::Wide(cols) => Some(&cols.internal_rounds_sbox), Poseidon2ColType::Narrow(_) => None, diff --git a/recursion/core/src/poseidon2_wide/external.rs b/recursion/core/src/poseidon2_wide/external.rs index 5438e81be7..6fb3bc870e 100644 --- a/recursion/core/src/poseidon2_wide/external.rs +++ b/recursion/core/src/poseidon2_wide/external.rs @@ -440,6 +440,13 @@ where for r in NUM_EXTERNAL_ROUNDS / 2..NUM_EXTERNAL_ROUNDS { eval_external_round(builder, &cols, r, memory.is_real); } + + // Make the degree equivalent to WIDTH to compress the interaction columns. + let mut dummy = memory.is_real * memory.is_real; + for _ in 0..(DEGREE - 2) { + dummy *= memory.is_real.into(); + } + builder.assert_eq(dummy.clone(), dummy.clone()); } } diff --git a/recursion/core/src/poseidon2_wide/mod.rs b/recursion/core/src/poseidon2_wide/mod.rs index dddb612e3f..f5531bad84 100644 --- a/recursion/core/src/poseidon2_wide/mod.rs +++ b/recursion/core/src/poseidon2_wide/mod.rs @@ -16,7 +16,6 @@ pub struct Poseidon2Event { pub input: [F; WIDTH], } -// TODO: Make this public inside Plonky3 and import directly. pub fn apply_m_4(x: &mut [AF]) where AF: AbstractField, diff --git a/recursion/core/src/program/mod.rs b/recursion/core/src/program/mod.rs index e151844ee0..c8745378a2 100644 --- a/recursion/core/src/program/mod.rs +++ b/recursion/core/src/program/mod.rs @@ -40,7 +40,7 @@ pub struct ProgramMultiplicityCols { pub struct ProgramChip; impl ProgramChip { - pub fn new() -> Self { + pub const fn new() -> Self { Self {} } } diff --git a/recursion/core/src/range_check/event.rs b/recursion/core/src/range_check/event.rs index 58e260e984..3dbdae7bb4 100644 --- a/recursion/core/src/range_check/event.rs +++ b/recursion/core/src/range_check/event.rs @@ -14,7 +14,7 @@ pub struct RangeCheckEvent { impl RangeCheckEvent { /// Creates a new `RangeCheckEvent`. - pub fn new(opcode: RangeCheckOpcode, val: u16) -> Self { + pub const fn new(opcode: RangeCheckOpcode, val: u16) -> Self { Self { opcode, val } } } diff --git a/recursion/core/src/runtime/mod.rs b/recursion/core/src/runtime/mod.rs index 1fd9ca6a67..1935c9cd69 100644 --- a/recursion/core/src/runtime/mod.rs +++ b/recursion/core/src/runtime/mod.rs @@ -2,6 +2,7 @@ mod instruction; mod opcode; mod program; mod record; +mod utils; use std::collections::VecDeque; use std::process::exit; @@ -17,8 +18,9 @@ use p3_symmetric::CryptographicPermutation; use p3_symmetric::Permutation; pub use program::*; pub use record::*; +pub use utils::*; -use crate::air::Block; +use crate::air::{Block, RECURSION_PUBLIC_VALUES_COL_MAP, RECURSIVE_PROOF_NUM_PV_ELTS}; use crate::cpu::CpuEvent; use crate::fri_fold::FriFoldEvent; use crate::memory::MemoryRecord; @@ -28,6 +30,10 @@ use crate::range_check::{RangeCheckEvent, RangeCheckOpcode}; use p3_field::{ExtensionField, PrimeField32}; use sp1_core::runtime::MemoryAccessPosition; +/// The heap pointer address. +pub const HEAP_PTR: i32 = -4; +pub const HEAP_START_ADDRESS: usize = STACK_SIZE + 4; + pub const STACK_SIZE: usize = 1 << 24; pub const MEMORY_SIZE: usize = 1 << 28; @@ -101,7 +107,7 @@ pub struct Runtime, Diffusion> { /// Uninitialized memory addresses that have a specific value they should be initialized with. /// The Opcodes that start with Hint* utilize this to set memory values. - pub uninitialized_memory: HashMap>, // TODO: add "HashNoHasher" back to this + pub uninitialized_memory: HashMap>, /// The execution record. pub record: ExecutionRecord, @@ -440,6 +446,16 @@ where let mut a_val = Block::default(); a_val[0] = b_val[0] + c_val[0]; self.mw_cpu(a_ptr, a_val, MemoryAccessPosition::A); + + // If the instruction is a heap expansion, we need to add a range check event to + // ensure that the heap size never goes above 2^28. + if instruction_is_heap_expand(&instruction) { + let (u16_range_check, u12_range_check) = + get_heap_size_range_check_events(a_val[0]); + self.record + .add_range_check_events(&[u16_range_check, u12_range_check]); + } + (a, b, c) = (a_val, b_val, c_val); } Opcode::LessThanF => { @@ -567,6 +583,12 @@ where (a, b, c) = (a_val, b_val, c_val); } Opcode::TRAP => { + self.record + .public_values + .resize(RECURSIVE_PROOF_NUM_PV_ELTS, F::zero()); + self.record.public_values[RECURSION_PUBLIC_VALUES_COL_MAP.exit_code] = F::one(); + + let (a_val, b_val, c_val) = self.all_rr(&instruction); let trap_pc = self.pc.as_canonical_u32() as usize; let trace = self.program.traces[trap_pc].clone(); if let Some(mut trace) = trace { @@ -586,16 +608,21 @@ where } eprintln!("TRAP encountered. No backtrace available"); } - exit(1); + (a, b, c) = (a_val, b_val, c_val); } Opcode::HALT => { + self.record + .public_values + .resize(RECURSIVE_PROOF_NUM_PV_ELTS, F::zero()); + self.record.public_values[RECURSION_PUBLIC_VALUES_COL_MAP.exit_code] = + F::zero(); + let (a_val, b_val, c_val) = self.all_rr(&instruction); (a, b, c) = (a_val, b_val, c_val); } - Opcode::Ext2Felt => { + Opcode::HintExt2Felt => { let (a_val, b_val, c_val) = self.all_rr(&instruction); let dst = a_val[0].as_canonical_u32() as usize; - // TODO: this should be a hint and perhaps the compiler needs to change to make it a hint? self.mw_uninitialized(dst, Block::from(b_val[0])); self.mw_uninitialized(dst + 1, Block::from(b_val[1])); self.mw_uninitialized(dst + 2, Block::from(b_val[2])); @@ -670,7 +697,7 @@ where // Get the src value. let num = b_val[0].as_canonical_u32(); - // Decompose the num into bits. + // Decompose the num into LE bits. let bits = (0..NUM_BITS).map(|i| (num >> i) & 1).collect::>(); // Write the bits to the array at dst. for (i, bit) in bits.iter().enumerate() { @@ -823,7 +850,10 @@ where self.timestamp += 1; self.access = CpuRecord::default(); - if self.timestamp >= early_exit_ts || instruction.opcode == Opcode::HALT { + if self.timestamp >= early_exit_ts + || instruction.opcode == Opcode::HALT + || instruction.opcode == Opcode::TRAP + { break; } } diff --git a/recursion/core/src/runtime/opcode.rs b/recursion/core/src/runtime/opcode.rs index fb471e443d..8c373ca201 100644 --- a/recursion/core/src/runtime/opcode.rs +++ b/recursion/core/src/runtime/opcode.rs @@ -40,7 +40,7 @@ pub enum Opcode { PrintF = 33, PrintE = 34, - Ext2Felt = 35, + HintExt2Felt = 35, FRIFold = 36, HintLen = 37, diff --git a/recursion/core/src/runtime/record.rs b/recursion/core/src/runtime/record.rs index 9e6d31da81..80f6d7b321 100644 --- a/recursion/core/src/runtime/record.rs +++ b/recursion/core/src/runtime/record.rs @@ -1,3 +1,4 @@ +use std::array; use std::collections::BTreeMap; use std::sync::Arc; @@ -82,15 +83,14 @@ impl MachineRecord for ExecutionRecord { } fn public_values(&self) -> Vec { - let mut ret = self - .public_values - .iter() - .map(|x| T::from_canonical_u32(x.as_canonical_u32())) - .collect::>(); - - // Pad the public values to the correct number of public values, in case not all are used. - ret.resize(PROOF_MAX_NUM_PVS, T::zero()); - - ret + let ret: [T; PROOF_MAX_NUM_PVS] = array::from_fn(|i| { + if i < self.public_values.len() { + T::from_canonical_u32(self.public_values[i].as_canonical_u32()) + } else { + T::zero() + } + }); + + ret.to_vec() } } diff --git a/recursion/core/src/runtime/utils.rs b/recursion/core/src/runtime/utils.rs new file mode 100644 index 0000000000..b7710186d7 --- /dev/null +++ b/recursion/core/src/runtime/utils.rs @@ -0,0 +1,33 @@ +use p3_field::PrimeField32; + +use crate::range_check::{RangeCheckEvent, RangeCheckOpcode}; + +use super::{Instruction, Opcode, HEAP_PTR, HEAP_START_ADDRESS}; + +pub fn canonical_i32_to_field(x: i32) -> F { + let modulus = F::ORDER_U32; + assert!(x < modulus as i32 && x >= -(modulus as i32)); + if x < 0 { + -F::from_canonical_u32((-x) as u32) + } else { + F::from_canonical_u32(x as u32) + } +} + +pub fn get_heap_size_range_check_events( + end_heap_address: F, +) -> (RangeCheckEvent, RangeCheckEvent) { + let heap_size = + (end_heap_address - F::from_canonical_usize(HEAP_START_ADDRESS)).as_canonical_u32(); + let diff_16bit_limb = heap_size & 0xffff; + let diff_12bit_limb = (heap_size >> 16) & 0xfff; + + ( + RangeCheckEvent::new(RangeCheckOpcode::U16, diff_16bit_limb as u16), + RangeCheckEvent::new(RangeCheckOpcode::U12, diff_12bit_limb as u16), + ) +} + +pub fn instruction_is_heap_expand(instruction: &Instruction) -> bool { + instruction.opcode == Opcode::ADD && instruction.op_a == canonical_i32_to_field(HEAP_PTR) +} diff --git a/recursion/core/src/stark/config.rs b/recursion/core/src/stark/config.rs index a1b3a22391..2a774ec437 100644 --- a/recursion/core/src/stark/config.rs +++ b/recursion/core/src/stark/config.rs @@ -74,11 +74,11 @@ pub fn outer_fri_config() -> FriConfig { } else { match std::env::var("FRI_QUERIES") { Ok(value) => value.parse().unwrap(), - Err(_) => 50, + Err(_) => 25, } }; FriConfig { - log_blowup: 2, + log_blowup: 4, num_queries, proof_of_work_bits: 16, mmcs: challenge_mmcs, diff --git a/recursion/core/src/stark/mod.rs b/recursion/core/src/stark/mod.rs index 2e97eec030..540dcb613b 100644 --- a/recursion/core/src/stark/mod.rs +++ b/recursion/core/src/stark/mod.rs @@ -16,7 +16,7 @@ use std::marker::PhantomData; use crate::runtime::D; pub type RecursionAirWideDeg3 = RecursionAir; -pub type RecursionAirSkinnyDeg7 = RecursionAir; +pub type RecursionAirSkinnyDeg9 = RecursionAir; #[derive(MachineAir)] #[sp1_core_path = "sp1_core"] @@ -25,7 +25,7 @@ pub type RecursionAirSkinnyDeg7 = RecursionAir; #[builder_path = "crate::air::SP1RecursionAirBuilder"] pub enum RecursionAir, const DEGREE: usize> { Program(ProgramChip), - Cpu(CpuChip), + Cpu(CpuChip), MemoryGlobal(MemoryGlobalChip), Poseidon2Wide(Poseidon2WideChip), Poseidon2Skinny(Poseidon2Chip), @@ -53,6 +53,15 @@ impl, const DEGREE: usize> RecursionAi StarkMachine::new(config, chips, PROOF_MAX_NUM_PVS) } + /// A recursion machine with fixed trace sizes tuned to work specifically for the wrap layer. + pub fn wrap_machine_dyn>(config: SC) -> StarkMachine { + let chips = Self::get_wrap_dyn_all() + .into_iter() + .map(Chip::new) + .collect::>(); + StarkMachine::new(config, chips, PROOF_MAX_NUM_PVS) + } + pub fn get_all() -> Vec { once(RecursionAir::Program(ProgramChip)) .chain(once(RecursionAir::Cpu(CpuChip { @@ -74,6 +83,22 @@ impl, const DEGREE: usize> RecursionAi .collect() } + pub fn get_wrap_dyn_all() -> Vec { + once(RecursionAir::Program(ProgramChip)) + .chain(once(RecursionAir::Cpu(CpuChip { + fixed_log2_rows: None, + _phantom: PhantomData, + }))) + .chain(once(RecursionAir::MemoryGlobal(MemoryGlobalChip { + fixed_log2_rows: None, + }))) + .chain(once(RecursionAir::Multi(MultiChip { + fixed_log2_rows: None, + }))) + .chain(once(RecursionAir::RangeCheck(RangeCheckChip::default()))) + .collect() + } + pub fn get_wrap_all() -> Vec { once(RecursionAir::Program(ProgramChip)) .chain(once(RecursionAir::Cpu(CpuChip { @@ -81,7 +106,7 @@ impl, const DEGREE: usize> RecursionAi _phantom: PhantomData, }))) .chain(once(RecursionAir::MemoryGlobal(MemoryGlobalChip { - fixed_log2_rows: Some(20), + fixed_log2_rows: Some(19), }))) .chain(once(RecursionAir::Multi(MultiChip { fixed_log2_rows: Some(20), diff --git a/recursion/core/src/stark/utils.rs b/recursion/core/src/stark/utils.rs index 9321d82288..15c642c046 100644 --- a/recursion/core/src/stark/utils.rs +++ b/recursion/core/src/stark/utils.rs @@ -7,7 +7,7 @@ use crate::air::Block; use crate::runtime::RecursionProgram; use crate::runtime::Runtime; use crate::stark::RecursionAir; -use crate::stark::RecursionAirSkinnyDeg7; +use crate::stark::RecursionAirSkinnyDeg9; use p3_field::PrimeField32; use sp1_core::utils::run_test_machine; use std::collections::VecDeque; @@ -54,7 +54,7 @@ pub fn run_test_recursion( } if test_config == TestConfig::All || test_config == TestConfig::SkinnyDeg7 { - let machine = RecursionAirSkinnyDeg7::machine(BabyBearPoseidon2::compressed()); + let machine = RecursionAirSkinnyDeg9::machine(BabyBearPoseidon2::compressed()); let (pk, vk) = machine.setup(&program); let record = runtime.record.clone(); let result = run_test_machine(record, machine, pk, vk); @@ -64,7 +64,7 @@ pub fn run_test_recursion( } if test_config == TestConfig::All || test_config == TestConfig::SkinnyDeg7Wrap { - let machine = RecursionAirSkinnyDeg7::wrap_machine(BabyBearPoseidon2::compressed()); + let machine = RecursionAirSkinnyDeg9::wrap_machine(BabyBearPoseidon2::compressed()); let (pk, vk) = machine.setup(&program); let record = runtime.record.clone(); let result = run_test_machine(record, machine, pk, vk); @@ -77,7 +77,7 @@ pub fn run_test_recursion( /// Returns whether the `SP1_DEV` environment variable is enabled or disabled. /// /// This variable controls whether a smaller version of the circuit will be used for generating the -/// Groth16 proofs. This is useful for development and testing purposes. +/// PLONK proofs. This is useful for development and testing purposes. /// /// By default, the variable is disabled. pub fn sp1_dev_mode() -> bool { diff --git a/recursion/derive/Cargo.toml b/recursion/derive/Cargo.toml index d566c4a121..410e544ce0 100644 --- a/recursion/derive/Cargo.toml +++ b/recursion/derive/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-recursion-derive" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [lib] proc-macro = true diff --git a/recursion/gnark-ffi/Cargo.toml b/recursion/gnark-ffi/Cargo.toml index 0c2d5d6c2c..a5270d58da 100644 --- a/recursion/gnark-ffi/Cargo.toml +++ b/recursion/gnark-ffi/Cargo.toml @@ -10,13 +10,17 @@ sp1-recursion-compiler = { path = "../compiler" } serde = "1.0.201" serde_json = "1.0.117" tempfile = "3.10.1" -reqwest = { version = "0.12", features = ["json", "blocking"] } rand = "0.8" -crossbeam = "0.8" -subtle-encoding = "0.5.1" log = "0.4.21" num-bigint = "0.4.5" +cfg-if = "1.0" [build-dependencies] bindgen = "0.69.4" cc = "1.0" +cfg-if = "1.0" + +[features] +default = ["plonk"] + +plonk = [] diff --git a/recursion/gnark-ffi/assets/ISP1Verifier.txt b/recursion/gnark-ffi/assets/ISP1Verifier.txt new file mode 100644 index 0000000000..4298f4b8cf --- /dev/null +++ b/recursion/gnark-ffi/assets/ISP1Verifier.txt @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +/// @title SP1 Verifier Interface +/// @author Succinct Labs +/// @notice This contract is the interface for the SP1 Verifier. +interface ISP1Verifier { + /// @notice Returns the version of the SP1 Verifier. + function VERSION() external pure returns (string memory); + + /// @notice Verifies a proof with given public values and vkey. + /// @param vkey The verification key for the RISC-V program. + /// @param publicValues The public values encoded as bytes. + /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes. + function verifyProof( + bytes32 vkey, + bytes memory publicValues, + bytes memory proofBytes + ) external view; +} diff --git a/recursion/gnark-ffi/assets/SP1MockVerifier.txt b/recursion/gnark-ffi/assets/SP1MockVerifier.txt new file mode 100644 index 0000000000..bf938718b6 --- /dev/null +++ b/recursion/gnark-ffi/assets/SP1MockVerifier.txt @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +import {ISP1Verifier} from "./ISP1Verifier.sol"; + +/// @title SP1 Mock Verifier +/// @author Succinct Labs +/// @notice This contracts implements a Mock solidity verifier for SP1. +contract SP1MockVerifier is ISP1Verifier { + function VERSION() external pure returns (string memory) { + return "TODO"; + } + + /// @notice Verifies a mock proof with given public values and vkey. + /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes. + function verifyProof( + bytes32, + bytes memory, + bytes memory proofBytes + ) external pure { + assert(proofBytes.length == 0); + } +} diff --git a/recursion/gnark-ffi/assets/SP1Verifier.txt b/recursion/gnark-ffi/assets/SP1Verifier.txt index ee45f9e984..f7389163e8 100644 --- a/recursion/gnark-ffi/assets/SP1Verifier.txt +++ b/recursion/gnark-ffi/assets/SP1Verifier.txt @@ -1,63 +1,15 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.25; + +import {ISP1Verifier} from "./ISP1Verifier.sol"; +import {PlonkVerifier} from "./PlonkVerifier.sol"; /// @title SP1 Verifier /// @author Succinct Labs /// @notice This contracts implements a solidity verifier for SP1. -contract SP1Verifier is Verifier { - /// @notice Deserializes a proof from the given bytes. - /// @param proofBytes The proof bytes. - function deserializeProof( - bytes memory proofBytes - ) - public - pure - returns ( - uint256[8] memory proof, - uint256[2] memory commitments, - uint256[2] memory commitmentPok - ) - { - require( - proofBytes.length == 8 * 32 + 4 + 2 * 32 + 2 * 32, - "invalid proof bytes length" - ); - - uint256 offset = 32; - for (uint256 i = 0; i < 8; i++) { - assembly { - mstore( - add(proof, add(0, mul(32, i))), - mload(add(proofBytes, add(offset, mul(32, i)))) - ) - } - } - - uint32 commitmentCount; - offset += 8 * 32; - assembly { - let dataLocation := add(proofBytes, offset) - let loadedData := mload(dataLocation) - commitmentCount := and(shr(224, loadedData), 0xFFFFFFFF) - } - - offset += 4; - for (uint256 i = 0; i < 2; i++) { - assembly { - mstore( - add(commitments, add(0, mul(32, i))), - mload(add(proofBytes, add(offset, mul(32, i)))) - ) - } - } - - offset += 2 * 32; - for (uint256 i = 0; i < 2; i++) { - assembly { - mstore( - add(commitmentPok, add(0, mul(32, i))), - mload(add(proofBytes, add(offset, mul(32, i)))) - ) - } - } +contract SP1Verifier is PlonkVerifier { + function VERSION() external pure returns (string memory) { + return "TODO"; } /// @notice Hashes the public values to a field elements inside Bn254. @@ -73,20 +25,14 @@ contract SP1Verifier is Verifier { /// @param publicValues The public values encoded as bytes. /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes. function verifyProof( - bytes32 vkey, + bytes32 vkey, bytes memory publicValues, bytes memory proofBytes ) public view { - ( - uint256[8] memory proof, - uint256[2] memory commitments, - uint256[2] memory commitmentPok - ) = deserializeProof(proofBytes); bytes32 publicValuesDigest = hashPublicValues(publicValues); - uint256[2] memory inputs = [ - uint256(vkey), - uint256(publicValuesDigest) - ]; - this.verifyProof(proof, commitments, commitmentPok, inputs); + uint256[] memory inputs = new uint256[](2); + inputs[0] = uint256(vkey); + inputs[1] = uint256(publicValuesDigest); + this.Verify(proofBytes, inputs); } -} +} \ No newline at end of file diff --git a/recursion/gnark-ffi/build.rs b/recursion/gnark-ffi/build.rs index 0d91e1b970..35c3f63f10 100644 --- a/recursion/gnark-ffi/build.rs +++ b/recursion/gnark-ffi/build.rs @@ -1,3 +1,4 @@ +use cfg_if::cfg_if; use std::env; use std::path::PathBuf; use std::process::Command; @@ -7,52 +8,56 @@ use bindgen::CargoCallbacks; /// Build the go library, generate Rust bindings for the exposed functions, and link the library. fn main() { - println!("cargo:rerun-if-changed=go"); - // Define the output directory - let out_dir = env::var("OUT_DIR").unwrap(); - let dest_path = PathBuf::from(&out_dir); - let lib_name = "sp1gnark"; - let dest = dest_path.join(format!("lib{}.a", lib_name)); - - println!("Building Go library at {}", dest.display()); - - // Run the go build command - let status = Command::new("go") - .current_dir("go") - .env("CGO_ENABLED", "1") - .args([ - "build", - "-o", - dest.to_str().unwrap(), - "-buildmode=c-archive", - ".", - ]) - .status() - .expect("Failed to build Go library"); - if !status.success() { - panic!("Go build failed"); + cfg_if! { + if #[cfg(feature = "plonk")] { + println!("cargo:rerun-if-changed=go"); + // Define the output directory + let out_dir = env::var("OUT_DIR").unwrap(); + let dest_path = PathBuf::from(&out_dir); + let lib_name = "sp1gnark"; + let dest = dest_path.join(format!("lib{}.a", lib_name)); + + println!("Building Go library at {}", dest.display()); + + // Run the go build command + let status = Command::new("go") + .current_dir("go") + .env("CGO_ENABLED", "1") + .args([ + "build", + "-o", + dest.to_str().unwrap(), + "-buildmode=c-archive", + ".", + ]) + .status() + .expect("Failed to build Go library"); + if !status.success() { + panic!("Go build failed"); + } + + // Copy go/babybear.h to OUT_DIR/babybear.h + let header_src = PathBuf::from("go/babybear.h"); + let header_dest = dest_path.join("babybear.h"); + std::fs::copy(header_src, header_dest).unwrap(); + + // Generate bindings using bindgen + let header_path = dest_path.join(format!("lib{}.h", lib_name)); + let bindings = bindgen::Builder::default() + .header(header_path.to_str().unwrap()) + .parse_callbacks(Box::new(CargoCallbacks::new())) + .generate() + .expect("Unable to generate bindings"); + + bindings + .write_to_file(dest_path.join("bindings.rs")) + .expect("Couldn't write bindings!"); + + println!("Go library built"); + + // Link the Go library + println!("cargo:rustc-link-search=native={}", dest_path.display()); + println!("cargo:rustc-link-lib=static={}", lib_name); + } } - - // Copy go/babybear.h to OUT_DIR/babybear.h - let header_src = PathBuf::from("go/babybear.h"); - let header_dest = dest_path.join("babybear.h"); - std::fs::copy(header_src, header_dest).unwrap(); - - // Generate bindings using bindgen - let header_path = dest_path.join(format!("lib{}.h", lib_name)); - let bindings = bindgen::Builder::default() - .header(header_path.to_str().unwrap()) - .parse_callbacks(Box::new(CargoCallbacks::new())) - .generate() - .expect("Unable to generate bindings"); - - bindings - .write_to_file(dest_path.join("bindings.rs")) - .expect("Couldn't write bindings!"); - - println!("Go library built"); - - // Link the Go library - println!("cargo:rustc-link-search=native={}", dest_path.display()); - println!("cargo:rustc-link-lib=static={}", lib_name); } diff --git a/recursion/gnark-ffi/go/go.mod b/recursion/gnark-ffi/go/go.mod index 8cfcfd6d7e..505279b9dc 100644 --- a/recursion/gnark-ffi/go/go.mod +++ b/recursion/gnark-ffi/go/go.mod @@ -12,6 +12,7 @@ require ( github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/consensys/bavard v0.1.13 // indirect + github.com/consensys/gnark-ignition-verifier v0.0.0-20230527014722-10693546ab33 github.com/davecgh/go-spew v1.1.1 // indirect github.com/fxamacker/cbor/v2 v2.5.0 // indirect github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect diff --git a/recursion/gnark-ffi/go/go.sum b/recursion/gnark-ffi/go/go.sum index a2d96911cf..1cba1df674 100644 --- a/recursion/gnark-ffi/go/go.sum +++ b/recursion/gnark-ffi/go/go.sum @@ -8,6 +8,8 @@ github.com/consensys/gnark v0.10.1-0.20240504023521-d9bfacd7cb60 h1:+m2KO2BeqBkH github.com/consensys/gnark v0.10.1-0.20240504023521-d9bfacd7cb60/go.mod h1:DU7zXvIuOqheiS3EgVdD7ydbXDiLh71FkaArWPxwJqY= github.com/consensys/gnark-crypto v0.12.2-0.20240504013751-564b6f724c3b h1:tu0NaVr64o6vXzy9rYSK/LCZXmS+u/k9eP1F8OtRUWQ= github.com/consensys/gnark-crypto v0.12.2-0.20240504013751-564b6f724c3b/go.mod h1:wKqwsieaKPThcFkHe0d0zMsbHEUWFmZcG7KBCse210o= +github.com/consensys/gnark-ignition-verifier v0.0.0-20230527014722-10693546ab33 h1:z42ewLaLxoTYeQ17arcF4WExZc/eSaN3YVlF7eEaPt4= +github.com/consensys/gnark-ignition-verifier v0.0.0-20230527014722-10693546ab33/go.mod h1:JdKor28c/KR4BbznP88bz8AAvnCgovzrB3KWsiR7lwk= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/recursion/gnark-ffi/go/main.go b/recursion/gnark-ffi/go/main.go index 7e842d3d75..89bba4a7e8 100644 --- a/recursion/gnark-ffi/go/main.go +++ b/recursion/gnark-ffi/go/main.go @@ -7,7 +7,7 @@ typedef struct { char *PublicInputs[2]; char *EncodedProof; char *RawProof; -} C_Groth16Proof; +} C_PlonkBn254Proof; */ import "C" import ( @@ -17,50 +17,51 @@ import ( "sync" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend/groth16" + "github.com/consensys/gnark/backend/plonk" "github.com/consensys/gnark/frontend" - "github.com/consensys/gnark/frontend/cs/r1cs" + "github.com/consensys/gnark/frontend/cs/scs" + "github.com/consensys/gnark/test/unsafekzg" "github.com/succinctlabs/sp1-recursion-gnark/sp1" ) func main() {} -//export ProveGroth16 -func ProveGroth16(dataDir *C.char, witnessPath *C.char) *C.C_Groth16Proof { +//export ProvePlonkBn254 +func ProvePlonkBn254(dataDir *C.char, witnessPath *C.char) *C.C_PlonkBn254Proof { dataDirString := C.GoString(dataDir) witnessPathString := C.GoString(witnessPath) - sp1Groth16Proof := sp1.ProveGroth16(dataDirString, witnessPathString) + sp1PlonkBn254Proof := sp1.Prove(dataDirString, witnessPathString) - ms := C.malloc(C.sizeof_C_Groth16Proof) + ms := C.malloc(C.sizeof_C_PlonkBn254Proof) if ms == nil { return nil } - structPtr := (*C.C_Groth16Proof)(ms) - structPtr.PublicInputs[0] = C.CString(sp1Groth16Proof.PublicInputs[0]) - structPtr.PublicInputs[1] = C.CString(sp1Groth16Proof.PublicInputs[1]) - structPtr.EncodedProof = C.CString(sp1Groth16Proof.EncodedProof) - structPtr.RawProof = C.CString(sp1Groth16Proof.RawProof) + structPtr := (*C.C_PlonkBn254Proof)(ms) + structPtr.PublicInputs[0] = C.CString(sp1PlonkBn254Proof.PublicInputs[0]) + structPtr.PublicInputs[1] = C.CString(sp1PlonkBn254Proof.PublicInputs[1]) + structPtr.EncodedProof = C.CString(sp1PlonkBn254Proof.EncodedProof) + structPtr.RawProof = C.CString(sp1PlonkBn254Proof.RawProof) return structPtr } -//export BuildGroth16 -func BuildGroth16(dataDir *C.char) { +//export BuildPlonkBn254 +func BuildPlonkBn254(dataDir *C.char) { // Sanity check the required arguments have been provided. dataDirString := C.GoString(dataDir) - sp1.BuildGroth16(dataDirString) + sp1.Build(dataDirString) } -//export VerifyGroth16 -func VerifyGroth16(dataDir *C.char, proof *C.char, vkeyHash *C.char, commitedValuesDigest *C.char) *C.char { +//export VerifyPlonkBn254 +func VerifyPlonkBn254(dataDir *C.char, proof *C.char, vkeyHash *C.char, commitedValuesDigest *C.char) *C.char { dataDirString := C.GoString(dataDir) proofString := C.GoString(proof) vkeyHashString := C.GoString(vkeyHash) commitedValuesDigestString := C.GoString(commitedValuesDigest) - err := sp1.VerifyGroth16(dataDirString, proofString, vkeyHashString, commitedValuesDigestString) + err := sp1.Verify(dataDirString, proofString, vkeyHashString, commitedValuesDigestString) if err != nil { return C.CString(err.Error()) } @@ -69,8 +70,8 @@ func VerifyGroth16(dataDir *C.char, proof *C.char, vkeyHash *C.char, commitedVal var testMutex = &sync.Mutex{} -//export TestGroth16 -func TestGroth16(witnessPath *C.char, constraintsJson *C.char) *C.char { +//export TestPlonkBn254 +func TestPlonkBn254(witnessPath *C.char, constraintsJson *C.char) *C.char { // Because of the global env variables used here, we need to lock this function testMutex.Lock() witnessPathString := C.GoString(witnessPath) @@ -107,16 +108,20 @@ func TestMain() error { // Compile the circuit. circuit := sp1.NewCircuit(inputs) - builder := r1cs.NewBuilder - r1cs, err := frontend.Compile(ecc.BN254.ScalarField(), builder, &circuit) + builder := scs.NewBuilder + scs, err := frontend.Compile(ecc.BN254.ScalarField(), builder, &circuit) if err != nil { return err } - fmt.Println("[sp1] groth16 verifier constraints:", r1cs.GetNbConstraints()) + fmt.Println("[sp1] gnark verifier constraints:", scs.GetNbConstraints()) // Run the dummy setup. - var pk groth16.ProvingKey - pk, err = groth16.DummySetup(r1cs) + srs, srsLagrange, err := unsafekzg.NewSRS(scs) + if err != nil { + return err + } + var pk plonk.ProvingKey + pk, _, err = plonk.Setup(scs, srs, srsLagrange) if err != nil { return err } @@ -129,7 +134,7 @@ func TestMain() error { } // Generate the proof. - _, err = groth16.Prove(r1cs, pk, witness) + _, err = plonk.Prove(scs, pk, witness) if err != nil { return err } diff --git a/recursion/gnark-ffi/go/sp1/build.go b/recursion/gnark-ffi/go/sp1/build.go index ccbfb5449d..ccd278c1d5 100644 --- a/recursion/gnark-ffi/go/sp1/build.go +++ b/recursion/gnark-ffi/go/sp1/build.go @@ -1,27 +1,30 @@ package sp1 import ( - "crypto/sha256" "encoding/json" + "fmt" + "log" "os" + "strings" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" - "github.com/consensys/gnark/backend/groth16" + "github.com/consensys/gnark-crypto/kzg" + "github.com/consensys/gnark/backend/plonk" "github.com/consensys/gnark/frontend" - "github.com/consensys/gnark/frontend/cs/r1cs" + "github.com/consensys/gnark/frontend/cs/scs" + "github.com/consensys/gnark/test/unsafekzg" + "github.com/succinctlabs/sp1-recursion-gnark/sp1/trusted_setup" ) -func BuildGroth16(dataDir string) { - +func Build(dataDir string) { // Set the enviroment variable for the constraints file. // - // TODO: There might be some non-determinism if a single processe is running this command + // TODO: There might be some non-determinism if a single process is running this command // multiple times. os.Setenv("CONSTRAINTS_JSON", dataDir+"/"+CONSTRAINTS_JSON_FILE) // Read the file. - witnessInputPath := dataDir + "/witness_groth16.json" + witnessInputPath := dataDir + "/witness.json" data, err := os.ReadFile(witnessInputPath) if err != nil { panic(err) @@ -38,13 +41,96 @@ func BuildGroth16(dataDir string) { circuit := NewCircuit(witnessInput) // Compile the circuit. - r1cs, err := frontend.Compile(ecc.BN254.ScalarField(), r1cs.NewBuilder, &circuit) + scs, err := frontend.Compile(ecc.BN254.ScalarField(), scs.NewBuilder, &circuit) + if err != nil { + panic(err) + } + + // Download the trusted setup. + var srs kzg.SRS = kzg.NewSRS(ecc.BN254) + var srsLagrange kzg.SRS = kzg.NewSRS(ecc.BN254) + srsFileName := dataDir + "/" + SRS_FILE + srsLagrangeFileName := dataDir + "/" + SRS_LAGRANGE_FILE + + srsLagrangeFile, err := os.Create(srsLagrangeFileName) if err != nil { + log.Fatal("error creating srs file: ", err) panic(err) } + defer srsLagrangeFile.Close() + + if !strings.Contains(dataDir, "dev") { + if _, err := os.Stat(srsFileName); os.IsNotExist(err) { + fmt.Println("downloading aztec ignition srs") + trusted_setup.DownloadAndSaveAztecIgnitionSrs(174, srsFileName) + + srsFile, err := os.Open(srsFileName) + if err != nil { + panic(err) + } + defer srsFile.Close() + + _, err = srs.ReadFrom(srsFile) + srsFile.Close() + if err != nil { + panic(err) + } + + srsLagrange = trusted_setup.ToLagrange(scs, srs) + _, err = srsLagrange.WriteTo(srsLagrangeFile) + if err != nil { + panic(err) + } + } else { + srsFile, err := os.Open(srsFileName) + if err != nil { + panic(err) + } + defer srsFile.Close() + + _, err = srs.ReadFrom(srsFile) + srsFile.Close() + if err != nil { + panic(err) + } + + srsLagrangeFile, err := os.Open(srsLagrangeFileName) + if err != nil { + panic(err) + } + defer srsLagrangeFile.Close() + + _, err = srsLagrange.ReadFrom(srsLagrangeFile) + srsLagrangeFile.Close() + if err != nil { + panic(err) + } + } + } else { + srs, srsLagrange, err = unsafekzg.NewSRS(scs) + if err != nil { + panic(err) + } + + srsFile, err := os.Create(srsFileName) + if err != nil { + panic(err) + } + defer srsFile.Close() + + _, err = srs.WriteTo(srsFile) + if err != nil { + panic(err) + } + + _, err = srsLagrange.WriteTo(srsLagrangeFile) + if err != nil { + panic(err) + } + } - // Perform the trusted setup. - pk, vk, err := groth16.Setup(r1cs) + // Generate the proving and verifying key. + pk, vk, err := plonk.Setup(scs, srs, srsLagrange) if err != nil { panic(err) } @@ -55,7 +141,7 @@ func BuildGroth16(dataDir string) { if err != nil { panic(err) } - proof, err := groth16.Prove(r1cs, pk, witness, backend.WithProverHashToFieldFunction(sha256.New())) + proof, err := plonk.Prove(scs, pk, witness) if err != nil { panic(err) } @@ -65,7 +151,7 @@ func BuildGroth16(dataDir string) { if err != nil { panic(err) } - err = groth16.Verify(proof, vk, publicWitness, backend.WithVerifierHashToFieldFunction(sha256.New())) + err = plonk.Verify(proof, vk, publicWitness) if err != nil { panic(err) } @@ -81,12 +167,12 @@ func BuildGroth16(dataDir string) { vk.ExportSolidity(solidityVerifierFile) // Write the R1CS. - r1csFile, err := os.Create(dataDir + "/" + CIRCUIT_PATH) + scsFile, err := os.Create(dataDir + "/" + CIRCUIT_PATH) if err != nil { panic(err) } - defer r1csFile.Close() - _, err = r1cs.WriteTo(r1csFile) + defer scsFile.Close() + _, err = scs.WriteTo(scsFile) if err != nil { panic(err) } @@ -108,5 +194,8 @@ func BuildGroth16(dataDir string) { panic(err) } defer pkFile.Close() - pk.WriteDump(pkFile) + _, err = pk.WriteTo(pkFile) + if err != nil { + panic(err) + } } diff --git a/recursion/gnark-ffi/go/sp1/poseidon2/poseidon2_test.go b/recursion/gnark-ffi/go/sp1/poseidon2/poseidon2_test.go index 2352169fe1..d7bf417f70 100644 --- a/recursion/gnark-ffi/go/sp1/poseidon2/poseidon2_test.go +++ b/recursion/gnark-ffi/go/sp1/poseidon2/poseidon2_test.go @@ -48,5 +48,5 @@ func TestPoseidon2(t *testing.T) { circuit = TestPoseidon2Circuit{Input: input, ExpectedOutput: expected_output} witness = TestPoseidon2Circuit{Input: input, ExpectedOutput: expected_output} - assert.ProverSucceeded(&circuit, &witness, test.WithCurves(ecc.BN254), test.WithBackends(backend.GROTH16)) + assert.ProverSucceeded(&circuit, &witness, test.WithCurves(ecc.BN254), test.WithBackends(backend.PLONK)) } diff --git a/recursion/gnark-ffi/go/sp1/prove.go b/recursion/gnark-ffi/go/sp1/prove.go index 9db841feed..c921d11435 100644 --- a/recursion/gnark-ffi/go/sp1/prove.go +++ b/recursion/gnark-ffi/go/sp1/prove.go @@ -1,17 +1,15 @@ package sp1 import ( - "crypto/sha256" "encoding/json" "os" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" - "github.com/consensys/gnark/backend/groth16" + "github.com/consensys/gnark/backend/plonk" "github.com/consensys/gnark/frontend" ) -func ProveGroth16(dataDir string, witnessPath string) Groth16Proof { +func Prove(dataDir string, witnessPath string) Proof { // Sanity check the required arguments have been provided. if dataDir == "" { panic("dataDirStr is required") @@ -19,27 +17,27 @@ func ProveGroth16(dataDir string, witnessPath string) Groth16Proof { os.Setenv("CONSTRAINTS_JSON", dataDir+"/"+CONSTRAINTS_JSON_FILE) // Read the R1CS. - r1csFile, err := os.Open(dataDir + "/" + CIRCUIT_PATH) + scsFile, err := os.Open(dataDir + "/" + CIRCUIT_PATH) if err != nil { panic(err) } - r1cs := groth16.NewCS(ecc.BN254) - r1cs.ReadFrom(r1csFile) + scs := plonk.NewCS(ecc.BN254) + scs.ReadFrom(scsFile) // Read the proving key. pkFile, err := os.Open(dataDir + "/" + PK_PATH) if err != nil { panic(err) } - pk := groth16.NewProvingKey(ecc.BN254) - pk.ReadDump(pkFile) + pk := plonk.NewProvingKey(ecc.BN254) + pk.UnsafeReadFrom(pkFile) // Read the verifier key. vkFile, err := os.Open(dataDir + "/" + VK_PATH) if err != nil { panic(err) } - vk := groth16.NewVerifyingKey(ecc.BN254) + vk := plonk.NewVerifyingKey(ecc.BN254) vk.ReadFrom(vkFile) // Read the file. @@ -67,16 +65,16 @@ func ProveGroth16(dataDir string, witnessPath string) Groth16Proof { } // Generate the proof. - proof, err := groth16.Prove(r1cs, pk, witness, backend.WithProverHashToFieldFunction(sha256.New())) + proof, err := plonk.Prove(scs, pk, witness) if err != nil { panic(err) } // Verify proof. - err = groth16.Verify(proof, vk, publicWitness, backend.WithVerifierHashToFieldFunction(sha256.New())) + err = plonk.Verify(proof, vk, publicWitness) if err != nil { panic(err) } - return NewSP1Groth16Proof(&proof, witnessInput) + return NewSP1PlonkBn254Proof(&proof, witnessInput) } diff --git a/recursion/gnark-ffi/go/sp1/sp1.go b/recursion/gnark-ffi/go/sp1/sp1.go index a2e20a1138..f3f3b24a51 100644 --- a/recursion/gnark-ffi/go/sp1/sp1.go +++ b/recursion/gnark-ffi/go/sp1/sp1.go @@ -11,12 +11,14 @@ import ( "github.com/succinctlabs/sp1-recursion-gnark/sp1/poseidon2" ) -var CONSTRAINTS_JSON_FILE string = "constraints_groth16.json" -var WITNESS_JSON_FILE string = "witness_groth16.json" -var VERIFIER_CONTRACT_PATH string = "SP1Verifier.sol" -var CIRCUIT_PATH string = "circuit_groth16.bin" -var VK_PATH string = "vk_groth16.bin" -var PK_PATH string = "pk_groth16.bin" +var SRS_FILE string = "srs.bin" +var SRS_LAGRANGE_FILE string = "srs_lagrange.bin" +var CONSTRAINTS_JSON_FILE string = "constraints.json" +var WITNESS_JSON_FILE string = "witness.json" +var VERIFIER_CONTRACT_PATH string = "PlonkVerifier.sol" +var CIRCUIT_PATH string = "circuit.bin" +var VK_PATH string = "vk.bin" +var PK_PATH string = "pk.bin" type Circuit struct { VkeyHash frontend.Variable `gnark:",public"` @@ -39,7 +41,7 @@ type WitnessInput struct { CommitedValuesDigest string `json:"commited_values_digest"` } -type Groth16Proof struct { +type Proof struct { PublicInputs [2]string `json:"public_inputs"` EncodedProof string `json:"encoded_proof"` RawProof string `json:"raw_proof"` diff --git a/recursion/gnark-ffi/go/sp1/trusted_setup/trusted_setup.go b/recursion/gnark-ffi/go/sp1/trusted_setup/trusted_setup.go new file mode 100644 index 0000000000..fcafee1739 --- /dev/null +++ b/recursion/gnark-ffi/go/sp1/trusted_setup/trusted_setup.go @@ -0,0 +1,170 @@ +package trusted_setup + +import ( + "log" + "os" + + stdbits "math/bits" + + "github.com/consensys/gnark-crypto/ecc/bn254" + "github.com/consensys/gnark-crypto/ecc/bn254/fr" + kzg_bn254 "github.com/consensys/gnark-crypto/ecc/bn254/kzg" + "github.com/consensys/gnark-crypto/kzg" + "github.com/consensys/gnark-ignition-verifier/ignition" + "github.com/consensys/gnark/constraint" +) + +func sanityCheck(srs *kzg_bn254.SRS) { + // we can now use the SRS to verify a proof + // create a polynomial + f := randomPolynomial(60) + + // commit the polynomial + digest, err := kzg_bn254.Commit(f, srs.Pk) + if err != nil { + log.Fatal(err) + } + + // compute opening proof at a random point + var point fr.Element + point.SetString("4321") + proof, err := kzg_bn254.Open(f, point, srs.Pk) + if err != nil { + log.Fatal(err) + } + + // verify the claimed valued + expected := eval(f, point) + if !proof.ClaimedValue.Equal(&expected) { + log.Fatal("inconsistent claimed value") + } + + // verify correct proof + err = kzg_bn254.Verify(&digest, &proof, point, srs.Vk) + if err != nil { + log.Fatal(err) + } +} + +func randomPolynomial(size int) []fr.Element { + f := make([]fr.Element, size) + for i := 0; i < size; i++ { + f[i].SetRandom() + } + return f +} + +// eval returns p(point) where p is interpreted as a polynomial +// ∑_{i= 0; i-- { + res.Mul(&res, &point).Add(&res, &p[i]) + } + return res +} + +func DownloadAndSaveAztecIgnitionSrs(startIdx int, fileName string) { + config := ignition.Config{ + BaseURL: "https://aztec-ignition.s3.amazonaws.com/", + Ceremony: "MAIN IGNITION", // "TINY_TEST_5" + CacheDir: "./data", + } + + if config.CacheDir != "" { + err := os.MkdirAll(config.CacheDir, os.ModePerm) + + if err != nil { + log.Fatal("when creating cache dir: ", err) + panic(err) + } + } + + log.Println("fetch manifest") + + manifest, err := ignition.NewManifest(config) + + if err != nil { + log.Fatal("when fetching manifest: ", err) + } + + current, next := ignition.NewContribution(manifest.NumG1Points), ignition.NewContribution(manifest.NumG1Points) + + if err := current.Get(manifest.Participants[startIdx], config); err != nil { + log.Fatal("when fetching contribution: ", err) + } + if err := next.Get(manifest.Participants[startIdx+1], config); err != nil { + log.Fatal("when fetching contribution: ", err) + } + if !next.Follows(¤t) { + log.Fatalf("contribution %d does not follow contribution %d", startIdx+1, startIdx) + } + + for i := startIdx + 2; i < len(manifest.Participants); i++ { + log.Println("processing contribution ", i+1) + current, next = next, current + if err := next.Get(manifest.Participants[i], config); err != nil { + log.Fatal("when fetching contribution ", i+1, ": ", err) + } + if !next.Follows(¤t) { + log.Fatal("contribution ", i+1, " does not follow contribution ", i, ": ", err) + } + } + + log.Println("success ✅: all contributions are valid") + + _, _, _, g2gen := bn254.Generators() + // we use the last contribution to build a kzg SRS for bn254 + srs := kzg_bn254.SRS{ + Pk: kzg_bn254.ProvingKey{ + G1: next.G1, + }, + Vk: kzg_bn254.VerifyingKey{ + G1: next.G1[0], + G2: [2]bn254.G2Affine{ + g2gen, + next.G2[0], + }, + }, + } + + // sanity check + sanityCheck(&srs) + log.Println("success ✅: kzg sanity check with SRS") + + fSRS, err := os.Create(fileName) + if err != nil { + log.Fatal("error creating srs file: ", err) + panic(err) + } + defer fSRS.Close() + + _, err = srs.WriteTo(fSRS) + if err != nil { + log.Fatal("error writing srs file: ", err) + panic(err) + } +} + +func ToLagrange(scs constraint.ConstraintSystem, canonicalSRS kzg.SRS) kzg.SRS { + var lagrangeSRS kzg.SRS + + switch srs := canonicalSRS.(type) { + case *kzg_bn254.SRS: + var err error + sizeSystem := scs.GetNbPublicVariables() + scs.GetNbConstraints() + nextPowerTwo := 1 << stdbits.Len(uint(sizeSystem)) + newSRS := &kzg_bn254.SRS{Vk: srs.Vk} + newSRS.Pk.G1, err = kzg_bn254.ToLagrangeG1(srs.Pk.G1[:nextPowerTwo]) + if err != nil { + panic(err) + } + lagrangeSRS = newSRS + default: + panic("unrecognized curve") + } + + return lagrangeSRS +} diff --git a/recursion/gnark-ffi/go/sp1/utils.go b/recursion/gnark-ffi/go/sp1/utils.go index cade74b5fe..ac898c28bb 100644 --- a/recursion/gnark-ffi/go/sp1/utils.go +++ b/recursion/gnark-ffi/go/sp1/utils.go @@ -3,52 +3,23 @@ package sp1 import ( "bytes" "encoding/hex" - "math/big" - "github.com/consensys/gnark/backend/groth16" + "github.com/consensys/gnark/backend/plonk" "github.com/consensys/gnark/frontend" "github.com/succinctlabs/sp1-recursion-gnark/sp1/babybear" ) -func NewSP1Groth16Proof(proof *groth16.Proof, witnessInput WitnessInput) Groth16Proof { +func NewSP1PlonkBn254Proof(proof *plonk.Proof, witnessInput WitnessInput) Proof { var buf bytes.Buffer (*proof).WriteRawTo(&buf) proofBytes := buf.Bytes() - fpSize := 4 * 8 - var ( - a [2]*big.Int - b [2][2]*big.Int - c [2]*big.Int - ) - a[0] = new(big.Int).SetBytes(proofBytes[fpSize*0 : fpSize*1]) - a[1] = new(big.Int).SetBytes(proofBytes[fpSize*1 : fpSize*2]) - b[0][0] = new(big.Int).SetBytes(proofBytes[fpSize*2 : fpSize*3]) - b[0][1] = new(big.Int).SetBytes(proofBytes[fpSize*3 : fpSize*4]) - b[1][0] = new(big.Int).SetBytes(proofBytes[fpSize*4 : fpSize*5]) - b[1][1] = new(big.Int).SetBytes(proofBytes[fpSize*5 : fpSize*6]) - c[0] = new(big.Int).SetBytes(proofBytes[fpSize*6 : fpSize*7]) - c[1] = new(big.Int).SetBytes(proofBytes[fpSize*7 : fpSize*8]) - - commitmentCountBigInt := new(big.Int).SetBytes(proofBytes[fpSize*8 : fpSize*8+4]) - commitmentCount := int(commitmentCountBigInt.Int64()) - - var commitments []*big.Int = make([]*big.Int, 2*commitmentCount) - var commitmentPok [2]*big.Int - - for i := 0; i < 2*commitmentCount; i++ { - commitments[i] = new(big.Int).SetBytes(proofBytes[fpSize*8+4+i*fpSize : fpSize*8+4+(i+1)*fpSize]) - } - - commitmentPok[0] = new(big.Int).SetBytes(proofBytes[fpSize*8+4+2*commitmentCount*fpSize : fpSize*8+4+2*commitmentCount*fpSize+fpSize]) - commitmentPok[1] = new(big.Int).SetBytes(proofBytes[fpSize*8+4+2*commitmentCount*fpSize+fpSize : fpSize*8+4+2*commitmentCount*fpSize+2*fpSize]) - var publicInputs [2]string publicInputs[0] = witnessInput.VkeyHash publicInputs[1] = witnessInput.CommitedValuesDigest encodedProof := hex.EncodeToString(proofBytes) - return Groth16Proof{ + return Proof{ PublicInputs: publicInputs, EncodedProof: encodedProof, RawProof: hex.EncodeToString(proofBytes), diff --git a/recursion/gnark-ffi/go/sp1/verify.go b/recursion/gnark-ffi/go/sp1/verify.go index c5ed991ff6..0d7b5f21ad 100644 --- a/recursion/gnark-ffi/go/sp1/verify.go +++ b/recursion/gnark-ffi/go/sp1/verify.go @@ -2,18 +2,16 @@ package sp1 import ( "bytes" - "crypto/sha256" "encoding/hex" "os" "github.com/consensys/gnark-crypto/ecc" - "github.com/consensys/gnark/backend" - "github.com/consensys/gnark/backend/groth16" + "github.com/consensys/gnark/backend/plonk" "github.com/consensys/gnark/frontend" "github.com/succinctlabs/sp1-recursion-gnark/sp1/babybear" ) -func VerifyGroth16(verifyCmdDataDir string, verifyCmdProof string, verifyCmdVkeyHash string, verifyCmdCommitedValuesDigest string) error { +func Verify(verifyCmdDataDir string, verifyCmdProof string, verifyCmdVkeyHash string, verifyCmdCommitedValuesDigest string) error { // Sanity check the required arguments have been provided. if verifyCmdDataDir == "" { panic("--data is required") @@ -24,7 +22,7 @@ func VerifyGroth16(verifyCmdDataDir string, verifyCmdProof string, verifyCmdVkey if err != nil { panic(err) } - proof := groth16.NewProof(ecc.BN254) + proof := plonk.NewProof(ecc.BN254) if _, err := proof.ReadFrom(bytes.NewReader(proofDecodedBytes)); err != nil { panic(err) } @@ -34,7 +32,7 @@ func VerifyGroth16(verifyCmdDataDir string, verifyCmdProof string, verifyCmdVkey if err != nil { panic(err) } - vk := groth16.NewVerifyingKey(ecc.BN254) + vk := plonk.NewVerifyingKey(ecc.BN254) vk.ReadFrom(vkFile) // Compute the public witness. @@ -55,6 +53,6 @@ func VerifyGroth16(verifyCmdDataDir string, verifyCmdProof string, verifyCmdVkey } // Verify proof. - err = groth16.Verify(proof, vk, publicWitness, backend.WithVerifierHashToFieldFunction(sha256.New())) + err = plonk.Verify(proof, vk, publicWitness) return err } diff --git a/recursion/gnark-ffi/src/ffi.rs b/recursion/gnark-ffi/src/ffi.rs index 9edc9d11a7..3ab6914cb7 100644 --- a/recursion/gnark-ffi/src/ffi.rs +++ b/recursion/gnark-ffi/src/ffi.rs @@ -3,80 +3,107 @@ //! 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::Groth16Proof; +use crate::PlonkBn254Proof; +use cfg_if::cfg_if; use std::ffi::{c_char, CString}; #[allow(warnings, clippy::all)] mod bind { + #[cfg(feature = "plonk")] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } use bind::*; -pub fn prove_groth16(data_dir: &str, witness_path: &str) -> Groth16Proof { - let data_dir = CString::new(data_dir).expect("CString::new failed"); - let witness_path = CString::new(witness_path).expect("CString::new failed"); +pub fn prove_plonk_bn254(data_dir: &str, witness_path: &str) -> PlonkBn254Proof { + cfg_if! { + if #[cfg(feature = "plonk")] { + let data_dir = CString::new(data_dir).expect("CString::new failed"); + let witness_path = CString::new(witness_path).expect("CString::new failed"); - let proof = unsafe { - let proof = bind::ProveGroth16( - data_dir.as_ptr() as *mut c_char, - witness_path.as_ptr() as *mut c_char, - ); - // Safety: The pointer is returned from the go code and is guaranteed to be valid. - *proof - }; + let proof = unsafe { + let proof = bind::ProvePlonkBn254( + data_dir.as_ptr() as *mut c_char, + witness_path.as_ptr() as *mut c_char, + ); + // Safety: The pointer is returned from the go code and is guaranteed to be valid. + *proof + }; - proof.into_rust() + proof.into_rust() + } else { + panic!("plonk feature not enabled"); + } + } } -pub fn build_groth16(data_dir: &str) { - let data_dir = CString::new(data_dir).expect("CString::new failed"); +pub fn build_plonk_bn254(data_dir: &str) { + cfg_if! { + if #[cfg(feature = "plonk")] { + let data_dir = CString::new(data_dir).expect("CString::new failed"); - unsafe { - bind::BuildGroth16(data_dir.as_ptr() as *mut c_char); + unsafe { + bind::BuildPlonkBn254(data_dir.as_ptr() as *mut c_char); + } + } else { + panic!("plonk feature not enabled"); + + } } } -pub fn verify_groth16( +pub fn verify_plonk_bn254( data_dir: &str, proof: &str, vkey_hash: &str, committed_values_digest: &str, ) -> Result<(), String> { - let data_dir = CString::new(data_dir).expect("CString::new failed"); - let proof = CString::new(proof).expect("CString::new failed"); - let vkey_hash = CString::new(vkey_hash).expect("CString::new failed"); - let committed_values_digest = - CString::new(committed_values_digest).expect("CString::new failed"); + cfg_if! { + if #[cfg(feature = "plonk")] { + let data_dir = CString::new(data_dir).expect("CString::new failed"); + let proof = CString::new(proof).expect("CString::new failed"); + let vkey_hash = CString::new(vkey_hash).expect("CString::new failed"); + let committed_values_digest = + CString::new(committed_values_digest).expect("CString::new failed"); - let err_ptr = unsafe { - bind::VerifyGroth16( - data_dir.as_ptr() as *mut c_char, - proof.as_ptr() as *mut c_char, - vkey_hash.as_ptr() as *mut c_char, - committed_values_digest.as_ptr() as *mut c_char, - ) - }; - if err_ptr.is_null() { - Ok(()) - } else { - // Safety: The error message is returned from the go code and is guaranteed to be valid. - let err = unsafe { CString::from_raw(err_ptr) }; - Err(err.into_string().unwrap()) + let err_ptr = unsafe { + bind::VerifyPlonkBn254( + data_dir.as_ptr() as *mut c_char, + proof.as_ptr() as *mut c_char, + vkey_hash.as_ptr() as *mut c_char, + committed_values_digest.as_ptr() as *mut c_char, + ) + }; + if err_ptr.is_null() { + Ok(()) + } else { + // Safety: The error message is returned from the go code and is guaranteed to be valid. + let err = unsafe { CString::from_raw(err_ptr) }; + Err(err.into_string().unwrap()) + } + } else { + panic!("plonk feature not enabled"); + } } } -pub fn test_groth16(witness_json: &str, constraints_json: &str) { - unsafe { - let witness_json = CString::new(witness_json).expect("CString::new failed"); - let build_dir = CString::new(constraints_json).expect("CString::new failed"); - let err_ptr = bind::TestGroth16( - witness_json.as_ptr() as *mut c_char, - build_dir.as_ptr() as *mut c_char, - ); - if !err_ptr.is_null() { - // Safety: The error message is returned from the go code and is guaranteed to be valid. - let err = CString::from_raw(err_ptr); - panic!("TestGroth16 failed: {}", err.into_string().unwrap()); +pub fn test_plonk_bn254(witness_json: &str, constraints_json: &str) { + cfg_if! { + if #[cfg(feature = "plonk")] { + unsafe { + let witness_json = CString::new(witness_json).expect("CString::new failed"); + let build_dir = CString::new(constraints_json).expect("CString::new failed"); + let err_ptr = bind::TestPlonkBn254( + witness_json.as_ptr() as *mut c_char, + build_dir.as_ptr() as *mut c_char, + ); + if !err_ptr.is_null() { + // Safety: The error message is returned from the go code and is guaranteed to be valid. + let err = CString::from_raw(err_ptr); + panic!("TestPlonkBn254 failed: {}", err.into_string().unwrap()); + } + } + } else { + panic!("plonk feature not enabled"); } } } @@ -94,12 +121,13 @@ unsafe fn c_char_ptr_to_string(input: *mut c_char) -> String { } } -impl C_Groth16Proof { - /// Converts a C Groth16Proof into a Rust Groth16Proof, freeing the C strings. - fn into_rust(self) -> Groth16Proof { +#[cfg(feature = "plonk")] +impl C_PlonkBn254Proof { + /// Converts a C PlonkBn254Proof into a Rust PlonkBn254Proof, freeing the C strings. + fn into_rust(self) -> PlonkBn254Proof { // Safety: The raw pointers are not used anymore after converted into Rust strings. unsafe { - Groth16Proof { + PlonkBn254Proof { public_inputs: [ c_char_ptr_to_string(self.PublicInputs[0]), c_char_ptr_to_string(self.PublicInputs[1]), diff --git a/recursion/gnark-ffi/src/groth16.rs b/recursion/gnark-ffi/src/groth16.rs deleted file mode 100644 index 48b3509ee9..0000000000 --- a/recursion/gnark-ffi/src/groth16.rs +++ /dev/null @@ -1,124 +0,0 @@ -use std::{ - fs::{File, OpenOptions}, - io::Write, - path::{Path, PathBuf}, -}; - -use crate::{ - ffi::{build_groth16, prove_groth16, test_groth16, verify_groth16}, - witness::GnarkWitness, -}; - -use num_bigint::BigUint; -use serde::{Deserialize, Serialize}; -use sp1_recursion_compiler::{ - constraints::Constraint, - ir::{Config, Witness}, -}; - -/// A prover that can generate proofs with the Groth16 protocol using bindings to Gnark. -#[derive(Debug, Clone)] -pub struct Groth16Prover; - -/// A zero-knowledge proof generated by the Groth16 protocol with a Base64 encoded gnark groth16 proof. -#[derive(Debug, Clone, Serialize, Deserialize, Default)] -pub struct Groth16Proof { - pub public_inputs: [String; 2], - pub encoded_proof: String, - pub raw_proof: String, -} - -impl Groth16Prover { - /// Creates a new [Groth16Prover]. - pub fn new() -> Self { - Self - } - /// Executes the prover in testing mode with a circuit definition and witness. - pub fn test(constraints: Vec, witness: Witness) { - let serialized = serde_json::to_string(&constraints).unwrap(); - - // Write constraints. - let mut constraints_file = tempfile::NamedTempFile::new().unwrap(); - constraints_file.write_all(serialized.as_bytes()).unwrap(); - - // Write witness. - let mut witness_file = tempfile::NamedTempFile::new().unwrap(); - let gnark_witness = GnarkWitness::new(witness); - let serialized = serde_json::to_string(&gnark_witness).unwrap(); - witness_file.write_all(serialized.as_bytes()).unwrap(); - - test_groth16( - witness_file.path().to_str().unwrap(), - constraints_file.path().to_str().unwrap(), - ); - } - - pub fn build(constraints: Vec, witness: Witness, build_dir: PathBuf) { - let serialized = serde_json::to_string(&constraints).unwrap(); - - // Write constraints. - let constraints_path = build_dir.join("constraints_groth16.json"); - let mut file = File::create(constraints_path).unwrap(); - file.write_all(serialized.as_bytes()).unwrap(); - - // Write witness. - let witness_path = build_dir.join("witness_groth16.json"); - let gnark_witness = GnarkWitness::new(witness); - let mut file = File::create(witness_path).unwrap(); - let serialized = serde_json::to_string(&gnark_witness).unwrap(); - file.write_all(serialized.as_bytes()).unwrap(); - - build_groth16(build_dir.to_str().unwrap()); - - // Extend the built verifier with the sp1 verifier contract. - let groth16_verifier_path = build_dir.join("SP1Verifier.sol"); - - // Open the file in append mode. - let mut groth16_verifier_file = OpenOptions::new() - .append(true) - .open(groth16_verifier_path) - .expect("failed to open file"); - - // Write the string to the file - let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt"); - groth16_verifier_file - .write_all(sp1_verifier_str.as_bytes()) - .expect("Failed to write to file"); - } - - /// Generates a Groth16 proof by sending a request to the Gnark server. - pub fn prove(&self, witness: Witness, build_dir: PathBuf) -> Groth16Proof { - // Write witness. - let mut witness_file = tempfile::NamedTempFile::new().unwrap(); - let gnark_witness = GnarkWitness::new(witness); - let serialized = serde_json::to_string(&gnark_witness).unwrap(); - witness_file.write_all(serialized.as_bytes()).unwrap(); - - prove_groth16( - build_dir.to_str().unwrap(), - witness_file.path().to_str().unwrap(), - ) - } - - pub fn verify( - &self, - proof: &Groth16Proof, - vkey_hash: &BigUint, - commited_values_digest: &BigUint, - build_dir: &Path, - ) { - verify_groth16( - build_dir.to_str().unwrap(), - &proof.raw_proof, - &vkey_hash.to_string(), - &commited_values_digest.to_string(), - ) - .expect("failed to verify proof") - } -} - -impl Default for Groth16Prover { - fn default() -> Self { - Self::new() - } -} diff --git a/recursion/gnark-ffi/src/lib.rs b/recursion/gnark-ffi/src/lib.rs index 31ea294d62..26940e863b 100644 --- a/recursion/gnark-ffi/src/lib.rs +++ b/recursion/gnark-ffi/src/lib.rs @@ -1,8 +1,7 @@ mod babybear; pub mod ffi; -pub mod groth16; pub mod plonk_bn254; pub mod witness; -pub use groth16::*; +pub use plonk_bn254::*; pub use witness::*; diff --git a/recursion/gnark-ffi/src/plonk_bn254.rs b/recursion/gnark-ffi/src/plonk_bn254.rs index cdb3b23a97..74727c328b 100644 --- a/recursion/gnark-ffi/src/plonk_bn254.rs +++ b/recursion/gnark-ffi/src/plonk_bn254.rs @@ -1,146 +1,129 @@ use std::{ fs::File, - io::{Read, Write}, - path::PathBuf, - process::{Command, Stdio}, + io::Write, + path::{Path, PathBuf}, }; +use crate::{ + ffi::{build_plonk_bn254, prove_plonk_bn254, test_plonk_bn254, verify_plonk_bn254}, + witness::GnarkWitness, +}; + +use num_bigint::BigUint; use serde::{Deserialize, Serialize}; use sp1_recursion_compiler::{ constraints::Constraint, ir::{Config, Witness}, }; -use crate::GnarkWitness; - -/// A prover that can generate proofs with the PLONK-BN254 protocol using bindings to Gnark. +/// A prover that can generate proofs with the PLONK protocol using bindings to Gnark. +#[derive(Debug, Clone)] pub struct PlonkBn254Prover; -/// A zero-knowledge proof generated by the PLONK-BN254 protocol. +/// A zero-knowledge proof generated by the PLONK protocol with a Base64 encoded gnark PLONK proof. #[derive(Debug, Clone, Serialize, Deserialize, Default)] pub struct PlonkBn254Proof { - proof: String, - public_inputs: [String; 2], + pub public_inputs: [String; 2], + pub encoded_proof: String, + pub raw_proof: String, } impl PlonkBn254Prover { - /// Creates a new prover. + /// Creates a new [PlonkBn254Prover]. pub fn new() -> Self { - PlonkBn254Prover + Self + } + + /// Executes the prover in testing mode with a circuit definition and witness. + pub fn test(constraints: Vec, witness: Witness) { + let serialized = serde_json::to_string(&constraints).unwrap(); + + // Write constraints. + let mut constraints_file = tempfile::NamedTempFile::new().unwrap(); + constraints_file.write_all(serialized.as_bytes()).unwrap(); + + // Write witness. + let mut witness_file = tempfile::NamedTempFile::new().unwrap(); + let gnark_witness = GnarkWitness::new(witness); + let serialized = serde_json::to_string(&gnark_witness).unwrap(); + witness_file.write_all(serialized.as_bytes()).unwrap(); + + test_plonk_bn254( + witness_file.path().to_str().unwrap(), + constraints_file.path().to_str().unwrap(), + ); } + /// Builds the PLONK circuit locally. pub fn build(constraints: Vec, witness: Witness, build_dir: PathBuf) { let serialized = serde_json::to_string(&constraints).unwrap(); - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let gnark_dir = manifest_dir.join("../gnark"); - let cwd = std::env::current_dir().unwrap(); // Write constraints. - let constraints_path = build_dir.join("constraints_plonk_bn254.json"); + let constraints_path = build_dir.join("constraints.json"); let mut file = File::create(constraints_path).unwrap(); file.write_all(serialized.as_bytes()).unwrap(); // Write witness. - let witness_path = build_dir.join("witness_plonk_bn254.json"); + let witness_path = build_dir.join("witness.json"); let gnark_witness = GnarkWitness::new(witness); let mut file = File::create(witness_path).unwrap(); let serialized = serde_json::to_string(&gnark_witness).unwrap(); file.write_all(serialized.as_bytes()).unwrap(); - // Run `make`. - let make = Command::new("make") - .current_dir(&gnark_dir) - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stdin(Stdio::inherit()) - .output() + build_plonk_bn254(build_dir.to_str().unwrap()); + + // Write the corresponding asset files to the build dir. + let sp1_mock_verifier_path = build_dir.join("SP1MockVerifier.sol"); + let sp1_mock_verifier_str = include_str!("../assets/SP1MockVerifier.txt"); + let mut mock_verifier_file = File::create(sp1_mock_verifier_path).unwrap(); + mock_verifier_file + .write_all(sp1_mock_verifier_str.as_bytes()) .unwrap(); - if !make.status.success() { - panic!("failed to run make"); - } - - // Run the build script. - let result = Command::new("go") - .args([ - "run", - "main.go", - "build-plonk-bn254", - "--data", - cwd.join(build_dir).to_str().unwrap(), - ]) - .current_dir(gnark_dir) - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stdin(Stdio::inherit()) - .output() + + let sp1_verifier_path = build_dir.join("SP1Verifier.sol"); + let sp1_verifier_str = include_str!("../assets/SP1Verifier.txt"); + let mut sp1_verifier_file = File::create(sp1_verifier_path).unwrap(); + sp1_verifier_file + .write_all(sp1_verifier_str.as_bytes()) .unwrap(); - if !result.status.success() { - panic!("failed to run build script"); - } + let interface_sp1_verifier_path = build_dir.join("ISP1Verifier.sol"); + let interface_sp1_verifier_str = include_str!("../assets/ISP1Verifier.txt"); + let mut interface_sp1_verifier_file = File::create(interface_sp1_verifier_path).unwrap(); + interface_sp1_verifier_file + .write_all(interface_sp1_verifier_str.as_bytes()) + .unwrap(); } - pub fn prove(witness: Witness, build_dir: PathBuf) -> PlonkBn254Proof { - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let gnark_dir = manifest_dir.join("../gnark"); - let cwd = std::env::current_dir().unwrap(); - + /// Generates a PLONK proof by sending a request to the Gnark server. + pub fn prove(&self, witness: Witness, build_dir: PathBuf) -> PlonkBn254Proof { // Write witness. let mut witness_file = tempfile::NamedTempFile::new().unwrap(); let gnark_witness = GnarkWitness::new(witness); let serialized = serde_json::to_string(&gnark_witness).unwrap(); witness_file.write_all(serialized.as_bytes()).unwrap(); - // Run `make`. - let make = Command::new("make") - .current_dir(&gnark_dir) - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stdin(Stdio::inherit()) - .output() - .unwrap(); - if !make.status.success() { - panic!("failed to run make"); - } - - // Run the prove script. - let proof_file = tempfile::NamedTempFile::new().unwrap(); - let result = Command::new("go") - .args([ - "run", - "main.go", - "prove-plonk-bn254", - "--data", - cwd.join(build_dir).to_str().unwrap(), - "--witness", - witness_file.path().to_str().unwrap(), - "--proof", - proof_file.path().to_str().unwrap(), - ]) - .current_dir(gnark_dir) - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) - .stdin(Stdio::inherit()) - .output() - .unwrap(); - - if !result.status.success() { - panic!("failed to run build script"); - } - - // Read the contents back from the tempfile. - let mut buffer = String::new(); - proof_file - .reopen() - .unwrap() - .read_to_string(&mut buffer) - .unwrap(); - - // Deserialize the JSON string back to a Groth16Proof instance - let deserialized: PlonkBn254Proof = - serde_json::from_str(&buffer).expect("Error deserializing the proof"); + prove_plonk_bn254( + build_dir.to_str().unwrap(), + witness_file.path().to_str().unwrap(), + ) + } - deserialized + /// Verify a PLONK proof and verify that the supplied vkey_hash and committed_values_digest match. + pub fn verify( + &self, + proof: &PlonkBn254Proof, + vkey_hash: &BigUint, + committed_values_digest: &BigUint, + build_dir: &Path, + ) { + verify_plonk_bn254( + build_dir.to_str().unwrap(), + &proof.raw_proof, + &vkey_hash.to_string(), + &committed_values_digest.to_string(), + ) + .expect("failed to verify proof") } } diff --git a/recursion/program/Cargo.toml b/recursion/program/Cargo.toml index b564ba7ebf..47dd52380c 100644 --- a/recursion/program/Cargo.toml +++ b/recursion/program/Cargo.toml @@ -3,8 +3,6 @@ name = "sp1-recursion-program" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] p3-air = { workspace = true } p3-field = { workspace = true } @@ -25,5 +23,4 @@ sp1-core = { path = "../../core" } itertools = "0.12.1" serde = { version = "1.0.201", features = ["derive"] } rand = "0.8.5" -array-macro = "2.1.8" tracing = "0.1.40" diff --git a/recursion/program/src/challenger.rs b/recursion/program/src/challenger.rs index 65603ced54..ceea9168ac 100644 --- a/recursion/program/src/challenger.rs +++ b/recursion/program/src/challenger.rs @@ -4,6 +4,7 @@ use sp1_recursion_compiler::prelude::MemVariable; use sp1_recursion_compiler::prelude::Ptr; use sp1_recursion_compiler::prelude::Variable; use sp1_recursion_compiler::prelude::{Array, Builder, Config, DslVariable, Ext, Felt, Usize, Var}; +use sp1_recursion_core::runtime::HASH_RATE; use sp1_recursion_core::runtime::{DIGEST_SIZE, PERMUTATION_WIDTH}; use crate::fri::types::DigestVariable; @@ -147,10 +148,7 @@ impl DuplexChallengerVariable { builder.assign(self.nb_inputs, self.nb_inputs + C::N::one()); builder - .if_eq( - self.nb_inputs, - C::N::from_canonical_usize(PERMUTATION_WIDTH), - ) + .if_eq(self.nb_inputs, C::N::from_canonical_usize(HASH_RATE)) .then(|builder| { self.duplexing(builder); }) diff --git a/recursion/program/src/constraints.rs b/recursion/program/src/constraints.rs index 01ec477182..8ea42a2d72 100644 --- a/recursion/program/src/constraints.rs +++ b/recursion/program/src/constraints.rs @@ -166,7 +166,7 @@ mod tests { Chip, Com, Dom, OpeningProof, PcsProverData, RiscvAir, ShardCommitment, ShardMainData, ShardProof, StarkGenericConfig, StarkMachine, }, - utils::BabyBearPoseidon2, + utils::{BabyBearPoseidon2, SP1CoreOpts}, }; use sp1_recursion_core::stark::utils::{run_test_recursion, TestConfig}; @@ -283,8 +283,13 @@ mod tests { let machine = A::machine(SC::default()); let (_, vk) = machine.setup(&Program::from(elf)); let mut challenger = machine.config().challenger(); - let (proof, _) = - sp1_core::utils::prove(Program::from(elf), &SP1Stdin::new(), SC::default()).unwrap(); + let (proof, _) = sp1_core::utils::prove( + Program::from(elf), + &SP1Stdin::new(), + SC::default(), + SP1CoreOpts::default(), + ) + .unwrap(); machine.verify(&vk, &proof, &mut challenger).unwrap(); println!("Proof generated and verified successfully"); diff --git a/recursion/program/src/fri/domain.rs b/recursion/program/src/fri/domain.rs index a26acf23ed..eca1a6e483 100644 --- a/recursion/program/src/fri/domain.rs +++ b/recursion/program/src/fri/domain.rs @@ -15,15 +15,15 @@ pub struct TwoAdicMultiplicativeCosetVariable { } impl TwoAdicMultiplicativeCosetVariable { - pub fn size(&self) -> Var { + pub const fn size(&self) -> Var { self.size } - pub fn first_point(&self) -> Felt { + pub const fn first_point(&self) -> Felt { self.shift } - pub fn gen(&self) -> Felt { + pub const fn gen(&self) -> Felt { self.g } } diff --git a/recursion/program/src/fri/two_adic_pcs.rs b/recursion/program/src/fri/two_adic_pcs.rs index 71b361f8ef..aee46cfd28 100644 --- a/recursion/program/src/fri/two_adic_pcs.rs +++ b/recursion/program/src/fri/two_adic_pcs.rs @@ -245,7 +245,6 @@ where self.config.get_subgroup(builder, log_degree) } - // Todo: change TwoAdicPcsRoundVariable to RoundVariable fn verify( &self, builder: &mut Builder, diff --git a/recursion/program/src/hints.rs b/recursion/program/src/hints.rs index 6ebfa8a8c1..353f760b91 100644 --- a/recursion/program/src/hints.rs +++ b/recursion/program/src/hints.rs @@ -386,7 +386,7 @@ impl Hintable for ShardCommitment { } } -impl Hintable for DuplexChallenger { +impl Hintable for DuplexChallenger { type HintVariable = DuplexChallengerVariable; fn read(builder: &mut Builder) -> Self::HintVariable { @@ -513,9 +513,9 @@ impl<'a, A: MachineAir> Hintable fn read(builder: &mut Builder) -> Self::HintVariable { let vk = VerifyingKeyHint::<'a, BabyBearPoseidon2, A>::read(builder); let shard_proofs = Vec::>::read(builder); - let leaf_challenger = DuplexChallenger::::read(builder); + let leaf_challenger = DuplexChallenger::::read(builder); let initial_reconstruct_challenger = - DuplexChallenger::::read(builder); + DuplexChallenger::::read(builder); let is_complete = builder.hint_var(); SP1RecursionMemoryLayoutVariable { @@ -626,7 +626,7 @@ impl<'a, A: MachineAir> Hintable let sp1_vk = VerifyingKeyHint::<'a, BabyBearPoseidon2, RiscvAir<_>>::read(builder); let committed_value_digest = Vec::>::read(builder); let deferred_proofs_digest = Vec::::read(builder); - let leaf_challenger = DuplexChallenger::::read(builder); + let leaf_challenger = DuplexChallenger::::read(builder); let end_pc = InnerVal::read(builder); let end_shard = InnerVal::read(builder); diff --git a/recursion/program/src/machine/core.rs b/recursion/program/src/machine/core.rs index 65b6b3e8dc..916a25a2ac 100644 --- a/recursion/program/src/machine/core.rs +++ b/recursion/program/src/machine/core.rs @@ -305,7 +305,6 @@ where recursion_public_values.cumulative_sum = cumulative_sum_arrray; recursion_public_values.start_reconstruct_deferred_digest = start_deferred_digest; recursion_public_values.end_reconstruct_deferred_digest = end_deferred_digest; - recursion_public_values.exit_code = zero; recursion_public_values.is_complete = is_complete_felt; // If the proof represents a complete proof, make completeness assertions. diff --git a/recursion/program/src/machine/mod.rs b/recursion/program/src/machine/mod.rs index cef2cbccc5..645e46b911 100644 --- a/recursion/program/src/machine/mod.rs +++ b/recursion/program/src/machine/mod.rs @@ -17,7 +17,7 @@ mod tests { use p3_challenger::CanObserve; use p3_maybe_rayon::prelude::*; use sp1_core::stark::{MachineVerificationError, RiscvAir, StarkGenericConfig}; - use sp1_core::utils::BabyBearPoseidon2; + use sp1_core::utils::{BabyBearPoseidon2, SP1CoreOpts}; use sp1_core::{ io::SP1Stdin, runtime::Program, @@ -83,7 +83,13 @@ mod tests { let mut challenger = machine.config().challenger(); let time = std::time::Instant::now(); - let (proof, _) = sp1_core::utils::prove(program, &SP1Stdin::new(), SC::default()).unwrap(); + let (proof, _) = sp1_core::utils::prove( + program, + &SP1Stdin::new(), + SC::default(), + SP1CoreOpts::default(), + ) + .unwrap(); machine.verify(&vk, &proof, &mut challenger).unwrap(); tracing::info!("Proof generated successfully"); let elapsed = time.elapsed(); @@ -166,6 +172,7 @@ mod tests { &rec_pk, record, &mut recursive_challenger, + SP1CoreOpts::recursion(), ) }) .collect::>(); @@ -238,6 +245,7 @@ mod tests { &reduce_pk, runtime.record, &mut recursive_challenger, + SP1CoreOpts::recursion(), ); let mut recursive_challenger = recursive_machine.config().challenger(); let result = @@ -297,6 +305,7 @@ mod tests { &compress_pk, runtime.record, &mut compress_challenger, + SP1CoreOpts::default(), ); let elapsed = time.elapsed(); tracing::info!("Compress proving time: {:?}", elapsed); @@ -341,8 +350,12 @@ mod tests { // Prove the wrap program. let mut wrap_challenger = wrap_machine.config().challenger(); let time = std::time::Instant::now(); - let wrap_proof = - wrap_machine.prove::>(&wrap_pk, runtime.record, &mut wrap_challenger); + let wrap_proof = wrap_machine.prove::>( + &wrap_pk, + runtime.record, + &mut wrap_challenger, + SP1CoreOpts::recursion(), + ); let elapsed = time.elapsed(); tracing::info!("Wrap proving time: {:?}", elapsed); let mut wrap_challenger = wrap_machine.config().challenger(); diff --git a/recursion/program/src/machine/utils.rs b/recursion/program/src/machine/utils.rs index f3d6d408cb..59540136b3 100644 --- a/recursion/program/src/machine/utils.rs +++ b/recursion/program/src/machine/utils.rs @@ -10,7 +10,7 @@ use sp1_core::{ }; use sp1_recursion_compiler::ir::{Array, Builder, Config, Felt, Var}; use sp1_recursion_core::{ - air::{RecursionPublicValues, RECURSIVE_PROOF_NUM_PV_ELTS}, + air::{RecursionPublicValues, NUM_PV_ELMS_TO_HASH, RECURSIVE_PROOF_NUM_PV_ELTS}, runtime::DIGEST_SIZE, }; @@ -18,7 +18,7 @@ use crate::{ challenger::DuplexChallengerVariable, fri::TwoAdicMultiplicativeCosetVariable, types::VerifyingKeyVariable, - utils::{assert_challenger_eq_pv, get_preprocessed_data}, + utils::{assert_challenger_eq_pv, felt2var, get_preprocessed_data}, }; /// Assertions on the public values describing a complete recursive proof state. @@ -127,9 +127,8 @@ pub(crate) fn calculate_public_values_digest( public_values: &RecursionPublicValues>, ) -> Array> { let pv_elements: [Felt<_>; RECURSIVE_PROOF_NUM_PV_ELTS] = unsafe { transmute(*public_values) }; - const NUM_ELMS_TO_HASH: usize = RECURSIVE_PROOF_NUM_PV_ELTS - DIGEST_SIZE; - let mut poseidon_inputs = builder.array(NUM_ELMS_TO_HASH); - for (i, elm) in pv_elements[0..NUM_ELMS_TO_HASH].iter().enumerate() { + let mut poseidon_inputs = builder.array(NUM_PV_ELMS_TO_HASH); + for (i, elm) in pv_elements[0..NUM_PV_ELMS_TO_HASH].iter().enumerate() { builder.set(&mut poseidon_inputs, i, *elm); } builder.poseidon2_hash(&poseidon_inputs) @@ -140,14 +139,17 @@ pub(crate) fn verify_public_values_hash( builder: &mut Builder, public_values: &RecursionPublicValues>, ) { - // Check that the public values digest is correct. - let calculated_digest = calculate_public_values_digest(builder, public_values); - - let expected_digest = public_values.digest; - for (i, expected_elm) in expected_digest.iter().enumerate() { - let calculated_elm = builder.get(&calculated_digest, i); - builder.assert_felt_eq(*expected_elm, calculated_elm); - } + let var_exit_code = felt2var(builder, public_values.exit_code); + // Check that the public values digest is correct if the exit_code is 0. + builder.if_eq(var_exit_code, C::N::zero()).then(|builder| { + let calculated_digest = calculate_public_values_digest(builder, public_values); + + let expected_digest = public_values.digest; + for (i, expected_elm) in expected_digest.iter().enumerate() { + let calculated_elm = builder.get(&calculated_digest, i); + builder.assert_felt_eq(*expected_elm, calculated_elm); + } + }); } /// Register and commits the recursion public values. @@ -156,8 +158,7 @@ pub fn commit_public_values( public_values: &RecursionPublicValues>, ) { let pv_elements: [Felt<_>; RECURSIVE_PROOF_NUM_PV_ELTS] = unsafe { transmute(*public_values) }; - const NUM_ELMS_TO_HASH: usize = RECURSIVE_PROOF_NUM_PV_ELTS - DIGEST_SIZE; - let pv_elms_no_digest = &pv_elements[0..NUM_ELMS_TO_HASH]; + let pv_elms_no_digest = &pv_elements[0..NUM_PV_ELMS_TO_HASH]; for value in pv_elms_no_digest.iter() { builder.register_public_value(*value); diff --git a/recursion/program/src/stark.rs b/recursion/program/src/stark.rs index a65dad9c47..aec5d9453d 100644 --- a/recursion/program/src/stark.rs +++ b/recursion/program/src/stark.rs @@ -78,7 +78,7 @@ pub struct ShardProofHint<'a, SC: StarkGenericConfig, A> { } impl<'a, SC: StarkGenericConfig, A: MachineAir> ShardProofHint<'a, SC, A> { - pub fn new(machine: &'a StarkMachine, proof: &'a ShardProof) -> Self { + pub const fn new(machine: &'a StarkMachine, proof: &'a ShardProof) -> Self { Self { machine, proof } } } @@ -89,7 +89,7 @@ pub struct VerifyingKeyHint<'a, SC: StarkGenericConfig, A> { } impl<'a, SC: StarkGenericConfig, A: MachineAir> VerifyingKeyHint<'a, SC, A> { - pub fn new(machine: &'a StarkMachine, vk: &'a StarkVerifyingKey) -> Self { + pub const fn new(machine: &'a StarkMachine, vk: &'a StarkVerifyingKey) -> Self { Self { machine, vk } } } @@ -343,17 +343,19 @@ where pcs.verify(builder, rounds, opening_proof.clone(), challenger); builder.cycle_tracker("stage-d-verify-pcs"); - // TODO CONSTRAIN: that the preprocessed chips get called with verify_constraints. builder.cycle_tracker("stage-e-verify-constraints"); for (i, chip) in machine.chips().iter().enumerate() { - let chip_name = chip.name(); - tracing::debug!("verifying constraints for chip: {}", chip_name); + tracing::debug!("verifying constraints for chip: {}", chip.name()); let index = builder.get(&proof.sorted_idxs, i); if chip.preprocessed_width() > 0 { builder.assert_var_ne(index, C::N::from_canonical_usize(EMPTY)); } + if chip.name() == "CPU" { + builder.assert_var_ne(index, C::N::from_canonical_usize(EMPTY)); + } + builder .if_ne(index, C::N::from_canonical_usize(EMPTY)) .then(|builder| { @@ -417,6 +419,7 @@ pub(crate) mod tests { use sp1_core::utils::setup_logger; use sp1_core::utils::InnerChallenge; use sp1_core::utils::InnerVal; + use sp1_core::utils::SP1CoreOpts; use sp1_core::{ stark::{RiscvAir, StarkGenericConfig}, utils::BabyBearPoseidon2, @@ -458,8 +461,13 @@ pub(crate) mod tests { let machine = A::machine(SC::default()); let (_, vk) = machine.setup(&Program::from(elf)); let mut challenger_val = machine.config().challenger(); - let (proof, _) = - sp1_core::utils::prove(Program::from(elf), &SP1Stdin::new(), SC::default()).unwrap(); + let (proof, _) = sp1_core::utils::prove( + Program::from(elf), + &SP1Stdin::new(), + SC::default(), + SP1CoreOpts::default(), + ) + .unwrap(); let proofs = proof.shard_proofs; println!("Proof generated successfully"); @@ -557,8 +565,12 @@ pub(crate) mod tests { let record = runtime.record.clone(); let mut challenger = machine.config().challenger(); - let mut proof = - machine.prove::>>(&pk, record, &mut challenger); + let mut proof = machine.prove::>>( + &pk, + record, + &mut challenger, + SP1CoreOpts::recursion(), + ); let mut challenger = machine.config().challenger(); let verification_result = machine.verify(&vk, &proof, &mut challenger); diff --git a/recursion/program/src/utils.rs b/recursion/program/src/utils.rs index e6f621f508..9122957b14 100644 --- a/recursion/program/src/utils.rs +++ b/recursion/program/src/utils.rs @@ -81,7 +81,7 @@ pub fn clone_array>( new_arr } -// TODO: this can be done much more efficiently, but in the meantime this should work +// OPT: this can be done much more efficiently, but in the meantime this should work pub fn felt2var(builder: &mut Builder, felt: Felt) -> Var { let bits = builder.num2bits_f(felt); builder.bits2num_v(&bits) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 4217581948..3b7a122ff6 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -3,19 +3,20 @@ name = "sp1-sdk" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] prost = "0.12" -prost-types = "0.12" serde = { version = "1.0.201", features = ["derive"] } serde_json = "1.0.117" twirp = { git = "https://github.com/github/twirp-rs.git", rev = "c85f31f9c54957374e7dcb3534fc52cff0aa2dc5" } async-trait = "0.1.80" reqwest-middleware = "0.3.1" -reqwest = { version = "0.12.4", features = ["rustls-tls", "trust-dns", "stream"] } +reqwest = { version = "0.12.4", features = [ + "rustls-tls", + "trust-dns", + "stream", +] } anyhow = "1.0.83" -sp1-prover = { path = "../prover" } +sp1-prover = { path = "../prover", default-features = false } sp1-core = { path = "../core" } futures = "0.3.30" bincode = "1.3.3" @@ -28,22 +29,22 @@ tracing = "0.1.40" hex = "0.4.3" log = "0.4.21" axum = "=0.7.5" -alloy = { git = "https://github.com/alloy-rs/alloy", rev = "bfd0fda", features = [ - "contract", - "signer-wallet", -] } -dotenv = "0.15.0" +alloy-primitives = "0.7.0" +alloy-sol-types = "0.7.0" sha2 = "0.10.8" dirs = "5.0.1" tempfile = "3.10.1" num-bigint = "0.4.5" +cfg-if = "1.0" +ethers = { version = "2", default-features = false } [features] neon = ["sp1-core/neon"] +plonk = ["sp1-prover/plonk"] [build-dependencies] vergen = { version = "8", default-features = false, features = [ - "build", - "git", - "git2", + "build", + "git", + "git2", ] } diff --git a/sdk/src/artifacts.rs b/sdk/src/artifacts.rs index 52f1c97376..2cc7be7d0d 100644 --- a/sdk/src/artifacts.rs +++ b/sdk/src/artifacts.rs @@ -4,18 +4,20 @@ use anyhow::{Context, Result}; use futures::StreamExt; use indicatif::{ProgressBar, ProgressStyle}; use reqwest::Client; -pub use sp1_prover::build::{build_groth16_artifacts_with_dummy, try_install_groth16_artifacts}; +pub use sp1_prover::build::{ + build_plonk_bn254_artifacts_with_dummy, try_install_plonk_bn254_artifacts, +}; -/// Exports the soliditiy verifier for Groth16 proofs to the specified output directory. +/// Exports the solidity verifier for PLONK proofs to the specified output directory. /// -/// WARNING: If you are on development mode, this function assumes that the Groth16 artifacts have +/// WARNING: If you are on development mode, this function assumes that the PLONK artifacts have /// already been built. -pub fn export_solidity_groth16_verifier(output_dir: impl Into) -> Result<()> { +pub fn export_solidity_plonk_bn254_verifier(output_dir: impl Into) -> Result<()> { let output_dir: PathBuf = output_dir.into(); let artifacts_dir = if sp1_prover::build::sp1_dev_mode() { - sp1_prover::build::groth16_artifacts_dev_dir() + sp1_prover::build::plonk_bn254_artifacts_dev_dir() } else { - sp1_prover::build::try_install_groth16_artifacts() + sp1_prover::build::try_install_plonk_bn254_artifacts() }; let verifier_path = artifacts_dir.join("SP1Verifier.sol"); @@ -79,7 +81,7 @@ pub async fn download_file( mod tests { #[test] fn test_verifier_export() { - crate::artifacts::export_solidity_groth16_verifier(tempfile::tempdir().unwrap().path()) + crate::artifacts::export_solidity_plonk_bn254_verifier(tempfile::tempdir().unwrap().path()) .expect("failed to export verifier"); } } diff --git a/sdk/src/auth.rs b/sdk/src/auth.rs index 5ff49393eb..2cf1c8c861 100644 --- a/sdk/src/auth.rs +++ b/sdk/src/auth.rs @@ -1,10 +1,12 @@ use std::borrow::Cow; use std::str::FromStr; -use alloy::signers::{wallet::LocalWallet, Signer}; -use alloy::sol; -use alloy::sol_types::{Eip712Domain, SolStruct}; +use alloy_sol_types::{sol, Eip712Domain, SolStruct}; use anyhow::Result; +use ethers::{ + signers::{LocalWallet, Signer}, + types::H256, +}; use crate::proto::network::UnclaimReason; @@ -75,15 +77,15 @@ impl NetworkAuth { /// Gets the address of the auth's account, derived from the secp256k1 private key. pub fn get_address(&self) -> [u8; 20] { - *self.wallet.address().0 + self.wallet.address().0 } // Generic function to sign a message based on the SolStruct. async fn sign_message(&self, type_struct: T) -> Result> { let domain_separator = Self::get_domain_separator(); let message_hash = type_struct.eip712_signing_hash(&domain_separator); - let signature = self.wallet.sign_hash(&message_hash).await?; - Ok(signature.as_bytes().to_vec()) + let signature = self.wallet.sign_hash(H256(message_hash.0))?; + Ok(signature.to_vec()) } /// Signs a message to to request ot create a proof. diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 1249fc0c88..389586bcfb 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -26,7 +26,7 @@ pub use provers::{LocalProver, MockProver, NetworkProver, Prover}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use sp1_core::stark::{MachineVerificationError, ShardProof}; pub use sp1_prover::{ - CoreSC, Groth16Proof, HashableKey, InnerSC, OuterSC, PlonkBn254Proof, SP1Prover, SP1ProvingKey, + CoreSC, HashableKey, InnerSC, OuterSC, PlonkBn254Proof, SP1Prover, SP1ProvingKey, SP1PublicValues, SP1Stdin, SP1VerifyingKey, }; @@ -54,11 +54,8 @@ pub type SP1ProofVerificationError = MachineVerificationError; pub type SP1CompressedProof = SP1ProofWithPublicValues>; pub type SP1CompressedProofVerificationError = MachineVerificationError; -/// A [SP1ProofWithPublicValues] generated with [ProverClient::prove_groth16]. -pub type SP1Groth16Proof = SP1ProofWithPublicValues; - /// A [SP1ProofWithPublicValues] generated with [ProverClient::prove_plonk]. -pub type SP1PlonkProof = SP1ProofWithPublicValues; +pub type SP1PlonkBn254Proof = SP1ProofWithPublicValues; impl ProverClient { /// Creates a new [ProverClient]. @@ -200,7 +197,7 @@ impl ProverClient { /// /// Returns a proof of the program's execution. By default the proof generated will not be /// compressed to constant size. To create a more succinct proof, use the [Self::prove_compressed], - /// [Self::prove_groth16], or [Self::prove_plonk] methods. + /// [Self::prove_plonk], or [Self::prove_plonk] methods. /// /// ### Examples /// ```no_run @@ -259,39 +256,9 @@ impl ProverClient { self.prover.prove_compressed(pk, stdin) } - /// Proves the execution of the given program with the given input in the groth16 mode. - /// - /// Returns a proof of the program's execution in the groth16 format. The proof is a succinct - /// proof that is of constant size and friendly for on-chain verification. - /// - /// ### Examples - /// ```no_run - /// use sp1_sdk::{ProverClient, SP1Stdin}; - /// - /// // Load the program. - /// let elf = include_bytes!("../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); - /// - /// // Initialize the prover client. - /// let client = ProverClient::new(); - /// - /// // Setup the program. - /// let (pk, vk) = client.setup(elf); - /// - /// // Setup the inputs. - /// let mut stdin = SP1Stdin::new(); - /// stdin.write(&10usize); - /// - /// // Generate the proof. - /// let proof = client.prove_groth16(&pk, stdin).unwrap(); - /// ``` - /// Generates a groth16 proof, verifiable onchain, of the given elf and stdin. - pub fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { - self.prover.prove_groth16(pk, stdin) - } - - /// Proves the execution of the given program with the given input in the plonk mode. + /// Proves the execution of the given program with the given input in the plonk bn254 mode. /// - /// Returns a proof of the program's execution in the plonk format. The proof is a succinct + /// Returns a proof of the program's execution in the plonk bn254format. The proof is a succinct /// proof that is of constant size and friendly for on-chain verification. /// /// ### Examples @@ -314,7 +281,8 @@ impl ProverClient { /// // Generate the proof. /// let proof = client.prove_plonk(&pk, stdin).unwrap(); /// ``` - pub fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { + /// Generates a plonk bn254 proof, verifiable onchain, of the given elf and stdin. + pub fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { self.prover.prove_plonk(pk, stdin) } @@ -373,37 +341,7 @@ impl ProverClient { self.prover.verify_compressed(proof, vkey) } - /// Verifies that the given groth16 proof is valid and matches the given verification key - /// produced by [Self::setup]. - /// - /// ### Examples - /// ```no_run - /// use sp1_sdk::{ProverClient, SP1Stdin}; - /// - /// // Load the program. - /// let elf = include_bytes!("../../examples/fibonacci/program/elf/riscv32im-succinct-zkvm-elf"); - /// - /// // Initialize the prover client. - /// let client = ProverClient::new(); - /// - /// // Setup the program. - /// let (pk, vk) = client.setup(elf); - /// - /// // Setup the inputs. - /// let mut stdin = SP1Stdin::new(); - /// stdin.write(&10usize); - /// - /// // Generate the proof. - /// let proof = client.prove_groth16(&pk, stdin).unwrap(); - /// - /// // Verify the proof. - /// client.verify_groth16(&proof, &vk).unwrap(); - /// ``` - pub fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { - self.prover.verify_groth16(proof, vkey) - } - - /// Verifies that the given plonk proof is valid and matches the given verification key + /// Verifies that the given plonk bn254 proof is valid and matches the given verification key /// produced by [Self::setup]. /// /// ### Examples @@ -429,7 +367,7 @@ impl ProverClient { /// // Verify the proof. /// client.verify_plonk(&proof, &vk).unwrap(); /// ``` - pub fn verify_plonk(&self, proof: &SP1PlonkProof, vkey: &SP1VerifyingKey) -> Result<()> { + pub fn verify_plonk(&self, proof: &SP1PlonkBn254Proof, vkey: &SP1VerifyingKey) -> Result<()> { self.prover.verify_plonk(proof, vkey) } } @@ -454,7 +392,7 @@ impl SP1ProofWithPublicValues

String { format!("0x{}", self.proof.encoded_proof.clone()) } @@ -501,7 +439,7 @@ mod tests { } #[test] - fn test_e2e_prove_groth16() { + fn test_e2e_prove_plonk() { utils::setup_logger(); let client = ProverClient::local(); let elf = @@ -509,8 +447,8 @@ mod tests { let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); - let proof = client.prove_groth16(&pk, stdin).unwrap(); - client.verify_groth16(&proof, &vk).unwrap(); + let proof = client.prove_plonk(&pk, stdin).unwrap(); + client.verify_plonk(&proof, &vk).unwrap(); } #[test] @@ -527,7 +465,7 @@ mod tests { } #[test] - fn test_e2e_prove_groth16_mock() { + fn test_e2e_prove_plonk_mock() { utils::setup_logger(); let client = ProverClient::mock(); let elf = @@ -535,7 +473,7 @@ mod tests { let (pk, vk) = client.setup(elf); let mut stdin = SP1Stdin::new(); stdin.write(&10usize); - let proof = client.prove_groth16(&pk, stdin).unwrap(); - client.verify_groth16(&proof, &vk).unwrap(); + let proof = client.prove_plonk(&pk, stdin).unwrap(); + client.verify_plonk(&proof, &vk).unwrap(); } } diff --git a/sdk/src/proto/network.rs b/sdk/src/proto/network.rs index 52bb125647..3c8919d7e6 100644 --- a/sdk/src/proto/network.rs +++ b/sdk/src/proto/network.rs @@ -300,21 +300,18 @@ pub enum ProofMode { Compressed = 2, /// The proof mode for a PlonK proof. Plonk = 3, - /// The proof mode for a Groth16 proof. - Groth16 = 4, } impl ProofMode { /// 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 { + pub const fn as_str_name(&self) -> &'static str { match self { ProofMode::Unspecified => "PROOF_MODE_UNSPECIFIED", ProofMode::Core => "PROOF_MODE_CORE", ProofMode::Compressed => "PROOF_MODE_COMPRESSED", ProofMode::Plonk => "PROOF_MODE_PLONK", - ProofMode::Groth16 => "PROOF_MODE_GROTH16", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -324,7 +321,6 @@ impl ProofMode { "PROOF_MODE_CORE" => Some(Self::Core), "PROOF_MODE_COMPRESSED" => Some(Self::Compressed), "PROOF_MODE_PLONK" => Some(Self::Plonk), - "PROOF_MODE_GROTH16" => Some(Self::Groth16), _ => None, } } @@ -363,7 +359,7 @@ impl ProofStatus { /// /// 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 { + pub const fn as_str_name(&self) -> &'static str { match self { ProofStatus::ProofUnspecifiedStatus => "PROOF_UNSPECIFIED_STATUS", ProofStatus::ProofPreparing => "PROOF_PREPARING", @@ -420,7 +416,7 @@ impl TransactionStatus { /// /// 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 { + pub const fn as_str_name(&self) -> &'static str { match self { TransactionStatus::TransactionUnspecifiedStatus => "TRANSACTION_UNSPECIFIED_STATUS", TransactionStatus::TransactionScheduled => "TRANSACTION_SCHEDULED", diff --git a/sdk/src/provers/local.rs b/sdk/src/provers/local.rs index 261c9e771f..87379e164d 100644 --- a/sdk/src/provers/local.rs +++ b/sdk/src/provers/local.rs @@ -1,8 +1,9 @@ use anyhow::Result; +use cfg_if::cfg_if; use sp1_prover::{SP1Prover, SP1Stdin}; use crate::{ - Prover, SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, SP1ProofWithPublicValues, + Prover, SP1CompressedProof, SP1PlonkBn254Proof, SP1Proof, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; @@ -53,44 +54,35 @@ impl Prover for LocalProver { }) } - fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { - let proof = self.prover.prove_core(pk, &stdin)?; - let deferred_proofs = stdin.proofs.iter().map(|p| p.0.clone()).collect(); - let public_values = proof.public_values.clone(); - let reduce_proof = self.prover.compress(&pk.vk, proof, deferred_proofs)?; - let compress_proof = self.prover.shrink(reduce_proof)?; - let outer_proof = self.prover.wrap_bn254(compress_proof)?; + fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { + cfg_if! { + if #[cfg(feature = "plonk")] { - let groth16_aritfacts = if sp1_prover::build::sp1_dev_mode() { - sp1_prover::build::try_build_groth16_artifacts_dev( - &self.prover.wrap_vk, - &outer_proof.proof, - ) - } else { - sp1_prover::build::try_install_groth16_artifacts() - }; - let proof = self.prover.wrap_groth16(outer_proof, &groth16_aritfacts); - Ok(SP1ProofWithPublicValues { - proof, - stdin, - public_values, - }) - } + let proof = self.prover.prove_core(pk, &stdin)?; + let deferred_proofs = stdin.proofs.iter().map(|p| p.0.clone()).collect(); + let public_values = proof.public_values.clone(); + let reduce_proof = self.prover.compress(&pk.vk, proof, deferred_proofs)?; + let compress_proof = self.prover.shrink(reduce_proof)?; + let outer_proof = self.prover.wrap_bn254(compress_proof)?; - fn prove_plonk(&self, _pk: &SP1ProvingKey, _stdin: SP1Stdin) -> Result { - // let proof = self.prover.prove_core(pk, &stdin); - // let deferred_proofs = stdin.proofs.iter().map(|p| p.0.clone()).collect(); - // let public_values = proof.public_values.clone(); - // let reduce_proof = self.prover.compress(&pk.vk, proof, deferred_proofs); - // let compress_proof = self.prover.shrink(&pk.vk, reduce_proof); - // let outer_proof = self.prover.wrap_bn254(&pk.vk, compress_proof); - // let proof = self.prover.wrap_plonk(outer_proof, artifacts_dir); - // Ok(SP1ProofWithPublicValues { - // proof, - // stdin, - // public_values, - // }) - todo!() + let plonk_bn254_aritfacts = if sp1_prover::build::sp1_dev_mode() { + sp1_prover::build::try_build_plonk_bn254_artifacts_dev( + &self.prover.wrap_vk, + &outer_proof.proof, + ) + } else { + sp1_prover::build::try_install_plonk_bn254_artifacts() + }; + let proof = self.prover.wrap_plonk_bn254(outer_proof, &plonk_bn254_aritfacts); + Ok(SP1ProofWithPublicValues { + proof, + stdin, + public_values, + }) + } else { + panic!("plonk bn254 feature not enabled") + } + } } } diff --git a/sdk/src/provers/mock.rs b/sdk/src/provers/mock.rs index 390c494240..66b0dda205 100644 --- a/sdk/src/provers/mock.rs +++ b/sdk/src/provers/mock.rs @@ -1,12 +1,12 @@ #![allow(unused_variables)] use crate::{ - Prover, SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, - SP1ProofVerificationError, SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, + Prover, SP1CompressedProof, SP1PlonkBn254Proof, SP1Proof, SP1ProofVerificationError, + SP1ProofWithPublicValues, SP1ProvingKey, SP1VerifyingKey, }; use anyhow::Result; use p3_field::PrimeField; use sp1_prover::{ - verify::verify_groth16_public_inputs, Groth16Proof, HashableKey, SP1Prover, SP1Stdin, + verify::verify_plonk_bn254_public_inputs, HashableKey, PlonkBn254Proof, SP1Prover, SP1Stdin, }; /// An implementation of [crate::ProverClient] that can generate mock proofs. @@ -52,10 +52,10 @@ impl Prover for MockProver { unimplemented!() } - fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { + fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { let public_values = SP1Prover::execute(&pk.elf, &stdin)?; - Ok(SP1Groth16Proof { - proof: Groth16Proof { + Ok(SP1PlonkBn254Proof { + proof: PlonkBn254Proof { public_inputs: [ pk.vk.hash_bn254().as_canonical_biguint().to_string(), public_values.hash().to_string(), @@ -68,10 +68,6 @@ impl Prover for MockProver { }) } - fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { - todo!() - } - fn verify( &self, _proof: &SP1Proof, @@ -88,12 +84,8 @@ impl Prover for MockProver { Ok(()) } - fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { - verify_groth16_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; - Ok(()) - } - - fn verify_plonk(&self, _proof: &SP1PlonkProof, _vkey: &SP1VerifyingKey) -> Result<()> { + fn verify_plonk(&self, proof: &SP1PlonkBn254Proof, vkey: &SP1VerifyingKey) -> Result<()> { + verify_plonk_bn254_public_inputs(vkey, &proof.public_values, &proof.proof.public_inputs)?; Ok(()) } } diff --git a/sdk/src/provers/mod.rs b/sdk/src/provers/mod.rs index 8475a0f7aa..c18770333c 100644 --- a/sdk/src/provers/mod.rs +++ b/sdk/src/provers/mod.rs @@ -2,7 +2,7 @@ mod local; mod mock; mod network; -use crate::{SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof}; +use crate::{SP1CompressedProof, SP1PlonkBn254Proof, SP1Proof}; use anyhow::Result; pub use local::LocalProver; pub use mock::MockProver; @@ -28,11 +28,8 @@ pub trait Prover: Send + Sync { /// Generate a compressed proof of the execution of a RISCV ELF with the given inputs. fn prove_compressed(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result; - /// Given an SP1 program and input, generate a Groth16 proof that can be verified on-chain. - fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result; - /// Given an SP1 program and input, generate a PLONK proof that can be verified on-chain. - fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result; + fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result; /// Verify that an SP1 proof is valid given its vkey and metadata. fn verify( @@ -56,23 +53,23 @@ pub trait Prover: Send + Sync { .map_err(|e| e.into()) } - /// Verify that a SP1 Groth16 proof is valid. Verify that the public inputs of the Groth16Proof match + /// Verify that a SP1 PLONK proof is valid. Verify that the public inputs of the PlonkBn254 proof match /// the hash of the VK and the committed public values of the SP1ProofWithPublicValues. - fn verify_groth16(&self, proof: &SP1Groth16Proof, vkey: &SP1VerifyingKey) -> Result<()> { + fn verify_plonk(&self, proof: &SP1PlonkBn254Proof, vkey: &SP1VerifyingKey) -> Result<()> { let sp1_prover = self.sp1_prover(); - let groth16_aritfacts = if sp1_prover::build::sp1_dev_mode() { - sp1_prover::build::groth16_artifacts_dev_dir() + let plonk_bn254_aritfacts = if sp1_prover::build::sp1_dev_mode() { + sp1_prover::build::plonk_bn254_artifacts_dev_dir() } else { - sp1_prover::build::groth16_artifacts_dir() + sp1_prover::build::try_install_plonk_bn254_artifacts() }; - sp1_prover.verify_groth16(&proof.proof, vkey, &proof.public_values, &groth16_aritfacts)?; - - Ok(()) - } + sp1_prover.verify_plonk_bn254( + &proof.proof, + vkey, + &proof.public_values, + &plonk_bn254_aritfacts, + )?; - /// Verify that a SP1 PLONK proof is valid given its vkey and metadata. - fn verify_plonk(&self, _proof: &SP1PlonkProof, _vkey: &SP1VerifyingKey) -> Result<()> { Ok(()) } } diff --git a/sdk/src/provers/network.rs b/sdk/src/provers/network.rs index 4e9dc0f9c0..f86900e266 100644 --- a/sdk/src/provers/network.rs +++ b/sdk/src/provers/network.rs @@ -6,12 +6,11 @@ use crate::{ proto::network::{ProofStatus, TransactionStatus}, Prover, }; -use crate::{ - SP1CompressedProof, SP1Groth16Proof, SP1PlonkProof, SP1Proof, SP1ProvingKey, SP1VerifyingKey, -}; +use crate::{SP1CompressedProof, SP1PlonkBn254Proof, SP1Proof, SP1ProvingKey, SP1VerifyingKey}; use anyhow::{Context, Result}; use serde::de::DeserializeOwned; use sp1_core::runtime::{Program, Runtime}; +use sp1_core::utils::SP1CoreOpts; use sp1_prover::utils::block_on; use sp1_prover::{SP1Prover, SP1Stdin}; use tokio::{runtime, time::sleep}; @@ -45,7 +44,8 @@ impl NetworkProver { let client = &self.client; // Execute the runtime before creating the proof request. let program = Program::from(elf); - let mut runtime = Runtime::new(program); + let opts = SP1CoreOpts::default(); + let mut runtime = Runtime::new(program, opts); runtime.write_vecs(&stdin.buffer); for (proof, vkey) in stdin.proofs.iter() { runtime.write_proof(proof.clone(), vkey.clone()); @@ -171,11 +171,7 @@ impl Prover for NetworkProver { block_on(self.prove_async(&pk.elf, stdin, ProofMode::Compressed)) } - fn prove_groth16(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { - block_on(self.prove_async(&pk.elf, stdin, ProofMode::Groth16)) - } - - fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { + fn prove_plonk(&self, pk: &SP1ProvingKey, stdin: SP1Stdin) -> Result { block_on(self.prove_async(&pk.elf, stdin, ProofMode::Plonk)) } } diff --git a/sp1up/sp1up b/sp1up/sp1up index 5524462ba0..94341ec117 100644 --- a/sp1up/sp1up +++ b/sp1up/sp1up @@ -80,7 +80,7 @@ main() { # Install by downloading binaries if [[ "$SP1UP_REPO" == "succinctlabs/sp1" && -z "$SP1UP_BRANCH" && -z "$SP1UP_COMMIT" ]]; then - SP1UP_VERSION=${SP1UP_VERSION:-main} + SP1UP_VERSION=${SP1UP_VERSION:-latest} SP1UP_TAG=$SP1UP_VERSION if [[ "$SP1UP_VERSION" == [[:digit:]]* ]]; then diff --git a/tests/blake3-compress/Cargo.lock b/tests/blake3-compress/Cargo.lock index fbecb1a09f..b45f827d8d 100644 --- a/tests/blake3-compress/Cargo.lock +++ b/tests/blake3-compress/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -221,9 +221,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -299,9 +299,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/blake3-compress/Cargo.toml b/tests/blake3-compress/Cargo.toml index 2e22055ff2..e5987407cc 100644 --- a/tests/blake3-compress/Cargo.toml +++ b/tests/blake3-compress/Cargo.toml @@ -5,4 +5,4 @@ name = "blake3-compress-test" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/blake3-compress/elf/riscv32im-succinct-zkvm-elf b/tests/blake3-compress/elf/riscv32im-succinct-zkvm-elf index 6c2d06f6db..4e0fee0235 100755 Binary files a/tests/blake3-compress/elf/riscv32im-succinct-zkvm-elf and b/tests/blake3-compress/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bls12381-add/Cargo.lock b/tests/bls12381-add/Cargo.lock index 7553aa3b4e..a5ff069cb6 100644 --- a/tests/bls12381-add/Cargo.lock +++ b/tests/bls12381-add/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bls12381-add/Cargo.toml b/tests/bls12381-add/Cargo.toml index 02c91d4cbd..16e8468311 100644 --- a/tests/bls12381-add/Cargo.toml +++ b/tests/bls12381-add/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf index 8e8a374697..fce1bf9ffe 100755 Binary files a/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf and b/tests/bls12381-add/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bls12381-decompress/Cargo.lock b/tests/bls12381-decompress/Cargo.lock index 95b562032c..3f7f5f367e 100644 --- a/tests/bls12381-decompress/Cargo.lock +++ b/tests/bls12381-decompress/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -221,9 +221,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -299,9 +299,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf index 2a411b6a82..818954dc49 100755 Binary files a/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf and b/tests/bls12381-decompress/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bls12381-double/Cargo.lock b/tests/bls12381-double/Cargo.lock index 3d322765ef..baaa834932 100644 --- a/tests/bls12381-double/Cargo.lock +++ b/tests/bls12381-double/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bls12381-double/Cargo.toml b/tests/bls12381-double/Cargo.toml index 1d4a5c6b19..196c93ab2e 100644 --- a/tests/bls12381-double/Cargo.toml +++ b/tests/bls12381-double/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf index b909d2b808..5c4706b8fa 100755 Binary files a/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf and b/tests/bls12381-double/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bls12381-mul/Cargo.lock b/tests/bls12381-mul/Cargo.lock index d4ccbcf0a9..b9194ffe94 100644 --- a/tests/bls12381-mul/Cargo.lock +++ b/tests/bls12381-mul/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bls12381-mul/Cargo.toml b/tests/bls12381-mul/Cargo.toml index c0e8d41e2f..3ba324ce9a 100644 --- a/tests/bls12381-mul/Cargo.toml +++ b/tests/bls12381-mul/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } \ No newline at end of file +sp1-derive = { path = "../../derive" } diff --git a/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf index 507bb12060..313a6226f3 100755 Binary files a/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf and b/tests/bls12381-mul/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bls12381-mul/src/main.rs b/tests/bls12381-mul/src/main.rs index 5592a88ea4..9f90906e92 100644 --- a/tests/bls12381-mul/src/main.rs +++ b/tests/bls12381-mul/src/main.rs @@ -17,7 +17,7 @@ pub fn main() { 252, 228, 138, 29, 116, 237, 48, 158, 160, 241, 160, 170, 227, 129, 244, 179, 8, ]; - let mut a_point = AffinePoint::::from_le_bytes(a); + let mut a_point = AffinePoint::::from_le_bytes(&a); // scalar. // 3 diff --git a/tests/bn254-add/Cargo.lock b/tests/bn254-add/Cargo.lock index b146783e72..eaae54efbf 100644 --- a/tests/bn254-add/Cargo.lock +++ b/tests/bn254-add/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bn254-add/Cargo.toml b/tests/bn254-add/Cargo.toml index 17ab4f68ab..4d07db91e7 100644 --- a/tests/bn254-add/Cargo.toml +++ b/tests/bn254-add/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf index 0d7066203a..a45b52cd9d 100755 Binary files a/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf and b/tests/bn254-add/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bn254-double/Cargo.lock b/tests/bn254-double/Cargo.lock index ea40f4b3a9..9248c331b9 100644 --- a/tests/bn254-double/Cargo.lock +++ b/tests/bn254-double/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -307,9 +307,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -325,9 +325,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -339,20 +339,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -368,9 +367,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -379,11 +378,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -391,9 +389,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -568,18 +566,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bn254-double/Cargo.toml b/tests/bn254-double/Cargo.toml index 5c3ad8cb38..d0d3f75d34 100644 --- a/tests/bn254-double/Cargo.toml +++ b/tests/bn254-double/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } hex-literal = "0.4.1" -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf index c8176c9bd1..2c7bcb6231 100755 Binary files a/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf and b/tests/bn254-double/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bn254-mul/Cargo.lock b/tests/bn254-mul/Cargo.lock index e19d7dd178..4b769f4bcd 100644 --- a/tests/bn254-mul/Cargo.lock +++ b/tests/bn254-mul/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", diff --git a/tests/bn254-mul/Cargo.toml b/tests/bn254-mul/Cargo.toml index a60b87bcbe..fdf493b3f8 100644 --- a/tests/bn254-mul/Cargo.toml +++ b/tests/bn254-mul/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } \ No newline at end of file +sp1-derive = { path = "../../derive" } diff --git a/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf b/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf index b485d42f09..a414416de7 100755 Binary files a/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf and b/tests/bn254-mul/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/bn254-mul/src/main.rs b/tests/bn254-mul/src/main.rs index ac800f6724..841de5e4d0 100644 --- a/tests/bn254-mul/src/main.rs +++ b/tests/bn254-mul/src/main.rs @@ -15,7 +15,7 @@ pub fn main() { 0, 0, 0, 0, ]; - let mut a_point = AffinePoint::::from_le_bytes(a); + let mut a_point = AffinePoint::::from_le_bytes(&a); // scalar. // 3 diff --git a/tests/cycle-tracker/Cargo.lock b/tests/cycle-tracker/Cargo.lock index aee21474f7..d8b648297e 100644 --- a/tests/cycle-tracker/Cargo.lock +++ b/tests/cycle-tracker/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -300,9 +300,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -318,9 +318,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -332,20 +332,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -361,9 +360,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -372,11 +371,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -384,9 +382,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/cycle-tracker/Cargo.toml b/tests/cycle-tracker/Cargo.toml index c8f7979246..b9c2ebf69d 100644 --- a/tests/cycle-tracker/Cargo.toml +++ b/tests/cycle-tracker/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } \ No newline at end of file +sp1-derive = { path = "../../derive" } diff --git a/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf b/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf index e4f518aada..ed3121d5d8 100755 Binary files a/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf and b/tests/cycle-tracker/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/ecrecover/Cargo.lock b/tests/ecrecover/Cargo.lock index cd40275ade..373e948bda 100644 --- a/tests/ecrecover/Cargo.lock +++ b/tests/ecrecover/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -224,9 +224,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -326,9 +326,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -340,20 +340,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -369,9 +368,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -380,11 +379,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -392,9 +390,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -569,18 +567,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/ecrecover/elf/riscv32im-succinct-zkvm-elf b/tests/ecrecover/elf/riscv32im-succinct-zkvm-elf index ec4f7cb291..d75d1642e9 100755 Binary files a/tests/ecrecover/elf/riscv32im-succinct-zkvm-elf and b/tests/ecrecover/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/ed-add/Cargo.lock b/tests/ed-add/Cargo.lock index 5f734f46e9..0505b59e04 100644 --- a/tests/ed-add/Cargo.lock +++ b/tests/ed-add/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -223,9 +223,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -307,9 +307,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -325,9 +325,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -339,20 +339,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -368,9 +367,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -379,11 +378,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -391,9 +389,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -568,18 +566,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/ed-add/Cargo.toml b/tests/ed-add/Cargo.toml index 6aade74516..2b4b819bfd 100644 --- a/tests/ed-add/Cargo.toml +++ b/tests/ed-add/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } hex-literal = "0.4.1" -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/ed-add/elf/riscv32im-succinct-zkvm-elf b/tests/ed-add/elf/riscv32im-succinct-zkvm-elf index 1b7a6c7e8d..1f79b12f49 100755 Binary files a/tests/ed-add/elf/riscv32im-succinct-zkvm-elf and b/tests/ed-add/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/ed-decompress/Cargo.lock b/tests/ed-decompress/Cargo.lock index b1ece025e6..b7a6913b2e 100644 --- a/tests/ed-decompress/Cargo.lock +++ b/tests/ed-decompress/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -222,9 +222,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -306,9 +306,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -324,9 +324,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -338,20 +338,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -367,9 +366,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -378,11 +377,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -390,9 +388,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -567,18 +565,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/ed-decompress/Cargo.toml b/tests/ed-decompress/Cargo.toml index 18089ae207..676a808cbb 100644 --- a/tests/ed-decompress/Cargo.toml +++ b/tests/ed-decompress/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -hex-literal = "0.4.1" \ No newline at end of file +hex-literal = "0.4.1" diff --git a/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf index 985b46383d..10bbf5e06e 100755 Binary files a/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf and b/tests/ed-decompress/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/ed25519/Cargo.lock b/tests/ed25519/Cargo.lock index c1b886567f..c6baa674b2 100644 --- a/tests/ed25519/Cargo.lock +++ b/tests/ed25519/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -380,9 +380,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -394,20 +394,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -423,9 +422,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -434,11 +433,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -446,9 +444,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -644,18 +642,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/ed25519/Cargo.toml b/tests/ed25519/Cargo.toml index 884da0db08..412f7f58ac 100644 --- a/tests/ed25519/Cargo.toml +++ b/tests/ed25519/Cargo.toml @@ -8,4 +8,3 @@ edition = "2021" sp1-zkvm = { path = "../../zkvm/entrypoint" } ed25519-dalek = { git = "https://github.com/sp1-patches/curve25519-dalek", branch = "patch-v4.1.1" } hex-literal = "0.4.1" - diff --git a/tests/ed25519/elf/riscv32im-succinct-zkvm-elf b/tests/ed25519/elf/riscv32im-succinct-zkvm-elf index 228b1fac39..88c83e3c0a 100755 Binary files a/tests/ed25519/elf/riscv32im-succinct-zkvm-elf and b/tests/ed25519/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/fibonacci/Cargo.lock b/tests/fibonacci/Cargo.lock index 235eb054a7..2fd3884c54 100644 --- a/tests/fibonacci/Cargo.lock +++ b/tests/fibonacci/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/fibonacci/Cargo.toml b/tests/fibonacci/Cargo.toml index 7d2b49c5e2..31f8878487 100644 --- a/tests/fibonacci/Cargo.toml +++ b/tests/fibonacci/Cargo.toml @@ -5,4 +5,4 @@ name = "fibonacci-program" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf b/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf index d8dc1a0073..1c59449d83 100755 Binary files a/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf and b/tests/fibonacci/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/hint-io/Cargo.lock b/tests/hint-io/Cargo.lock index 318856330c..7f101bd208 100644 --- a/tests/hint-io/Cargo.lock +++ b/tests/hint-io/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -299,9 +299,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/hint-io/elf/riscv32im-succinct-zkvm-elf b/tests/hint-io/elf/riscv32im-succinct-zkvm-elf index 6581c40a6d..69fc40b116 100755 Binary files a/tests/hint-io/elf/riscv32im-succinct-zkvm-elf and b/tests/hint-io/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/keccak-permute/Cargo.lock b/tests/keccak-permute/Cargo.lock index dcf86babd7..92931e9308 100644 --- a/tests/keccak-permute/Cargo.lock +++ b/tests/keccak-permute/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -299,9 +299,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -317,9 +317,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -331,20 +331,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -360,9 +359,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -371,11 +370,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -383,9 +381,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/keccak-permute/Cargo.toml b/tests/keccak-permute/Cargo.toml index 29ddca726e..ce764242b5 100644 --- a/tests/keccak-permute/Cargo.toml +++ b/tests/keccak-permute/Cargo.toml @@ -5,4 +5,4 @@ name = "keccak-permute-test" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf b/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf index cf2703d4a0..a843a07799 100755 Binary files a/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf and b/tests/keccak-permute/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/keccak256/Cargo.lock b/tests/keccak256/Cargo.lock index 8bc496f60a..dc41372bae 100644 --- a/tests/keccak256/Cargo.lock +++ b/tests/keccak256/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -220,9 +220,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -306,9 +306,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -324,9 +324,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -338,20 +338,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -367,9 +366,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -378,11 +377,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -390,9 +388,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -567,18 +565,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/keccak256/Cargo.toml b/tests/keccak256/Cargo.toml index 734352bd0b..679b2a6581 100644 --- a/tests/keccak256/Cargo.toml +++ b/tests/keccak256/Cargo.toml @@ -6,4 +6,6 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch="patch-v2.0.2", features = ["keccak"] } +tiny-keccak = { git = "https://github.com/sp1-patches/tiny-keccak", branch = "patch-v2.0.2", features = [ + "keccak", +] } diff --git a/tests/keccak256/elf/riscv32im-succinct-zkvm-elf b/tests/keccak256/elf/riscv32im-succinct-zkvm-elf index 567e8d7d1d..48e4965b34 100755 Binary files a/tests/keccak256/elf/riscv32im-succinct-zkvm-elf and b/tests/keccak256/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/panic/elf/riscv32im-succinct-zkvm-elf b/tests/panic/elf/riscv32im-succinct-zkvm-elf index 8f81cde6d3..e68a4a4dc9 100755 Binary files a/tests/panic/elf/riscv32im-succinct-zkvm-elf and b/tests/panic/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/secp256k1-add/Cargo.lock b/tests/secp256k1-add/Cargo.lock index ee47acbf5e..2f10d263b1 100644 --- a/tests/secp256k1-add/Cargo.lock +++ b/tests/secp256k1-add/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -316,9 +316,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -330,20 +330,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -359,9 +358,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -370,11 +369,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -382,9 +380,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -568,18 +566,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/secp256k1-add/Cargo.toml b/tests/secp256k1-add/Cargo.toml index 368813533d..49c0b03008 100644 --- a/tests/secp256k1-add/Cargo.toml +++ b/tests/secp256k1-add/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } hex-literal = "0.4.1" -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf index 7324553dd3..339003c773 100755 Binary files a/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf and b/tests/secp256k1-add/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/secp256k1-decompress/Cargo.lock b/tests/secp256k1-decompress/Cargo.lock index b40681e144..bab9197817 100644 --- a/tests/secp256k1-decompress/Cargo.lock +++ b/tests/secp256k1-decompress/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -310,9 +310,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -324,20 +324,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -353,9 +352,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -364,11 +363,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -376,9 +374,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -560,18 +558,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/secp256k1-decompress/Cargo.toml b/tests/secp256k1-decompress/Cargo.toml index 2ae86ed3a0..bd80d18ab3 100644 --- a/tests/secp256k1-decompress/Cargo.toml +++ b/tests/secp256k1-decompress/Cargo.toml @@ -5,4 +5,4 @@ name = "secp256k1-decompress-test" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf index d594b8f840..e06da48d78 100755 Binary files a/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf and b/tests/secp256k1-decompress/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/secp256k1-double/Cargo.lock b/tests/secp256k1-double/Cargo.lock index ac8149243e..b34dbf384c 100644 --- a/tests/secp256k1-double/Cargo.lock +++ b/tests/secp256k1-double/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -316,9 +316,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -330,20 +330,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -359,9 +358,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -370,11 +369,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -382,9 +380,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -568,18 +566,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/secp256k1-double/Cargo.toml b/tests/secp256k1-double/Cargo.toml index 3a0d0a546f..dc8f3f3592 100644 --- a/tests/secp256k1-double/Cargo.toml +++ b/tests/secp256k1-double/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } hex-literal = "0.4.1" -num = { version = "0.4.1", default-features = false } \ No newline at end of file +num = { version = "0.4.1", default-features = false } diff --git a/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf index b3386144a4..6ad007626d 100755 Binary files a/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf and b/tests/secp256k1-double/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/secp256k1-mul/Cargo.lock b/tests/secp256k1-mul/Cargo.lock index b948f5aec6..be7fc96741 100644 --- a/tests/secp256k1-mul/Cargo.lock +++ b/tests/secp256k1-mul/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -310,9 +310,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -324,20 +324,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -353,9 +352,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -364,11 +363,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -376,9 +374,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -561,18 +559,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", diff --git a/tests/secp256k1-mul/Cargo.toml b/tests/secp256k1-mul/Cargo.toml index 0ed92ad12c..79774d01f8 100644 --- a/tests/secp256k1-mul/Cargo.toml +++ b/tests/secp256k1-mul/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } \ No newline at end of file +sp1-derive = { path = "../../derive" } diff --git a/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf b/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf index 94cd51e740..ec0db8bd02 100755 Binary files a/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf and b/tests/secp256k1-mul/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/secp256k1-mul/src/main.rs b/tests/secp256k1-mul/src/main.rs index 97cc94728d..731a81b381 100644 --- a/tests/secp256k1-mul/src/main.rs +++ b/tests/secp256k1-mul/src/main.rs @@ -16,7 +16,7 @@ pub fn main() { 38, 119, 218, 58, 72, ]; - let mut a_point = AffinePoint::::from_le_bytes(a); + let mut a_point = AffinePoint::::from_le_bytes(&a); // scalar. // 3 diff --git a/tests/sha-compress/Cargo.lock b/tests/sha-compress/Cargo.lock index 2527ef6743..074ddfec5b 100644 --- a/tests/sha-compress/Cargo.lock +++ b/tests/sha-compress/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -310,9 +310,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -324,20 +324,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -353,9 +352,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -364,11 +363,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -376,9 +374,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -553,18 +551,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/sha-compress/Cargo.toml b/tests/sha-compress/Cargo.toml index ed4e6de43b..0e6422b80b 100644 --- a/tests/sha-compress/Cargo.toml +++ b/tests/sha-compress/Cargo.toml @@ -5,4 +5,4 @@ name = "sha-compress-test" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf b/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf index 5763ec0854..97126f881c 100755 Binary files a/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf and b/tests/sha-compress/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/sha-extend/Cargo.lock b/tests/sha-extend/Cargo.lock index ec5bdc8cfe..89c5065f99 100644 --- a/tests/sha-extend/Cargo.lock +++ b/tests/sha-extend/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -310,9 +310,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -324,20 +324,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -353,9 +352,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -364,11 +363,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -376,9 +374,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -553,18 +551,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/sha-extend/Cargo.toml b/tests/sha-extend/Cargo.toml index db44d581cd..576dd8b680 100644 --- a/tests/sha-extend/Cargo.toml +++ b/tests/sha-extend/Cargo.toml @@ -5,4 +5,4 @@ name = "sha-extend-test" edition = "2021" [dependencies] -sp1-zkvm = { path = "../../zkvm/entrypoint" } \ No newline at end of file +sp1-zkvm = { path = "../../zkvm/entrypoint" } diff --git a/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf b/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf index 1ec37ef88b..7b8774766b 100755 Binary files a/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf and b/tests/sha-extend/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/sha2/Cargo.lock b/tests/sha2/Cargo.lock index 374f6494a6..6e417a8fcb 100644 --- a/tests/sha2/Cargo.lock +++ b/tests/sha2/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -298,9 +298,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -316,9 +316,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -330,20 +330,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -359,9 +358,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -370,11 +369,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -382,9 +380,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -559,18 +557,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/sha2/Cargo.toml b/tests/sha2/Cargo.toml index 8c7095d276..0db676e24a 100644 --- a/tests/sha2/Cargo.toml +++ b/tests/sha2/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" sp1-zkvm = { path = "../../zkvm/entrypoint" } hex-literal = "0.4.1" sha2 = { git = "https://github.com/succinctbot/RustCrypto-hashes.git" } -hex = "0.4.3" \ No newline at end of file +hex = "0.4.3" diff --git a/tests/sha2/elf/riscv32im-succinct-zkvm-elf b/tests/sha2/elf/riscv32im-succinct-zkvm-elf index 5360dd3a37..ff4661defc 100755 Binary files a/tests/sha2/elf/riscv32im-succinct-zkvm-elf and b/tests/sha2/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/tendermint-benchmark/Cargo.lock b/tests/tendermint-benchmark/Cargo.lock index e6c8651b20..1ebe15982b 100644 --- a/tests/tendermint-benchmark/Cargo.lock +++ b/tests/tendermint-benchmark/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -477,9 +477,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -491,20 +491,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -537,9 +536,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -548,11 +547,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -560,9 +558,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -805,9 +803,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -823,9 +821,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/tendermint-benchmark/Cargo.toml b/tests/tendermint-benchmark/Cargo.toml index c64fc40a4a..944d94bbd3 100644 --- a/tests/tendermint-benchmark/Cargo.toml +++ b/tests/tendermint-benchmark/Cargo.toml @@ -10,9 +10,9 @@ serde_json = { version = "1.0", default-features = false, features = ["alloc"] } serde = { version = "1.0", default-features = false, features = ["derive"] } tendermint = { version = "0.34.0", default-features = false } tendermint-light-client-verifier = { version = "0.34.0", default-features = false, features = [ - "rust-crypto", + "rust-crypto", ] } [patch.crates-io] sha2-v0-9-8 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-v0.9.8" } -ed25519-consensus = { git = "https://github.com/sp1-patches/ed25519-consensus", branch = "patch-v2.1.0" } \ No newline at end of file +ed25519-consensus = { git = "https://github.com/sp1-patches/ed25519-consensus", branch = "patch-v2.1.0" } diff --git a/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf b/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf index f895debb0c..d67e8be4d5 100755 Binary files a/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf and b/tests/tendermint-benchmark/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/uint256-arith/Cargo.lock b/tests/uint256-arith/Cargo.lock index 51853b0b08..47e177abcc 100644 --- a/tests/uint256-arith/Cargo.lock +++ b/tests/uint256-arith/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -321,9 +321,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -335,20 +335,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -364,9 +363,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -375,11 +374,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -387,9 +385,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -564,18 +562,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/uint256-arith/Cargo.toml b/tests/uint256-arith/Cargo.toml index d92b54abf1..54cca58f13 100644 --- a/tests/uint256-arith/Cargo.toml +++ b/tests/uint256-arith/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] sp1-zkvm = { path = "../../zkvm/entrypoint" } sp1-derive = { git = "https://github.com/succinctlabs/sp1.git" } -crypto-bigint = "0.6.0-pre.12" \ No newline at end of file +crypto-bigint = "0.6.0-pre.12" diff --git a/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf b/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf index 116ed2fe43..83a521f1b2 100755 Binary files a/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf and b/tests/uint256-arith/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/uint256-div/Cargo.lock b/tests/uint256-div/Cargo.lock index e228a8294f..136db8c0b0 100644 --- a/tests/uint256-div/Cargo.lock +++ b/tests/uint256-div/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -214,9 +214,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -292,9 +292,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -310,9 +310,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -324,20 +324,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -353,9 +352,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -364,11 +363,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -376,9 +374,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -553,18 +551,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/uint256-div/Cargo.toml b/tests/uint256-div/Cargo.toml index 2ec1c772c1..495c8bc9a6 100644 --- a/tests/uint256-div/Cargo.toml +++ b/tests/uint256-div/Cargo.toml @@ -8,4 +8,4 @@ edition = "2021" rand = "0.8" num = { version = "0.4.1" } sp1-zkvm = { path = "../../zkvm/entrypoint" } -sp1-derive = { path = "../../derive" } \ No newline at end of file +sp1-derive = { path = "../../derive" } diff --git a/tests/uint256-div/elf/riscv32im-succinct-zkvm-elf b/tests/uint256-div/elf/riscv32im-succinct-zkvm-elf index e3c869688b..ca4f0641f3 100755 Binary files a/tests/uint256-div/elf/riscv32im-succinct-zkvm-elf and b/tests/uint256-div/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/uint256-mul/Cargo.lock b/tests/uint256-mul/Cargo.lock index 4926ef2a63..d5ede11404 100644 --- a/tests/uint256-mul/Cargo.lock +++ b/tests/uint256-mul/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -231,9 +231,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -309,9 +309,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -327,9 +327,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -341,20 +341,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -370,9 +369,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -381,11 +380,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -393,9 +391,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -570,18 +568,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf b/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf index 06320324af..b49313ca61 100755 Binary files a/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf and b/tests/uint256-mul/elf/riscv32im-succinct-zkvm-elf differ diff --git a/tests/verify-proof/Cargo.lock b/tests/verify-proof/Cargo.lock index 4467585731..059b6fad62 100644 --- a/tests/verify-proof/Cargo.lock +++ b/tests/verify-proof/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" @@ -343,9 +343,9 @@ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -357,20 +357,19 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -386,9 +385,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -397,11 +396,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -409,9 +407,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -425,7 +423,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "p3-baby-bear" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "num-bigint", "p3-field", @@ -439,7 +437,7 @@ dependencies = [ [[package]] name = "p3-dft" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "p3-field", "p3-matrix", @@ -451,7 +449,7 @@ dependencies = [ [[package]] name = "p3-field" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "num-bigint", @@ -464,7 +462,7 @@ dependencies = [ [[package]] name = "p3-matrix" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-field", @@ -478,12 +476,12 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" [[package]] name = "p3-mds" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-dft", @@ -497,7 +495,7 @@ dependencies = [ [[package]] name = "p3-poseidon2" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "gcd", "p3-field", @@ -509,7 +507,7 @@ dependencies = [ [[package]] name = "p3-symmetric" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "itertools", "p3-field", @@ -519,7 +517,7 @@ dependencies = [ [[package]] name = "p3-util" version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?branch=sp1#aef4f8f03f960925f7088d757aeeb956a7f4b30c" +source = "git+https://github.com/Plonky3/Plonky3.git?rev=3b5265f9d5af36534a46caebf0617595cfb42c5a#3b5265f9d5af36534a46caebf0617595cfb42c5a" dependencies = [ "serde", ] @@ -694,18 +692,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", diff --git a/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf b/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf index b74d424c07..63f478712f 100755 Binary files a/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf and b/tests/verify-proof/elf/riscv32im-succinct-zkvm-elf differ diff --git a/zkvm/entrypoint/Cargo.toml b/zkvm/entrypoint/Cargo.toml index 422a49dade..1c69b11628 100644 --- a/zkvm/entrypoint/Cargo.toml +++ b/zkvm/entrypoint/Cargo.toml @@ -22,8 +22,8 @@ sha2 = { version = "0.10.8" } default = ["libm"] libm = ["dep:libm"] verify = [ - "dep:sp1-primitives", - "dep:p3-baby-bear", - "dep:p3-field", - "sp1-precompiles/verify", + "dep:sp1-primitives", + "dep:p3-baby-bear", + "dep:p3-field", + "sp1-precompiles/verify", ] diff --git a/zkvm/entrypoint/src/syscalls/sys.rs b/zkvm/entrypoint/src/syscalls/sys.rs index bea32c3e57..2a62372a62 100644 --- a/zkvm/entrypoint/src/syscalls/sys.rs +++ b/zkvm/entrypoint/src/syscalls/sys.rs @@ -9,7 +9,7 @@ pub unsafe extern "C" fn sys_panic(msg_ptr: *const u8, len: usize) -> ! { #[allow(unused_variables)] #[no_mangle] -pub fn sys_getenv( +pub const fn sys_getenv( recv_buf: *mut u32, words: usize, varname: *const u8, @@ -20,7 +20,7 @@ pub fn sys_getenv( #[allow(unused_variables)] #[no_mangle] -pub fn sys_alloc_words(nwords: usize) -> *mut u32 { +pub const fn sys_alloc_words(nwords: usize) -> *mut u32 { core::ptr::null_mut() } diff --git a/zkvm/precompiles/Cargo.toml b/zkvm/precompiles/Cargo.toml index cbd3c254ed..5b1fbd73ff 100644 --- a/zkvm/precompiles/Cargo.toml +++ b/zkvm/precompiles/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] amcl = { package = "snowbridge-amcl", version = "1.0.2", default-features = false, features = [ - "bls381", + "bls381", ] } anyhow = "1.0.83" bincode = "1.3.3" diff --git a/zkvm/precompiles/src/lib.rs b/zkvm/precompiles/src/lib.rs index f5cf90bdcc..a31134c12e 100644 --- a/zkvm/precompiles/src/lib.rs +++ b/zkvm/precompiles/src/lib.rs @@ -1,6 +1,3 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - pub mod bigint_mulmod; pub mod bls12381; pub mod bn254; diff --git a/zkvm/precompiles/src/secp256k1.rs b/zkvm/precompiles/src/secp256k1.rs index 91a32054d0..5bbc59a000 100644 --- a/zkvm/precompiles/src/secp256k1.rs +++ b/zkvm/precompiles/src/secp256k1.rs @@ -93,7 +93,7 @@ pub fn verify_signature( pubkey_y_le_bytes.reverse(); // Convert the public key to an affine point - let affine = AffinePoint::::from(pubkey_x_le_bytes.into(), pubkey_y_le_bytes.into()); + let affine = AffinePoint::::from(&pubkey_x_le_bytes, &pubkey_y_le_bytes); const GENERATOR: AffinePoint = AffinePoint::::generator_in_affine(); diff --git a/zkvm/precompiles/src/utils.rs b/zkvm/precompiles/src/utils.rs index d73b485b1e..c2cf1a0d7e 100644 --- a/zkvm/precompiles/src/utils.rs +++ b/zkvm/precompiles/src/utils.rs @@ -21,20 +21,25 @@ impl + Copy, const NUM_WORDS: usize> AffinePoint Self { + pub const fn new(limbs: [u32; NUM_WORDS]) -> Self { Self { limbs, _marker: std::marker::PhantomData, } } - pub fn from(x_bytes: [u8; NUM_WORDS * 2], y_bytes: [u8; NUM_WORDS * 2]) -> Self - where - [(); NUM_WORDS / 2]:, - { + /// x_bytes and y_bytes are the concatenated little endian representations of the x and y coordinates. + /// The length of x_bytes and y_bytes must each be NUM_WORDS * 2. + pub fn from(x_bytes: &[u8], y_bytes: &[u8]) -> Self { + debug_assert!(x_bytes.len() == NUM_WORDS * 2); + debug_assert!(y_bytes.len() == NUM_WORDS * 2); + let mut limbs = [0u32; NUM_WORDS]; - let x = bytes_to_words_le::<{ NUM_WORDS / 2 }>(&x_bytes); - let y = bytes_to_words_le::<{ NUM_WORDS / 2 }>(&y_bytes); + let x = bytes_to_words_le(x_bytes); + let y = bytes_to_words_le(y_bytes); + debug_assert!(x.len() == NUM_WORDS / 2); + debug_assert!(y.len() == NUM_WORDS / 2); + limbs[..(NUM_WORDS / 2)].copy_from_slice(&x); limbs[(NUM_WORDS / 2)..].copy_from_slice(&y); Self::new(limbs) @@ -48,7 +53,9 @@ impl + Copy, const NUM_WORDS: usize> AffinePoint = None; let mut temp = *self; @@ -68,37 +75,35 @@ impl + Copy, const NUM_WORDS: usize> AffinePoint Self { - let u32_limbs = bytes_to_words_le::<{ NUM_WORDS }>(&limbs); + pub fn from_le_bytes(limbs: &[u8]) -> Self { + let u32_limbs = bytes_to_words_le(limbs); + debug_assert!(u32_limbs.len() == NUM_WORDS); + Self { - limbs: u32_limbs, + limbs: u32_limbs.try_into().unwrap(), _marker: std::marker::PhantomData, } } - pub fn to_le_bytes(&self) -> [u8; NUM_WORDS * 4] { - words_to_bytes_le::<{ NUM_WORDS * 4 }>(&self.limbs) + pub fn to_le_bytes(&self) -> Vec { + let le_bytes = words_to_bytes_le(&self.limbs); + debug_assert!(le_bytes.len() == NUM_WORDS * 4); + le_bytes } } /// Converts a slice of words to a byte array in little endian. -pub fn words_to_bytes_le(words: &[u32]) -> [u8; B] { - debug_assert_eq!(words.len() * 4, B); +pub fn words_to_bytes_le(words: &[u32]) -> Vec { words .iter() .flat_map(|word| word.to_le_bytes().to_vec()) .collect::>() - .try_into() - .unwrap() } /// Converts a byte array in little endian to a slice of words. -pub fn bytes_to_words_le(bytes: &[u8]) -> [u32; W] { - debug_assert_eq!(bytes.len(), W * 4); +pub fn bytes_to_words_le(bytes: &[u8]) -> Vec { bytes .chunks_exact(4) .map(|chunk| u32::from_le_bytes(chunk.try_into().unwrap())) .collect::>() - .try_into() - .unwrap() }