diff --git a/.github/workflows/proof.yml b/.github/workflows/proof.yml index e325a7c..9b3c741 100644 --- a/.github/workflows/proof.yml +++ b/.github/workflows/proof.yml @@ -4,9 +4,12 @@ name: Proof Generation on: workflow_dispatch: +env: + SHELL: "/bin/bash" + jobs: sp1-proof-gen: - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: buildjet-8vcpu-ubuntu-2204 steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -23,7 +26,15 @@ jobs: with: prefix-key: v2-rust + - uses: buildjet/cache@v3 + with: + path: ~/.local/share/ark-srs + key: buildjet-ark-srs-${{ hashFiles('**/*.bin') }} + restore-keys: | + buildjet-ark-srs- + - name: Install SP1 toolchain + shell: bash run: | curl -L https://sp1.succinct.xyz | bash ~/.sp1/bin/sp1up diff --git a/.gitignore b/.gitignore index b4c6efd..3b20ac8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ tmp/ .pre-commit-config.yaml target/ +elf/ diff --git a/Cargo.lock b/Cargo.lock index 38574ac..42c421c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aes" version = "0.8.4" @@ -100,9 +106,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a43b18702501396fa9bcdeecd533bc85fac75150d308fc0f6800a01e6234a003" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ "arrayvec", "bytes", @@ -119,7 +125,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -131,11 +137,11 @@ dependencies = [ "alloy-sol-macro-input", "const-hex", "heck", - "indexmap 2.2.6", + "indexmap 2.4.0", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", "syn-solidity", "tiny-keccak", ] @@ -151,7 +157,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", "syn-solidity", ] @@ -193,9 +199,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -208,33 +214,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -246,6 +252,133 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb00293ba84f51ce3bd026bd0de55899c4e68f0a39a5728cebae3a73ffdc0a4f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-bw6-761" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e0605daf0cc5aa2034b78d008aaf159f56901d92a52ee4f6ecdfdac4f426700" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "rayon", + "zeroize", +] + +[[package]] +name = "ark-ed-on-bls12-377" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b10d901b9ac4b38f9c32beacedfadcdd64e46f8d7f8e88c1ae1060022cf6f6c6" +dependencies = [ + "ark-bls12-377", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bls12-381" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6d678bb98a7e4f825bd4e332e93ac4f5a114ce2e3340dee4d7dc1c7ab5b323" +dependencies = [ + "ark-bls12-381", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-ed-on-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71892f265d01650e34988a546b37ea1d2ba1da162a639597a03d1550f26004d8" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -280,6 +413,7 @@ dependencies = [ "num-bigint 0.4.6", "num-traits", "paste", + "rayon", "rustc_version 0.4.0", "zeroize", ] @@ -329,6 +463,50 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "rayon", +] + +[[package]] +name = "ark-poly-commit" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a741492629ffcd228337676dc223a28551aa6792eedb8a2a22c767f00df6c89" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "rayon", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber 0.2.25", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -345,11 +523,57 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", "num-bigint 0.4.6", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-srs" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6e9a7036d369a637b2b9f871bc06cefe52a947c98e898dbafab26548f8aa22" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly-commit", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "directories", + "hex-literal", + "rand", + "sha2", + "tracing", + "tracing-subscriber 0.3.18", + "ureq", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -368,19 +592,20 @@ checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", "rand", + "rayon", ] [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" @@ -390,7 +615,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -418,7 +643,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -429,16 +654,16 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ "async-trait", "axum-core", "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "hyper 1.4.1", "hyper-util", @@ -453,7 +678,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.1", + "sync_wrapper 0.1.2", "tokio", "tower", "tower-layer", @@ -471,7 +696,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "mime", "pin-project-lite", @@ -492,7 +717,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", "serde", @@ -522,6 +747,16 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64-bytes" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce54e4e485fa0eed9c3aa5348162be09168f75bb5be7bc6587bcf2a65ee1386" +dependencies = [ + "base64 0.22.1", + "serde", +] + [[package]] name = "base64ct" version = "1.6.0" @@ -552,7 +787,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -560,9 +795,9 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", "shlex", - "syn 2.0.70", + "syn 2.0.75", "which", ] @@ -627,16 +862,16 @@ dependencies = [ [[package]] name = "blake3" -version = "1.5.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +checksum = "d82033247fd8e890df8f740e407ad4d038debb9eb1f40533fffb32e7d17dc6f7" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", - "rayon", + "rayon-core", ] [[package]] @@ -685,9 +920,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" [[package]] name = "byteorder" @@ -697,18 +932,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -738,13 +973,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -798,9 +1033,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.9" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -808,33 +1043,39 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.9" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.1", ] [[package]] name = "clap_derive" -version = "4.5.8" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] name = "clap_lex" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "coins-bip32" @@ -890,9 +1131,27 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "committable" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05a8809c2761232ce27226ef1ca1bc78b480b558406895848f76ab8fce04076c" +dependencies = [ + "arbitrary", + "ark-serialize 0.4.2", + "bitvec", + "derivative", + "derive_more", + "funty", + "hex", + "serde", + "sha3", + "tagged-base64", +] [[package]] name = "console" @@ -950,19 +1209,34 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] +[[package]] +name = "crc-any" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62ec9ff5f7965e4d7280bd5482acd20aadb50d632cf6c1d74493856b011fa73" + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1048,7 +1322,17 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core 0.13.4", + "darling_macro 0.13.4", ] [[package]] @@ -1057,8 +1341,22 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.10", + "darling_macro 0.20.10", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] @@ -1071,8 +1369,19 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.70", + "strsim 0.11.1", + "syn 2.0.75", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core 0.13.4", + "quote", + "syn 1.0.109", ] [[package]] @@ -1081,9 +1390,9 @@ version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ - "darling_core", + "darling_core 0.20.10", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -1117,6 +1426,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1127,7 +1447,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -1151,6 +1471,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs" version = "5.0.1" @@ -1172,6 +1501,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "downcast-rs" version = "1.2.1" @@ -1180,9 +1520,15 @@ checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "dunce" -version = "1.0.4" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "ecdsa" @@ -1203,6 +1549,9 @@ name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +dependencies = [ + "serde", +] [[package]] name = "elf" @@ -1226,10 +1575,21 @@ dependencies = [ "rand_core", "sec1", "subtle", - "tap", "zeroize", ] +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + [[package]] name = "encode_unicode" version = "0.3.6" @@ -1279,6 +1639,62 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "espresso-derivation" +version = "0.1.0" +dependencies = [ + "committable", + "espresso-derivation-utils", + "jf-merkle-tree", + "jf-vid", + "sp1-zkvm", +] + +[[package]] +name = "espresso-derivation-prover" +version = "0.1.0" +dependencies = [ + "alloy-sol-types", + "ark-srs", + "bincode", + "clap", + "committable", + "espresso-derivation-utils", + "hex", + "jf-merkle-tree", + "jf-pcs", + "jf-vid", + "rand", + "serde", + "serde_json", + "sp1-helper", + "sp1-sdk", + "tracing", +] + +[[package]] +name = "espresso-derivation-utils" +version = "0.1.0" +dependencies = [ + "ark-bn254", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "base64-bytes", + "bincode", + "committable", + "either", + "jf-merkle-tree", + "jf-pcs", + "jf-utils", + "jf-vid", + "primitive-types", + "serde", + "serde_json", + "serde_with 1.14.0", + "sha2", + "tagged-base64", +] + [[package]] name = "eth-keystore" version = "0.5.0" @@ -1411,7 +1827,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.70", + "syn 2.0.75", "toml", "walkdir", ] @@ -1429,7 +1845,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -1447,7 +1863,7 @@ dependencies = [ "ethabi", "generic-array 0.14.7", "k256", - "num_enum 0.7.2", + "num_enum 0.7.3", "once_cell", "open-fastrlp", "rand", @@ -1455,7 +1871,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.70", + "syn 2.0.75", "tempfile", "thiserror", "tiny-keccak", @@ -1616,26 +2032,6 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" -[[package]] -name = "fibonacci-program" -version = "0.1.0" -dependencies = [ - "alloy-sol-types", - "sp1-zkvm", -] - -[[package]] -name = "fibonacci-script" -version = "0.1.0" -dependencies = [ - "alloy-sol-types", - "clap", - "serde", - "serde_json", - "sp1-sdk", - "tracing", -] - [[package]] name = "fixed-hash" version = "0.8.0" @@ -1648,6 +2044,16 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "flate2" +version = "1.0.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1750,7 +2156,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -1814,6 +2220,7 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", "zeroize", @@ -1912,7 +2319,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.2.6", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -1921,9 +2328,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -1931,7 +2338,7 @@ dependencies = [ "futures-core", "futures-sink", "http 1.1.0", - "indexmap 2.2.6", + "indexmap 2.4.0", "slab", "tokio", "tokio-util", @@ -1967,6 +2374,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.5" @@ -1975,6 +2391,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -2063,9 +2480,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http 1.1.0", @@ -2080,7 +2497,7 @@ dependencies = [ "bytes", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -2129,9 +2546,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "httparse", "httpdate", "itoa", @@ -2177,15 +2594,15 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "hyper 1.4.1", "pin-project-lite", "socket2", @@ -2291,9 +2708,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -2339,9 +2756,9 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" @@ -2376,20 +2793,188 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jf-commitment" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-std 0.4.0", +] + +[[package]] +name = "jf-crhf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "jf-merkle-tree" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "displaydoc", + "hashbrown 0.14.5", + "itertools 0.12.1", + "jf-relation", + "jf-rescue", + "jf-utils", + "num-bigint 0.4.6", + "num-traits", + "serde", + "sha3", + "tagged-base64", +] + +[[package]] +name = "jf-pcs" +version = "0.1.0" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" +dependencies = [ + "ark-bn254", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "displaydoc", + "itertools 0.12.1", + "jf-utils", + "merlin", + "rayon", + "sp1-zkvm", +] + +[[package]] +name = "jf-prf" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "jf-relation" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-bw6-761", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "displaydoc", + "downcast-rs", + "dyn-clone", + "hashbrown 0.14.5", + "itertools 0.12.1", + "jf-utils", + "num-bigint 0.4.6", + "rand_chacha", + "rayon", +] + +[[package]] +name = "jf-rescue" +version = "0.1.0" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-bls12-377", + "ark-bls12-381", + "ark-bn254", + "ark-bw6-761", + "ark-crypto-primitives", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", + "ark-ed-on-bn254", + "ark-ff 0.4.2", + "ark-std 0.4.0", + "displaydoc", + "itertools 0.12.1", + "jf-commitment", + "jf-crhf", + "jf-prf", + "jf-relation", + "jf-utils", +] + +[[package]] +name = "jf-utils" +version = "0.4.4" +source = "git+https://github.com/EspressoSystems/jellyfish?tag=0.4.5#7d71dbeff14f1a501b0b0dc391f1dffa1b8374fb" +dependencies = [ + "ark-ec", + "ark-ed-on-bls12-377", + "ark-ed-on-bls12-381", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "digest 0.10.7", + "displaydoc", + "rand_chacha", + "rayon", + "serde", + "sha2", + "tagged-base64", +] + +[[package]] +name = "jf-vid" +version = "0.1.0" +source = "git+https://www.github.com/EspressoSystems/jellyfish.git?branch=sp1-patches#dde2c69bf818685a7e3dee78f51c049d5e435c92" +dependencies = [ + "anyhow", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "displaydoc", + "generic-array 0.14.7", + "itertools 0.12.1", + "jf-merkle-tree", + "jf-pcs", + "jf-utils", + "rayon", + "serde", + "tagged-base64", +] + [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -2447,9 +3032,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" +checksum = "422fbc7ff2f2f5bdffeb07718e5a5324dca72b0c9293d50df4026652385e3314" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2472,9 +3057,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libgit2-sys" @@ -2490,9 +3075,9 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -2516,9 +3101,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.18" +version = "1.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" +checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" dependencies = [ "cc", "libc", @@ -2575,6 +3160,18 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2145869435ace5ea6ea3d35f59be559317ec9a0d04e1812d5f185a87b6d36f1a" +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core", + "zeroize", +] + [[package]] name = "mime" version = "0.3.17" @@ -2596,15 +3193,25 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2640,6 +3247,15 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2762,11 +3378,11 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" dependencies = [ - "num_enum_derive 0.7.2", + "num_enum_derive 0.7.3", ] [[package]] @@ -2783,14 +3399,14 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -2810,9 +3426,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.36.1" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -2823,6 +3439,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oneshot" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" + [[package]] name = "open-fastrlp" version = "0.1.4" @@ -2871,7 +3493,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -2906,8 +3528,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p3-air" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e909ef66fa5d77ff0fd3cb5af4b33b27fa6fb68d02b9b1e70edbc29383e565" dependencies = [ "p3-field", "p3-matrix", @@ -2915,8 +3538,9 @@ dependencies = [ [[package]] name = "p3-baby-bear" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46965470aac1cddfe52f535424b59d52f2fffef0fdeb9dbed19da39b1d8f048a" dependencies = [ "num-bigint 0.4.6", "p3-field", @@ -2929,8 +3553,9 @@ dependencies = [ [[package]] name = "p3-blake3" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36ef32d6ea21dd5cf9fec8a31bf0c64e6ceee8901dbf50966b83a443093c2aba" dependencies = [ "blake3", "p3-symmetric", @@ -2938,8 +3563,9 @@ dependencies = [ [[package]] name = "p3-bn254-fr" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3edfca6be3b3109adf8e3330baec30c3fc5f9f4d63d27aaec1b471ca51ed67" dependencies = [ "ff 0.13.0", "num-bigint 0.4.6", @@ -2952,8 +3578,9 @@ dependencies = [ [[package]] name = "p3-challenger" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6662ea899a5d848b60c699944491d72757873b5e1fd46798e4712f90a03a4e9" dependencies = [ "p3-field", "p3-maybe-rayon", @@ -2964,8 +3591,9 @@ dependencies = [ [[package]] name = "p3-commit" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc3563918b5cc44ef5280bf9b51753e70dc78802de25e3fb81ed6c94617ccb6e" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -2977,8 +3605,9 @@ dependencies = [ [[package]] name = "p3-dft" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "510095701819d83c9509fe825bbf1ebfe50426ae75149df5fe1dcfd18261323a" dependencies = [ "p3-field", "p3-matrix", @@ -2989,8 +3618,9 @@ dependencies = [ [[package]] name = "p3-field" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1977a0a65789f719aa824119c332c4676b000bdbfe94d312fb6244a70d601" dependencies = [ "itertools 0.12.1", "num-bigint 0.4.6", @@ -3002,8 +3632,9 @@ dependencies = [ [[package]] name = "p3-fri" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22ddb958f200d9289cc73ff68847b0167ca0c14557b791dd9e318f98c2d1b28" dependencies = [ "itertools 0.12.1", "p3-challenger", @@ -3020,8 +3651,9 @@ dependencies = [ [[package]] name = "p3-interpolation" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d032cda212f6b408d7d5b0b9a8270a9455acb93742fe55a0880d82be8e90e500" dependencies = [ "p3-field", "p3-matrix", @@ -3030,8 +3662,9 @@ dependencies = [ [[package]] name = "p3-keccak" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c56abdd5a8a780049d2f8e92cea1df57b55a2ef50a40d1103f2732f7a00e4b1" dependencies = [ "p3-symmetric", "tiny-keccak", @@ -3039,8 +3672,9 @@ dependencies = [ [[package]] name = "p3-keccak-air" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8398f1694ccc38513df0b8cab5f9ef7325423f27cd9e4fa20bdc77d5079cf1b" dependencies = [ "p3-air", "p3-field", @@ -3048,12 +3682,15 @@ dependencies = [ "p3-maybe-rayon", "p3-util", "tracing", + "tracing-forest", + "tracing-subscriber 0.3.18", ] [[package]] name = "p3-matrix" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d548ee0b834f8e2ebc5037073acd101a3b0ca41a2d1d28a15ba0ccd9059495b0" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3066,16 +3703,18 @@ dependencies = [ [[package]] name = "p3-maybe-rayon" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55f5575d3d61bedb3e05681abb0f36b8bb339d65aa395d50756bfa64e9cd3f46" dependencies = [ "rayon", ] [[package]] name = "p3-mds" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6e57ed310d59245f93e24ee805ea7aa16fc9c505551b76a15f5e50f29d177e" dependencies = [ "itertools 0.12.1", "p3-dft", @@ -3088,8 +3727,9 @@ dependencies = [ [[package]] name = "p3-merkle-tree" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af46b41cba75d483ec8a553cbab1d2d794935ae3403d75394acfa4fb2c977cce" dependencies = [ "itertools 0.12.1", "p3-commit", @@ -3104,8 +3744,9 @@ dependencies = [ [[package]] name = "p3-poseidon2" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adaba6f14c197203530e233badce0ca1126ba3bf3c9ff766505b497bdad0bee1" dependencies = [ "gcd", "p3-field", @@ -3116,8 +3757,9 @@ dependencies = [ [[package]] name = "p3-symmetric" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ecc4282566eb14f48be7707f6745c4dff6be664984d59ec0fb1849cd82b5c2" dependencies = [ "itertools 0.12.1", "p3-field", @@ -3126,8 +3768,9 @@ dependencies = [ [[package]] name = "p3-uni-stark" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1af5c038b22b058bf1d49fb1ea3dd6c240a3e46c3278fde5c444e0034f7ffe37" dependencies = [ "itertools 0.12.1", "p3-air", @@ -3138,14 +3781,18 @@ dependencies = [ "p3-matrix", "p3-maybe-rayon", "p3-util", + "postcard", "serde", "tracing", + "tracing-forest", + "tracing-subscriber 0.3.18", ] [[package]] name = "p3-util" -version = "0.1.0" -source = "git+https://github.com/Plonky3/Plonky3.git?rev=88ea2b866e41329817e4761429b4a5a2a9751c07#88ea2b866e41329817e4761429b4a5a2a9751c07" +version = "0.1.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79f3fef0e00d9d7246385e758c4cd39b4efcbbcea31752471491ab502631385e" dependencies = [ "serde", ] @@ -3316,7 +3963,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -3349,9 +3996,21 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" + +[[package]] +name = "postcard" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "20ee10b999a00ca189ac2cb99f5db1ca71fb7371e3d5f493b879ca95d2a67220" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] [[package]] name = "powerfmt" @@ -3361,9 +4020,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "prettyplease" @@ -3372,7 +4034,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -3478,10 +4140,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", ] [[package]] @@ -3492,16 +4163,17 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quinn" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +checksum = "b22d8e7369034b9a7132bc2008cac12f2013c8132b45e0554e6e20e2617f2156" dependencies = [ "bytes", "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", + "socket2", "thiserror", "tokio", "tracing", @@ -3509,14 +4181,14 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.3" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +checksum = "ba92fb39ec7ad06ca2582c0ca834dfeadcaf06ddfc8e635c80aa7e1c05315fdd" dependencies = [ "bytes", "rand", "ring 0.17.8", - "rustc-hash", + "rustc-hash 2.0.0", "rustls", "slab", "thiserror", @@ -3526,9 +4198,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +checksum = "8bffec3605b73c6f1754535084a85229fa8a30f86014e6c81aeec4abb68b0285" dependencies = [ "libc", "once_cell", @@ -3622,18 +4294,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -3642,9 +4314,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -3710,30 +4382,30 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 0.1.2", - "system-configuration", + "system-configuration 0.5.1", "tokio", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.50.0", + "winreg", ] [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", - "http-body 1.0.0", + "http-body 1.0.1", "http-body-util", "hyper 1.4.1", "hyper-rustls", @@ -3755,7 +4427,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 1.0.1", - "system-configuration", + "system-configuration 0.6.0", "tokio", "tokio-native-tls", "tokio-rustls", @@ -3767,19 +4439,19 @@ dependencies = [ "wasm-streams", "web-sys", "webpki-roots", - "winreg 0.52.0", + "windows-registry", ] [[package]] name = "reqwest-middleware" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39346a33ddfe6be00cbc17a34ce996818b97b230b87229f10114693becca1268" +checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", "http 1.1.0", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "thiserror", "tower-service", @@ -3857,9 +4529,10 @@ dependencies = [ ] [[package]] -name = "rrs-lib" +name = "rrs-succinct" version = "0.1.0" -source = "git+https://github.com/GregAC/rrs.git#b23afc16b4e6a1fb5c4a73eb1e337e9400816507" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3372685893a9f67d18e98e792d690017287fd17379a83d798d958e517d380fa9" dependencies = [ "downcast-rs", "num_enum 0.5.11", @@ -3908,6 +4581,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -3947,10 +4626,11 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.11" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4828ea528154ae444e5a642dbb7d5623354030dc9822b83fd9bb79683c7399d0" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ + "log", "once_cell", "ring 0.17.8", "rustls-pki-types", @@ -3961,9 +4641,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -3971,15 +4651,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.5" +version = "0.102.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -4054,9 +4734,9 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.2" +version = "2.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af947d0ca10a2f3e00c7ec1b515b7c83e5cb3fa62d4c11a64301d9eec54440e9" +checksum = "aeb7ac86243095b70a7920639507b71d51a63390d1ba26c4f60a552fbb914a37" dependencies = [ "sdd", ] @@ -4090,9 +4770,9 @@ dependencies = [ [[package]] name = "sdd" -version = "0.2.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84345e4c9bd703274a082fb80caaa99b7612be48dfaa1dd9266577ec412309d" +checksum = "0495e4577c672de8254beb68d01a9b62d0e8a13c099edecdbedccce3223cd29f" [[package]] name = "sec1" @@ -4110,9 +4790,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", "core-foundation", @@ -4123,9 +4803,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -4172,31 +4852,32 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] name = "serde_json" -version = "1.0.120" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -4213,9 +4894,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -4234,32 +4915,54 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.3" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "serde", + "serde_with_macros 1.5.2", +] + +[[package]] +name = "serde_with" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e73139bc5ec2d45e6c5fd85be5a46949c1c39a4c18e56915f5eb4c12f975e377" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.4.0", "serde", "serde_derive", "serde_json", - "serde_with_macros", + "serde_with_macros 3.9.0", "time", ] [[package]] name = "serde_with_macros" -version = "3.8.3" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling 0.13.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "serde_with_macros" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b80d3d6b56b64335c0180e5ffde23b3c5e08c14c585b51a15bd0e95393f46703" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ - "darling", + "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -4284,14 +4987,13 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] name = "sha2" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?branch=patch-sha2-v0.10.8#1f224388fdede7cef649bce0d63876d1a9e3f515" dependencies = [ "cfg-if", "cpufeatures", @@ -4301,8 +5003,7 @@ dependencies = [ [[package]] name = "sha3" version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +source = "git+https://github.com/sp1-patches/RustCrypto-hashes?branch=patch-sha3-v0.10.8#8f6d303c0861ba7e5adcc36207c0f41fe5edaabc" dependencies = [ "digest 0.10.7", "keccak", @@ -4310,9 +5011,9 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" +checksum = "57d79b758b7cb2085612b11a235055e485605a5103faccdd633f35bd7aee69dd" dependencies = [ "cc", "cfg-if", @@ -4385,6 +5086,27 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "snafu" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b835cb902660db3415a672d862905e791e54d306c6e8189168c7f3d9ae1c79d" +dependencies = [ + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d1e02fca405f6280643174a50c942219f0bbf4dbf7d480f1dd864d6f211ae5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "snowbridge-amcl" version = "1.0.2" @@ -4405,10 +5127,21 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "sp1-build" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" +dependencies = [ + "anyhow", + "cargo_metadata", + "clap", + "dirs", +] + [[package]] name = "sp1-core" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "arrayref", @@ -4420,6 +5153,7 @@ dependencies = [ "elf", "elliptic-curve", "generic-array 1.1.0", + "hashbrown 0.14.5", "hex", "itertools 0.13.0", "k256", @@ -4447,28 +5181,29 @@ dependencies = [ "p3-util", "rand", "rayon-scan", - "rrs-lib", + "rrs-succinct", "serde", - "serde_with", + "serde_with 3.9.0", "size", "snowbridge-amcl", "sp1-derive", "sp1-primitives", + "static_assertions", "strum", "strum_macros", "tempfile", "thiserror", "tracing", "tracing-forest", - "tracing-subscriber", + "tracing-subscriber 0.3.18", "typenum", "web-time", ] [[package]] name = "sp1-derive" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -4476,26 +5211,30 @@ dependencies = [ ] [[package]] -name = "sp1-precompiles" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +name = "sp1-helper" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" +dependencies = [ + "cargo_metadata", + "chrono", + "sp1-build", +] + +[[package]] +name = "sp1-lib" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", "cfg-if", - "getrandom", - "hex", - "k256", - "num", - "rand", "serde", - "snowbridge-amcl", ] [[package]] name = "sp1-primitives" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "lazy_static", @@ -4507,34 +5246,27 @@ dependencies = [ [[package]] name = "sp1-prover" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", - "backtrace", "bincode", - "bytemuck", "clap", "dirs", - "futures", "hex", - "indicatif", "itertools 0.13.0", "num-bigint 0.4.6", + "oneshot", "p3-baby-bear", "p3-bn254-fr", "p3-challenger", "p3-commit", "p3-field", - "p3-util", - "rand", + "p3-matrix", "rayon", - "reqwest 0.12.5", "serde", "serde_json", "serial_test", - "sha2", - "size", "sp1-core", "sp1-primitives", "sp1-recursion-circuit", @@ -4545,15 +5277,14 @@ dependencies = [ "subtle-encoding", "tempfile", "thiserror", - "tokio", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] name = "sp1-recursion-circuit" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "itertools 0.13.0", @@ -4575,8 +5306,8 @@ dependencies = [ [[package]] name = "sp1-recursion-compiler" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "backtrace", "itertools 0.13.0", @@ -4592,6 +5323,7 @@ dependencies = [ "p3-util", "serde", "sp1-core", + "sp1-primitives", "sp1-recursion-core", "sp1-recursion-derive", "tracing", @@ -4599,14 +5331,15 @@ dependencies = [ [[package]] name = "sp1-recursion-core" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "arrayref", "backtrace", "ff 0.13.0", "hashbrown 0.14.5", "itertools 0.13.0", + "num_cpus", "p3-air", "p3-baby-bear", "p3-bn254-fr", @@ -4622,7 +5355,7 @@ dependencies = [ "p3-symmetric", "p3-util", "serde", - "serde_with", + "serde_with 3.9.0", "sp1-core", "sp1-derive", "sp1-primitives", @@ -4633,8 +5366,8 @@ dependencies = [ [[package]] name = "sp1-recursion-derive" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "proc-macro2", "quote", @@ -4643,8 +5376,8 @@ dependencies = [ [[package]] name = "sp1-recursion-gnark-ffi" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "anyhow", "bincode", @@ -4668,8 +5401,8 @@ dependencies = [ [[package]] name = "sp1-recursion-program" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "itertools 0.13.0", "p3-air", @@ -4688,15 +5421,17 @@ dependencies = [ "rand", "serde", "sp1-core", + "sp1-primitives", "sp1-recursion-compiler", "sp1-recursion-core", + "stacker", "tracing", ] [[package]] name = "sp1-sdk" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "alloy-sol-types", "anyhow", @@ -4707,15 +5442,18 @@ dependencies = [ "dirs", "ethers", "futures", + "hashbrown 0.14.5", "hex", "indicatif", "log", "num-bigint 0.4.6", + "p3-baby-bear", "p3-commit", "p3-field", + "p3-fri", "p3-matrix", "prost", - "reqwest 0.12.5", + "reqwest 0.12.7", "reqwest-middleware", "serde", "serde_json", @@ -4724,30 +5462,30 @@ dependencies = [ "sp1-prover", "strum", "strum_macros", + "sysinfo", "tempfile", "thiserror", "tokio", "tracing", - "twirp", + "twirp-rs", "vergen", ] [[package]] name = "sp1-zkvm" -version = "0.1.0" -source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.0.8-testnet#14eb569d41d24721ffbd407d6060e202482d659c" +version = "1.1.0" +source = "git+https://github.com/succinctlabs/sp1.git?tag=v1.1.0#923d77d7d0718dca5edfe72d3d17bb4c4e57cc13" dependencies = [ "bincode", "cfg-if", "getrandom", - "k256", "lazy_static", "libm", "once_cell", "rand", "serde", "sha2", - "sp1-precompiles", + "sp1-lib", ] [[package]] @@ -4772,12 +5510,31 @@ dependencies = [ "der", ] +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + [[package]] name = "static_assertions" 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" @@ -4803,7 +5560,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -4834,9 +5591,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.70" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -4852,7 +5609,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -4866,6 +5623,24 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "sysinfo" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" +dependencies = [ + "cfg-if", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "windows", +] [[package]] name = "system-configuration" @@ -4875,7 +5650,18 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys", + "system-configuration-sys 0.5.0", +] + +[[package]] +name = "system-configuration" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys 0.6.0", ] [[package]] @@ -4888,6 +5674,42 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tagged-base64" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b74bbf1db405a3fd2c6f8cd403bfa14727faa145925efe3012fa270b61551f1" +dependencies = [ + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "base64 0.22.1", + "crc-any", + "serde", + "snafu", + "tagged-base64-macros", + "wasm-bindgen", +] + +[[package]] +name = "tagged-base64-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcdea3c0150898fad2f7196a173ec3264f7fc455ba570939163c558f48ae85ac" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "tap" version = "1.0.1" @@ -4896,34 +5718,35 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -4995,32 +5818,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.38.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -5059,21 +5881,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.14" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.15", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -5084,7 +5906,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.4.0", "toml_datetime", "winnow 0.5.40", ] @@ -5095,22 +5917,22 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.4.0", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.15" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59a3a72298453f564e2b111fa896f8d07fabb36f51f06d7e875fc5e0b5a3ef1" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.4.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.13", + "winnow 0.6.18", ] [[package]] @@ -5131,15 +5953,15 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -5161,7 +5983,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -5184,7 +6006,7 @@ dependencies = [ "smallvec", "thiserror", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -5208,6 +6030,15 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.18" @@ -5233,9 +6064,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "twirp" +name = "twirp-rs" version = "0.3.0" -source = "git+https://github.com/github/twirp-rs.git?rev=c85f31f9c54957374e7dcb3534fc52cff0aa2dc5#c85f31f9c54957374e7dcb3534fc52cff0aa2dc5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa3161d8eee0abcad4e762f4215381a430cc1281870d575b0f1e4fbfc74b8ce" dependencies = [ "async-trait", "axum", @@ -5245,7 +6077,7 @@ dependencies = [ "http-body-util", "hyper 1.4.1", "prost", - "reqwest 0.12.5", + "reqwest 0.12.7", "serde", "serde_json", "thiserror", @@ -5313,9 +6145,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -5329,6 +6161,22 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +dependencies = [ + "base64 0.22.1", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.5.2" @@ -5383,9 +6231,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -5423,34 +6271,37 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", + "serde", + "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -5460,9 +6311,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5470,22 +6321,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-streams" @@ -5502,9 +6353,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -5559,11 +6410,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5572,6 +6423,16 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -5581,6 +6442,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5599,6 +6490,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -5731,9 +6631,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.13" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -5748,16 +6648,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "ws_stream_wasm" version = "0.7.4" @@ -5792,6 +6682,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -5803,7 +6694,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] @@ -5823,13 +6714,14 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.70", + "syn 2.0.75", ] [[package]] name = "zkhash" version = "0.2.0" -source = "git+https://github.com/HorizenLabs/poseidon2#bb476b9ca38198cf5092487283c8b8c5d4317c4e" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4352d1081da6922701401cdd4cbf29a2723feb4cfabb5771f6fee8e9276da1c7" dependencies = [ "ark-ff 0.4.2", "ark-std 0.4.0", diff --git a/Cargo.toml b/Cargo.toml index b44f14c..095cd81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,30 @@ [workspace] resolver = "2" -members = ["sp1/program", "sp1/script"] +members = ["sp1/program", "sp1/script", "sp1/utils"] + +[workspace.dependencies] +ark-bn254 = "0.4" +ark-serialize = "0.4" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +committable = "0.2" +either = { version = "1.13", features = ["serde"] } +jf-merkle-tree = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +jf-vid = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +jf-pcs = { version = "0.1", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +sha2 = "0.10" +primitive-types = { version = "0.12", features = ["serde"] } + +[patch.crates-io] +sha2 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha2", branch = "patch-sha2-v0.10.8" } +sha3 = { git = "https://github.com/sp1-patches/RustCrypto-hashes", package = "sha3", branch = "patch-sha3-v0.10.8" } + +[patch."https://github.com/EspressoSystems/jellyfish"] +jf-pcs = { git = "https://www.github.com/EspressoSystems/jellyfish.git", branch = "sp1-patches" } +jf-vid = { git = "https://www.github.com/EspressoSystems/jellyfish.git", branch = "sp1-patches" } diff --git a/README.md b/README.md index ccff997..fed498c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,83 @@ # zkrollup-integration -Tools for zkRollups to integrate with Espresso + +Tools for zkRollups to integrate with Espresso. + +When a zk-rollup integrates with a shared finality gadget, it will receive streams of finalized blocks containing transactions from all participating rollups. +As part of (batched) state update on L1, provers for a zk-rollup periodically submit a validity proof attesting to the correctness of a new rollup state. +A rollup state corresponds to a specific finalized block. +Solely proving valid state transition on the rollup VM against a list of transactions from the block (a.k.a "VM proof") is insufficient. +With a decentralized finality gadget, the validity proof needs to encapsulate a _proof of consensus_ on the new finalized block commitment (a.k.a "(consensus) light client proof"). +With a shared finality gadget, the proof needs to further encapsulate correct "_filtering_ of rollup-specific transactions" from the overall block (a.k.a. "derivation proof"). +This repo **provides circuits for the derivation proof and the consistency among the three (sub-)proofs**.[^1] + +[^1]: Circuits for VM proof are usually offered by zk-rollup project themselves (e.g. Polygon's [CDK](https://docs.polygon.technology/cdk/overview/), Scroll's [zkEVM](https://github.com/scroll-tech/zkevm-circuits)); circuit (written using [`jellyfish`'s constraint system](https://github.com/EspressoSystems/jellyfish/blob/main/relation/src/constraint_system.rs)) for Espresso's light client proof can be found [here](https://github.com/EspressoSystems/espresso-sequencer/blob/main/hotshot-state-prover/src/circuit.rs). + +> [!NOTE] +> Espresso uses a [non-executing consensus](https://eprint.iacr.org/2024/1189), thus the _consensus state_ doesn't embed post-execution rollup states: the consensus nodes only agree on the committed block payload (thus the total ordering among txs) and its availability. +> The validity of updated _rollup/VM states_, after executing those newly committed txs, is left to the rollup prover (aka batcher). + +Terminology wise: +- a _block_ is abstractly referring to a list of new txs/state transitions; concretely manifests as: + - `BlockPayload`: the actual payload that contains the raw tx data + - instead of full block replication at each node, we use Verifiable Information Dispersal (VID) schemes where each replica stores a chunk. + - our concrete instantiation of VID relies on KZG polynomial commitment, thus requires _structured reference string_ (SRS) from a trusted setup + - all replicas unequivocally refer to the payload by a `PayloadCommitment`, a cryptographic commitment to the entire payload sent to every replica alongside their designated chunk + - `BlockHeader`: the summarized new consensus state and chain metadata (for consensus nodes) + - `BlockCommitment`: a short cryptographic commitment to the `BlockHeader` + - `BlockMerkleCommitment`: the root of `BlockMerkleTree` that accumulates all block commitments up to the current `BlockHeight`, enabling efficient historical block header lookup via `BlockMerkleTreeProof` + - `PayloadCommitment` is a part of `BlockHeader` + - `NsTable` described below is a part of `BlockHeader` +- each rollup occupies a _namespace_ (distinguished by a unique namespace ID) in a block + - `NsTable` is the compact encoding of a _namespace table_ mapping namespace id to their range in `BlockPayload` + - `NsProof` is a _namespace proof_, attesting that some subset of bytes is the complete range of data designated to a particular namespace in a `BlockPayload` identified by its `PayloadCommitment` given a `NsTable` +- a _light client_ is an agent that can verify the latest finalized _consensus state_ without running a full node + - an off-chain light client usually receive the block header and the quorum certificate (QC) + - an on-chain light client stores a pruned `LightClientState`, a strict subset of fields in `BlockHeader`, verified through _light client proof_ (the simplest form is using the QC from consensus, but we use a more EVM and SNARK-friendly light client protocol). + +## Circuit Spec + +Generally speaking, we are proving that a list of rollup's transactions are correctly derived from finalized Espresso blocks. + +**Public Inputs** +- `rollup_txs_commit: [u8; 32]`: commitment to the transactions designated to the rollup `ns_id`, also one of the public inputs from the VM execution proof + - the concrete commitment scheme depends on the VM prover design, we use `Sha256(rollup_txs)` in the demo +- `ns_id: u32`: namespace ID of this rollup +- `bmt_commitment: BlockMerkleCommitment`: root of the newest Espresso block commitment tree, accumulated all historical Espresso block commitments +- `vid_pp_hash: [u8; 32]`: Sha256 of `VidPublicParam` for the VID scheme + +**Private Inputs** + +- `rollup_txs: Vec`: the byte representation of all transactions specific to rollup with `ns_id` filtered from a batch of Espresso blocks +- `vid_param: VidParam`: public parameter for Espresso's VID scheme +- `block_derivation_proofs: Vec<(Range, BlockDerivationProof)>`: a list of `(range, proof)` pairs, one for each block, where `proof` proves that `rollup_txs[range]` is the complete subset of namespace-specific transactions filtered from the Espresso block. +Each `BlockDerivationProof` contains the following: + - `block_header: BlockHeader`: block header of the original Espresso block containing the block height, the namespace table `ns_table`, and a commitment `payload_commitment` to the entire Espresso block payload (which contains transactions from all rollups) + - `bmt_proof: BlockMerkleTreeProof`: a proof that the given block is in the block Merkle tree committed by `bmt_commitment` + - `vid_common: VidCommon`: auxiliary information for the namespace proof `ns_proof` verification during which its consistency against `payload_commitment` is checked + - `ns_proof: NsProof`: a namespace proof that proves some subslice of bytes (i.e. `rollup_txs[range]`) is the complete subset for the namespace `ns_id` from the overall Espresso block payload committed in `block_header` + +**Relations** +1. Recompute the payload commitment using the "VM execution prover" way: `rollup_txs_commit == Sha256(rollup_txs)` + - note: by marking this as a public input, the verifier can cross-check it with the public inputs from the "vm proof", thus ensuring the same batch of transactions is used in `rollup_txs` here and in the generation of the "vm proof" +2. Correct derivations for the namespace/rollup from committed Espresso blocks + - First the ranges in `block_derivation_proofs` should be non-overlapping and cover the whole payload, i.e. `range[i].end == range[i+1].start && range[i].start == 0 && range[-1].end == rollup_txs.len()`. + - For each `BlockDerivationProof`, we check + - the `block_header` is in the block Merkle tree, by checking the proof `bmt_proof` against the block Merkle tree commitment `bmt_commitment` + - Namespace ID `ns_id` of this rollup is contained in the namespace table `block_header.ns_table`, and given the specified range in the Espresso block and a namespace proof `NsProof`, checks whether the slice of rollup's transactions `rollup_txs` matches the specified slice in the Espresso block payload committed by `block_header.payload_commitment` + +Read [our doc](https://github.com/EspressoSystems/espresso-sequencer/blob/main/doc/zk-integration.md) for a more detailed description; +read our blog on [Derivation Pipeline](https://hackmd.io/@EspressoSystems/the-derivation-pipeline) for rollup integration. ## Getting Started To enter the development shell: `nix develop` + +### Requirements + +- [Rust](https://rustup.rs/) +- [SP1](https://succinctlabs.github.io/sp1/getting-started/install.html) + ### SP1 stack To build the ELF executable for your program and generate the proof, you will have to run outside the nix dev-shell. diff --git a/flake.nix b/flake.nix index e975541..cde4c2a 100644 --- a/flake.nix +++ b/flake.nix @@ -119,6 +119,7 @@ # Rust nightlyRustToolchain + cargo-sort ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; shellHook = '' diff --git a/justfile b/justfile index a0009d4..81498db 100644 --- a/justfile +++ b/justfile @@ -7,7 +7,7 @@ default: echo "Rebuilding SP1 program ..." mkdir -p sp1/program/elf cd sp1/program && cargo-prove prove build - mv elf/riscv32im-succinct-zkvm-elf sp1/program/elf/fib-riscv32im-succinct-zkvm-elf && rm -rf elf/ + mv elf/riscv32im-succinct-zkvm-elf sp1/program/elf/riscv32im-succinct-zkvm-elf && rm -rf elf/ echo "... done" # Generate and verify SP1 proof @@ -25,4 +25,4 @@ default: # Test SP1 contracts @sp1-test-contracts: echo "Testing SP1 contracts" - cd sp1/contracts && forge test -v + cd sp1/contracts && forge test -vv diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..92e1b49 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,5 @@ +reorder_imports = true +wrap_comments = true +normalize_comments = true +use_try_shorthand = true +match_block_trailing_comma = true diff --git a/sp1/contracts/lib/sp1-contracts b/sp1/contracts/lib/sp1-contracts index 73c2a8d..ef134b7 160000 --- a/sp1/contracts/lib/sp1-contracts +++ b/sp1/contracts/lib/sp1-contracts @@ -1 +1 @@ -Subproject commit 73c2a8df0c816bf743e9d960e7b14b8e37635578 +Subproject commit ef134b7c141e03bb8a8854697422f770cc26dc74 diff --git a/sp1/contracts/src/Fibonacci.sol b/sp1/contracts/src/EspressoDerivation.sol similarity index 55% rename from sp1/contracts/src/Fibonacci.sol rename to sp1/contracts/src/EspressoDerivation.sol index b477a3f..22f2e82 100644 --- a/sp1/contracts/src/Fibonacci.sol +++ b/sp1/contracts/src/EspressoDerivation.sol @@ -4,10 +4,10 @@ pragma solidity ^0.8.20; import {ISP1Verifier} from "@sp1-contracts/ISP1Verifier.sol"; /// @title Fibonacci. -/// @author Succinct Labs +/// @author Espresso System /// @notice This contract implements a simple example of verifying the proof of a computing a /// fibonacci number. -contract Fibonacci { +contract EspressoDerivation { /// @notice The address of the SP1 verifier contract. /// @dev This can either be a specific SP1Verifier for a specific version, or the /// SP1VerifierGateway which can be used to verify proofs for any version of SP1. @@ -15,24 +15,21 @@ contract Fibonacci { /// https://github.com/succinctlabs/sp1-contracts/tree/main/contracts/deployments address public verifier; - /// @notice The verification key for the fibonacci program. - bytes32 public fibonacciProgramVkey; + /// @notice The verification key for the program. + bytes32 public vkey; - constructor(address _verifier, bytes32 _fibonacciProgramVkey) { + constructor(address _verifier, bytes32 _vkey) { verifier = _verifier; - fibonacciProgramVkey = _fibonacciProgramVkey; + vkey = _vkey; } - /// @notice The entrypoint for verifying the proof of a fibonacci number. + /// @notice Verify a derivation proof from a batch of Espresso blocks. /// @param proof The encoded proof. /// @param publicValues The encoded public values. - function verifyFibonacciProof(bytes calldata proof, bytes calldata publicValues) + function verifyDerivationProof(bytes calldata proof, bytes calldata publicValues) public view - returns (uint32, uint32, uint32) { - ISP1Verifier(verifier).verifyProof(fibonacciProgramVkey, publicValues, proof); - (uint32 n, uint32 a, uint32 b) = abi.decode(publicValues, (uint32, uint32, uint32)); - return (n, a, b); + ISP1Verifier(verifier).verifyProof(vkey, publicValues, proof); } } diff --git a/sp1/contracts/src/fixtures/fixture.json b/sp1/contracts/src/fixtures/fixture.json index 18ca329..c7e236e 100644 --- a/sp1/contracts/src/fixtures/fixture.json +++ b/sp1/contracts/src/fixtures/fixture.json @@ -1,8 +1,5 @@ { - "a": 6765, - "b": 10946, - "n": 20, - "vkey": "0x00307ac6ea935608a65cea9a739f1c678dc028267391566806be12953d865be8", - "publicValues": "0x00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000001a6d0000000000000000000000000000000000000000000000000000000000002ac2", - "proof": "0x801c66ac24a8c9c720fb536ab6d292c3f4bdd9ecfb8bbd58a094081a578dd19ec444d9170ce9d31a25163009ff046d03f74dc0212f0cc713454574a72e41ed4e7604087a180ce46f081dc855f9b952ddc3e42002da927b46b7c826e7dd9373695fc0aa152a3dc2bf70aa716243930edf99a1958345e94cc88fb3dd4acd9af75175fd1f1504805ba12b526663567b12475f1b940323c87e2246195de23a5e0be5d2abe3b41e99dbddefc673abc7038e71c19e1e7ec170d1b48a12e63c2657fbc5b96defab06a2347a8a095b44692536217bdc71787da3464ab717cfa6b5b74849469795510728acc0be593ce813059e33337bfd33d11ac03676c1a8cd508518d1ee3859af19ba893298a9b35ee3cd3346e2c6f8aa71fa58c225128693eee97ed1374535e30c8d107388bb500af98fe04a2ec60f0efe1026f90745e2cd157e95468cd5c8db16b99e8616eb444a6f89c7c31728c039c75f340e3b6a3ca621b0172fc400990f195a6b6dce88cae4604b354eb4eea15ea0e9f8a0837813f621d0b1289d90a0d812eaedc02934cc41c86f242123d8a753d308d8134f3f33b8168140b2ba612b9129d54b9566230974f9778e8cb3dcd0d187e32fcea5969855642190bd3416d65212d2ea3d785b8ddf7f477259a3d11e5326c3a14a1ffc1e121f38975a01fbba640a28cbf9d7f5b22be18cbbaf3442d9284eee0f632d0fce47475e7be13103f8ba1f8f4ebc25b73650969c53b13a35cc6943a331c689841a40325d23b6045f240803d1738e11c5c46999bb6e060ac823a865ddc4f7e83dfecffb6f0a822180a6db2eeb6e91e1d80d78a9350df39d142c462cce1ac9e36cd8ab682f167b13e690d522642cc4bde919a52f333a00700fccf2fa6212fd3cf49b430368e7fc6b80ab8c1e5b265ccdf8bb49174102224f419c437da1b1bbe892dad2039a3f98e7a328a702ab130b30b7d818efe388a6134fe3c085d213a5534d604b9b3335b8db4180991abb9efda23fa9be95c8c46dd270200ad00f114d830ae8a019b76a02aa2a69f50fa73605947b3e7640d90d481dbff96bf124c92691fdfa52358671a5a3ea355d0128af0521a8b783fff80caf13fd8dc30757bc5ef93fc5f7b0411f44ca5f15510c6cae1f1eeca8477aef5a6d5d4197dcd220536498706c553e86da5b91afd3900bea3e07838a9592c798e1c38674ab04e0d51badf80bb95331702db27dfb2347" -} + "vkey": "0x00878da947d29df42252238b58a0e5f3dc5c1ba90c3b7616013772bcb85f514c", + "publicValues": "0x420000000000000030783131323438633764376631386137373236663063373537343662643434396530373831363663373066396433383838663665623034353132653630303362326342000000000000003078366531393061626164656331333862366535393939383935333839363333393839333864623435316134633031336232623135323663623034343533326462339bf49a6a4c000000000000000b000000000000004d45524b4c455f434f4d4d3000000000000000b0f1b60f2db6ccd4c6d4d849c0afd14a0f7bbc32a714e292964b673e818cc1a120000000000000000500000000000000a9", + "proof": "0xc430ff7f219349a8600513c3755bbd0c886782164b318efa39e3529e85483bff3917bb2e101bc0b36d479ca6e981db09604f068a0a83ff893d3935d9bf9d12aab25d8663123754cdafa3f98a1b5efd2e18571e8fb5753a070806624798a6cdf46a27854e094355079660660cb639020880645aa8b41ea1eea4244406cc383ffe862df8780173f12d2a568a652ca76e0aa38e440d81b2c58dbdb682a321aa7621b7b44fd8085dee1e045083280914b75684032ad21a3af762d4910f81a5c233d3af2b715b0d23a75746a231e3b57abeea2e7cd782a46a62a6ee1cb467640353a7c4723d5a27f6921fc70896c961c7633b8be57add2347ac13933f4842127f7910a4af15ef18035847bb3b7e382813725c7d62c70d425d179210ce654ed544330c4db2af0b0d44ecf0b9f81917da1ff791072fce1aba9c9ea559b435e4fa45b21a51665a80040fd1d1ad3efa0a21dad1ccc1a0bf7f5fed07094a04c80bade33cfe762e094f2ecd0d40107d44cdbc471f9491c4ec5da06e26a9349f421ae26f787cf515096022ca5d04207eddf7b30cb382e468fc94beffabb6c65ac3b7881fae3c91f5109822a430f9ca7f27185a908eb120c3785953979d1291a5fc6fc7f6ca2d4c5883832805092c0c9ad55c55cd2c98a0779ba3ac02ecf5c5f006d218d6bb84705af928240c8913a507604ccb91e0b3d54313b398eade0ff8286160a79c3c40570cba2202d690b34d2f4dd5fcc4bc1a75c73bc0e2d64de06b5a3ffa12389710bbb72b662fd0d98b4492bc742ce0fa71bb32f44b0100ff967bada30744e09476cf8e89002429a51df17ed41a03b8f2db372b25e21d935c3b4fc885dd79c3b9a9fd9770fb2df69f6685f85814eaa556249f83e98f01c04d450e1c4ad0c47d95be33acd5ba1d57a4cabe29262c308678089bcf184326b98ffa0e30e590c118374571f222b62011de8579fdde9a9a51e4f1e74a4fb2dfa6673be195ec44b1dbd409639730f7172a487e987d128011ffdf13eefbea13796b9b5c5f476f2b0e34ac4ca39c359b09689b4b45ff42f441c30984fbb026c3a0b5cf5aeeb675e461f747f64ae3ecc707ceb03c6b5f79da885d35c14aa65afa735dfd68dd8289d0ba63a71690e0efe323ea08b4b6aa5b20ca812eb5d2805b327bfbbcc74da6b5ef3d31ba106ceea46c1f9375edf8844b0b78bfc72a74f66b4c25a044d9585c2c02e62bab5893e9b21e" +} \ No newline at end of file diff --git a/sp1/contracts/test/Fibonacci.t.sol b/sp1/contracts/test/EspressoDerivation.t.sol similarity index 60% rename from sp1/contracts/test/Fibonacci.t.sol rename to sp1/contracts/test/EspressoDerivation.t.sol index 4038603..1c2150c 100644 --- a/sp1/contracts/test/Fibonacci.t.sol +++ b/sp1/contracts/test/EspressoDerivation.t.sol @@ -3,23 +3,20 @@ pragma solidity ^0.8.20; import {Test, console} from "forge-std/Test.sol"; import {stdJson} from "forge-std/StdJson.sol"; -import {Fibonacci} from "../src/Fibonacci.sol"; -import {SP1Verifier} from "@sp1-contracts/v1.0.8-testnet/SP1Verifier.sol"; +import {EspressoDerivation} from "../src/EspressoDerivation.sol"; +import {SP1Verifier} from "@sp1-contracts/v1.1.0/SP1Verifier.sol"; struct SP1ProofFixtureJson { - uint32 a; - uint32 b; - uint32 n; bytes proof; bytes publicValues; bytes32 vkey; } -contract FibonacciTest is Test { +contract EspressoDerivationTest is Test { using stdJson for string; address verifier; - Fibonacci public fibonacci; + EspressoDerivation public es; function loadFixture() public view returns (SP1ProofFixtureJson memory) { string memory root = vm.projectRoot(); @@ -33,24 +30,21 @@ contract FibonacciTest is Test { SP1ProofFixtureJson memory fixture = loadFixture(); verifier = address(new SP1Verifier()); - fibonacci = new Fibonacci(verifier, fixture.vkey); + es = new EspressoDerivation(verifier, fixture.vkey); } - function test_ValidFibonacciProof() public view { + function test_ValidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); - (uint32 n, uint32 a, uint32 b) = fibonacci.verifyFibonacciProof(fixture.proof, fixture.publicValues); - assert(n == fixture.n); - assert(a == fixture.a); - assert(b == fixture.b); + es.verifyDerivationProof(fixture.proof, fixture.publicValues); } - function testFail_InvalidFibonacciProof() public view { + function testFail_InvalidDerivationProof() public view { SP1ProofFixtureJson memory fixture = loadFixture(); // Create a fake proof. bytes memory fakeProof = new bytes(fixture.proof.length); - fibonacci.verifyFibonacciProof(fakeProof, fixture.publicValues); + es.verifyDerivationProof(fakeProof, fixture.publicValues); } } diff --git a/sp1/program/Cargo.toml b/sp1/program/Cargo.toml index 9566dd7..3dacb0a 100644 --- a/sp1/program/Cargo.toml +++ b/sp1/program/Cargo.toml @@ -1,8 +1,11 @@ [package] version = "0.1.0" -name = "fibonacci-program" +name = "espresso-derivation" edition = "2021" [dependencies] -alloy-sol-types = "0.7.2" -sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +committable = { workspace = true } +espresso-derivation-utils = { path = "../utils" } +jf-merkle-tree = { workspace = true } +jf-vid = { workspace = true } +sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } diff --git a/sp1/program/src/main.rs b/sp1/program/src/main.rs index 62c64d3..f470a5e 100644 --- a/sp1/program/src/main.rs +++ b/sp1/program/src/main.rs @@ -1,45 +1,128 @@ -//! A simple program that takes a number `n` as input, and writes the `n-1`th and `n`th fibonacci -//! number as an output. +//! This program proves that the executed transactions are correctly derived +//! from espresso blocks. -// These two lines are necessary for the program to properly compile. -// -// Under the hood, we wrap your main function with some extra code so that it behaves properly -// inside the zkVM. #![no_main] sp1_zkvm::entrypoint!(main); -use alloy_sol_types::{sol, SolType}; - -/// The public values encoded as a tuple that can be easily deserialized inside Solidity. -type PublicValuesTuple = sol! { - tuple(uint32, uint32, uint32) +use committable::Committable; +use espresso_derivation_utils::{ + block::{ + header::{BlockMerkleCommitment, BlockMerkleTree}, + payload::{compute_vid_param_hash, rollup_commit, vid_scheme, Payload, Vid, VidParam}, + }, + BlockDerivationProof, PublicInputs, +}; +use jf_merkle_tree::{MerkleCommitment, MerkleTreeScheme}; +use jf_vid::{ + payload_prover::{PayloadProver, Statement}, + VidScheme, }; +use std::ops::Range; pub fn main() { - // Read an input to the program. - // - // Behind the scenes, this compiles down to a custom system call which handles reading inputs - // from the prover. - let n = sp1_zkvm::io::read::(); - - if n > 186 { - panic!( - "This fibonacci program doesn't support n > 186, as it would overflow a 32-bit integer." - ); - } + // (private): `rollup_txs` is the list of all transactions in bytes form. + let rollup_txs = sp1_zkvm::io::read::(); + // (private): (its hash is public) VID public parameter for checking the + // namespace proofs + let vid_param = sp1_zkvm::io::read::(); + // (public): namespace ID of this rollup + let ns_id = sp1_zkvm::io::read::(); + // (public): `bmt_commitment`: the Espresso block Merkle tree commitment that + // accumulates all block commitments up to the current `BlockHeight`. + let bmt_commitment = sp1_zkvm::io::read::(); + // (private): a pair of `(range, proof)` where the + // `proof` asserts that a `range` of `payload` is derived from some block + // committed in the block Merkle tree above. + let block_derivation_proofs = sp1_zkvm::io::read::, BlockDerivationProof)>>(); + std::println!("All inputs are loaded"); + + // Compute the commitment of all the transactions + let rollup_txs_commit = rollup_commit(&rollup_txs); + + // Verify the Espresso derivation proof + // 1. Check that the ranges cover the whole payload with no overlapping + // 2. Check each block derivation proof + let mut end = 0; + block_derivation_proofs + .iter() + .for_each(|(range, block_proof)| { + assert_eq!(range.start, end); + verify_block_derivation_proof( + &rollup_txs.0[range.start..range.end], + &vid_param, + ns_id, + &bmt_commitment, + block_proof, + ); + end = range.end; + }); + assert_eq!(end, rollup_txs.0.len()); - // Compute the n'th fibonacci number, using normal Rust code. - let mut a = 0u32; - let mut b = 1u32; - for _ in 0..n { - let c = a + b; - a = b; - b = c; + // Wrap all the public inputs + let public_inputs = PublicInputs { + rollup_txs_commit, + vid_param_hash: compute_vid_param_hash(&vid_param), + ns_id, + bmt_commitment, + }; + + // Mark them as public inputs + sp1_zkvm::io::commit(&public_inputs); +} + +/// Verifies the block derivation proof against the public inputs +fn verify_block_derivation_proof( + payload_slice: &[u8], + vid_param: &VidParam, + ns_id: u32, + bmt_commitment: &BlockMerkleCommitment, + proof: &BlockDerivationProof, +) { + // Assert that the membership proof is valid + if bmt_commitment.height() + 1 != proof.bmt_proof.proof.len() + || !BlockMerkleTree::verify( + bmt_commitment.digest(), + proof.bmt_proof.pos, + &proof.bmt_proof, + ) + .is_ok_and(|result| result.is_ok()) + { + panic!("Incorrect membership proof for block Merkle tree."); + } + // Assert that the header is the one committed in the block Merkle tree + if !proof + .bmt_proof + .elem() + .is_some_and(|elem| elem == &proof.block_header.commit()) + { + panic!("Membership proof is not consistent with the given block header."); } - // Encode the public values of the program. - let bytes = PublicValuesTuple::abi_encode(&(n, a, b)); + match proof.block_header.ns_table.scan_for_id(ns_id) { + None => { + panic!("Namespace ID not found in the block."); + }, + Some((ns_range_start, ns_range_end)) => { + std::println!("Byte range: ({}, {})", ns_range_start, ns_range_end); - // Commit to the public values of the program. - sp1_zkvm::io::commit_slice(&bytes); + // Namespace proof w.r.t the VidCommitment + let num_storage_nodes = + ::get_num_storage_nodes(proof.vid_common.as_ref()); + let vid = vid_scheme(num_storage_nodes, vid_param); + if !vid + .payload_verify( + Statement { + payload_subslice: payload_slice, + range: (ns_range_start as usize..ns_range_end as usize), + commit: proof.block_header.payload_commitment.as_ref(), + common: proof.vid_common.as_ref(), + }, + proof.ns_proof.as_ref(), + ) + .is_ok_and(|result| result.is_ok()) + { + panic!("Failed namespace proof."); + } + }, + } } diff --git a/sp1/script/Cargo.toml b/sp1/script/Cargo.toml index 6044339..a8d3d7b 100644 --- a/sp1/script/Cargo.toml +++ b/sp1/script/Cargo.toml @@ -1,6 +1,6 @@ [package] version = "0.1.0" -name = "fibonacci-script" +name = "espresso-derivation-prover" edition = "2021" [[bin]] @@ -9,8 +9,20 @@ path = "src/bin/prove.rs" [dependencies] alloy-sol-types = "0.7.2" +ark-srs = "0.3.1" +bincode = "1.3" clap = { version = "4.0", features = ["derive", "env"] } -serde = { version = "1.0", default-features = false, features = ["derive"] } +committable = { workspace = true } +espresso-derivation-utils = { path = "../utils" } +hex = "0.4.3" +jf-merkle-tree = { workspace = true } +jf-pcs = { workspace = true } +jf-vid = { workspace = true } +rand = "0.8" +serde = { workspace = true } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.0.8-testnet" } +sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } tracing = "0.1.40" + +[build-dependencies] +sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", tag = "v1.1.0" } diff --git a/sp1/script/src/bin/prove.rs b/sp1/script/src/bin/prove.rs index 0c90b50..b608c8d 100644 --- a/sp1/script/src/bin/prove.rs +++ b/sp1/script/src/bin/prove.rs @@ -1,39 +1,191 @@ -//! An end-to-end example of using the SP1 SDK to generate a proof of a program that can be verified -//! on-chain. +//! Using the SP1 SDK to generate a proof of correct derivation from an espresso +//! block. //! //! You can run this script using the following command: //! ```shell -//! RUST_LOG=info cargo run --package fibonacci-script --bin prove --release +//! RUST_LOG=info cargo run --package espresso-derivation-prover --bin prove --release //! ``` -use std::path::PathBuf; - -use alloy_sol_types::{sol, SolType}; use clap::Parser; +use committable::Committable; +use espresso_derivation_utils::{ + block::{ + header::{BlockHeader, BlockMerkleTree}, + payload::{vid_scheme, NsProof, Payload, Vid, VidCommitment, VidCommon, VidParam}, + }, + ns_table::NsTable, + BlockDerivationProof, PublicInputs, +}; +use jf_merkle_tree::{AppendableMerkleTreeScheme, MerkleTreeScheme}; +use jf_pcs::prelude::UnivariateUniversalParams; +use jf_vid::{payload_prover::PayloadProver, VidScheme}; +use rand::{Rng, RngCore, SeedableRng}; use serde::{Deserialize, Serialize}; -use sp1_sdk::{HashableKey, ProverClient, SP1PlonkBn254Proof, SP1Stdin, SP1VerifyingKey}; +use sp1_sdk::{HashableKey, ProverClient, SP1ProofWithPublicValues, SP1Stdin, SP1VerifyingKey}; +use std::path::PathBuf; /// The ELF (executable and linkable format) file for the Succinct RISC-V zkVM. /// -/// This file is generated by running `cargo prove build` inside the `program` directory. -pub const FIBONACCI_ELF: &[u8] = - include_bytes!("../../../program/elf/fib-riscv32im-succinct-zkvm-elf"); +/// This file is generated by running `cargo prove build` inside the `program` +/// directory. +pub const ELF: &[u8] = include_bytes!("../../../program/elf/riscv32im-succinct-zkvm-elf"); +/// low degree for demo only +pub const SRS_DEGREE: usize = 8usize; +/// payload bytes for each block shouldn't exceed max size +/// during encoding, every 30 bytes is converted to a 254-bit field element +pub const MAX_PAYLOAD_BYTES_PER_BLOCK: usize = SRS_DEGREE * 30; +/// number of storage node for VID +pub const NUM_STORAGE_NODES: u32 = 10; +/// produce derivation proof for a batch of espresso blocks +pub const NUM_BLOCKS: u64 = 5; /// The arguments for the prove command. +// TODO: fill in other details #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] struct ProveArgs { - #[clap(long, default_value = "20")] - n: u32, + #[clap(short, long, default_value = "false")] + bench: bool, #[clap(long, default_value = "false")] evm: bool, } -/// The public values encoded as a tuple that can be easily deserialized inside Solidity. -type PublicValuesTuple = sol! { - tuple(uint32, uint32, uint32) -}; +fn mock_block( + idx: u64, + ns_id: u32, + ns_payload: &[u8], + vid: &mut Vid, + rng: &mut R, +) -> (BlockHeader, VidCommon, NsProof) { + // This is a tweak from an actual block header in Espresso's staging testnet + let mut header: BlockHeader = serde_json::from_str( + r#"{ + "chain_config": { + "chain_config": { + "Left": { + "chain_id": "888888888", + "max_block_size": "30000000", + "base_fee": "0", + "fee_contract": null, + "fee_recipient": "0x0000000000000000000000000000000000000000" + } + } + }, + "height": 69781, + "timestamp": 1720789795, + "l1_head": 5113, + "l1_finalized": { + "number": 5088, + "timestamp": "0x669129ec", + "hash": "0xfc4249b13292d2617cc0dec8b0a9a666491d5fecdfe536c929207847364b2b60" + }, + "payload_commitment": "HASH~KpvHX4MuDuZKk10QJctEoUj-fump6NIAO8fJ048RwNJo", + "builder_commitment": "BUILDER_COMMITMENT~tEvs0rxqOiMCvfe2R0omNNaphSlUiEDrb2q0IZpRcgA_", + "ns_table": { + "bytes": "AQAAAB0AAAALAAAA" + }, + "block_merkle_tree_root": "MERKLE_COMM~02gWBSt2tcz9XfOOO6xEVicluWIIP95BW8I11f2graggAAAAAAAAAJUQAQAAAAAAUQ", + "fee_merkle_tree_root": "MERKLE_COMM~yB4_Aqa35_PoskgTpcCR1oVLh6BUdLHIs7erHKWi-usUAAAAAAAAAAEAAAAAAAAAJg", + "fee_info": { + "account": "0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f", + "amount": "0" + }, + "builder_signature": { + "r": "0x6291b473fdac85b9ce7b40b530ea4173ac6e71fd29acffc3cbc97ae637d4404d", + "s": "0x3178fe07d5071df7a7ce4106e6e1e3727aa6edc458db03d1774948bdec32eac6", + "v": 28 + } + }"#, + ).unwrap(); + + // Mock a height + header.height += idx; + + // Mock payload + let payload_size = rng.gen_range(2 * ns_payload.len()..8 * ns_payload.len()); + let mut payload = vec![0u8; payload_size]; + rng.fill_bytes(&mut payload); + let offset = rng.gen_range(1..payload_size - ns_payload.len() - 1); + payload[offset..offset + ns_payload.len()].copy_from_slice(ns_payload); + + // Mock VID information + let vid_disperse = vid.disperse(&payload).unwrap(); + let vid_common = VidCommon(vid_disperse.common); + let vid_commitment = VidCommitment(vid_disperse.commit); + // Update the payload commitment + header.payload_commitment = vid_commitment; + // Update the namespace table + header.ns_table = NsTable::mock_ns_table(&[ + (rng.next_u32(), offset as u32), + (ns_id, offset as u32 + ns_payload.len() as u32), + (rng.next_u32(), payload_size as u32), + ]); + + // Namespace proof + let ns_range = offset..offset + ns_payload.len(); + let ns_proof = NsProof(vid.payload_proof(&payload, ns_range).unwrap()); + + (header, vid_common, ns_proof) +} + +fn mock_inputs(stdin: &mut SP1Stdin) { + let mut rng = rand::rngs::StdRng::from_seed([0u8; 32]); + + let ns_id = rng.next_u32(); + let mut block_merkle_tree = BlockMerkleTree::new(32); + let mut rollup_payload = Payload(vec![]); + let mut block_proofs = vec![]; + + let vid_param = load_srs(); + let mut vid = vid_scheme(NUM_STORAGE_NODES, &vid_param); + + for i in 0..NUM_BLOCKS { + // pick a payload length for each block + let ns_payload_len = rng.gen_range(1..MAX_PAYLOAD_BYTES_PER_BLOCK); + // fill with random payload bytes of `ns_payload_len` + let mut block_ns_payload = vec![0u8; ns_payload_len]; + rng.fill_bytes(&mut block_ns_payload); + + // produce a mock block containing this namespace payload + let (header, vid_common, ns_proof) = + mock_block(i, ns_id, &block_ns_payload, &mut vid, &mut rng); + + // push the block commitment to the BMT + block_merkle_tree.push(header.commit()).unwrap(); + + // retrieve a merkle proof of this block commitment + let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); + + // prepare the block derivation proof + block_proofs.push(( + rollup_payload.0.len()..rollup_payload.0.len() + ns_payload_len, + BlockDerivationProof { + bmt_proof, + block_header: header, + vid_common, + ns_proof, + }, + )); + // append to overall rollup-specific payload + // (as if filtered from a batch of blocks) + rollup_payload.0.append(&mut block_ns_payload); + } + + // update all the BMT inclusion proof since new block commitments where + // accumulated, and old merkle proofs are holding outdated root + for i in 0..NUM_BLOCKS { + let (_, bmt_proof) = block_merkle_tree.lookup(i).expect_ok().unwrap(); + block_proofs.get_mut(i as usize).unwrap().1.bmt_proof = bmt_proof; + } + + // push to inputs + stdin.write(&rollup_payload); + stdin.write(&vid_param); + stdin.write(&ns_id); + stdin.write(&block_merkle_tree.commitment()); + stdin.write(&block_proofs); +} fn main() { // Setup the logger. @@ -46,75 +198,78 @@ fn main() { let client = ProverClient::new(); // Setup the program. - let (pk, vk) = client.setup(FIBONACCI_ELF); + let (pk, vk) = client.setup(ELF); // Setup the inputs.; let mut stdin = SP1Stdin::new(); - stdin.write(&args.n); + mock_inputs(&mut stdin); - println!("n: {}", args.n); - - if args.evm { + if args.bench { + // Execute the program + let (public_values, report) = client + .execute(ELF, stdin) + .run() + .expect("failed to generate proof"); + let public_values: PublicInputs = bincode::deserialize(public_values.as_slice()).unwrap(); + println!("Public values: {:?}", public_values); + println!("{}", report); + } else if args.evm { // Generate the proof. let proof = client - .prove_plonk(&pk, stdin) + .prove(&pk, stdin) + .plonk() + .run() .expect("failed to generate proof"); create_plonk_fixture(&proof, &vk); } else { // Generate the proof. - let proof = client.prove(&pk, stdin).expect("failed to generate proof"); - let (_, _, fib_n) = - PublicValuesTuple::abi_decode(proof.public_values.as_slice(), false).unwrap(); - println!("Successfully generated proof!"); - println!("fib(n): {}", fib_n); + let proof = client + .prove(&pk, stdin) + .run() + .expect("failed to generate proof"); + let public_values: PublicInputs = + bincode::deserialize(proof.public_values.as_slice()).unwrap(); + println!("Public values: {:?}", public_values); // Verify the proof. client.verify(&proof, &vk).expect("failed to verify proof"); } } -/// A fixture that can be used to test the verification of SP1 zkVM proofs inside Solidity. +/// A fixture that can be used to test the verification of SP1 zkVM proofs +/// inside Solidity. #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -struct SP1FibonacciProofFixture { - a: u32, - b: u32, - n: u32, +struct ProofFixture { vkey: String, public_values: String, proof: String, } /// Create a fixture for the given proof. -fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { - // Deserialize the public values. - let bytes = proof.public_values.as_slice(); - let (n, a, b) = PublicValuesTuple::abi_decode(bytes, false).unwrap(); - +fn create_plonk_fixture(proof: &SP1ProofWithPublicValues, vk: &SP1VerifyingKey) { // Create the testing fixture so we can test things end-to-end. - let fixture = SP1FibonacciProofFixture { - a, - b, - n, + let fixture = ProofFixture { vkey: vk.bytes32().to_string(), - public_values: proof.public_values.bytes().to_string(), - proof: proof.bytes().to_string(), + public_values: format!("0x{}", hex::encode(proof.public_values.as_slice())), + proof: format!("0x{}", hex::encode(proof.bytes())), }; - // The verification key is used to verify that the proof corresponds to the execution of the - // program on the given input. + // The verification key is used to verify that the proof corresponds to the + // execution of the program on the given input. // // Note that the verification key stays the same regardless of the input. println!("Verification Key: {}", fixture.vkey); - // The public values are the values whicha are publicly committed to by the zkVM. + // The public values are the values whicha are publicly committed to by the + // zkVM. // - // If you need to expose the inputs or outputs of your program, you should commit them in - // the public values. + // If you need to expose the inputs or outputs of your program, you should + // commit them in the public values. println!("Public Values: {}", fixture.public_values); - // The proof proves to the verifier that the program was executed with some inputs that led to - // the give public values. + // The proof proves to the verifier that the program was executed with some + // inputs that led to the give public values. println!("Proof Bytes: {}", fixture.proof); // Save the fixture to a file. @@ -126,3 +281,13 @@ fn create_plonk_fixture(proof: &SP1PlonkBn254Proof, vk: &SP1VerifyingKey) { ) .expect("failed to write fixture"); } + +fn load_srs() -> VidParam { + let srs = ark_srs::kzg10::aztec20::setup(SRS_DEGREE).expect("Aztec SRS failed to load"); + VidParam(UnivariateUniversalParams { + powers_of_g: srs.powers_of_g, + h: srs.h, + beta_h: srs.beta_h, + powers_of_h: vec![srs.h, srs.beta_h], + }) +} diff --git a/sp1/utils/Cargo.toml b/sp1/utils/Cargo.toml new file mode 100644 index 0000000..04897ca --- /dev/null +++ b/sp1/utils/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "espresso-derivation-utils" +version = "0.1.0" +edition = "2021" + +[dependencies] +ark-bn254 = { workspace = true } +ark-serialize = { workspace = true } +ark-std = "0.4" +base64-bytes = "0.1" +bincode = "1.3" +committable = { workspace = true } +either = { workspace = true } +jf-merkle-tree = { workspace = true } +jf-pcs = { workspace = true } +jf-utils = { version = "0.4.4", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", features = [ + "std", +] } +jf-vid = { workspace = true } +primitive-types = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +serde_with = "1.6" +sha2 = { workspace = true } +tagged-base64 = "0.4" diff --git a/sp1/utils/src/block.rs b/sp1/utils/src/block.rs new file mode 100644 index 0000000..9197328 --- /dev/null +++ b/sp1/utils/src/block.rs @@ -0,0 +1,8 @@ +//! Definitions of necessary parts of an espresso block. + +use primitive_types::H256; + +pub mod header; +pub mod payload; + +pub type RollupCommitment = H256; diff --git a/sp1/utils/src/block/header.rs b/sp1/utils/src/block/header.rs new file mode 100644 index 0000000..19e0378 --- /dev/null +++ b/sp1/utils/src/block/header.rs @@ -0,0 +1,390 @@ +//! Define the header struct of an espresso block. + +use super::payload::VidCommitment; +use crate::ns_table::NsTable; +use ark_serialize::{ + CanonicalDeserialize, CanonicalSerialize, Compress, SerializationError, Valid, Validate, +}; +use committable::{Commitment, Committable, RawCommitmentBuilder}; +use either::Either; +use jf_merkle_tree::{ + prelude::{SHA3MerkleTree, Sha3Digest, Sha3Node, UniversalMerkleTree}, + MerkleTreeScheme, ToTraversalPath, +}; +use primitive_types::{H160, H256, U256}; +use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DisplayFromStr}; +use std::io::Read; +use tagged_base64::tagged; + +/// Types for block Merkle tree. This struct is essentially the same as +/// `LightWeightSha3MerkleTree`, as the later one only keeps a frontier +pub type BlockMerkleTree = SHA3MerkleTree>; +pub type BlockMerkleTreeProof = ::MembershipProof; +pub type BlockMerkleCommitment = ::Commitment; + +/// Types for Fee Merkle tree. +/// Although it's not used. Imported for convenience of serialization. +pub type FeeMerkleTree = UniversalMerkleTree; +pub type FeeMerkleCommitment = ::Commitment; + +/// Builder commitment. +/// Although it's not used. Imported for convenience of serialization. +#[tagged("BUILDER_COMMITMENT")] +#[derive(Clone, Debug, Hash, PartialEq, Eq, CanonicalSerialize, CanonicalDeserialize)] +pub struct BuilderCommitment(pub [u8; 32]); + +#[derive(Debug, Serialize, Deserialize)] +pub struct BlockHeader { + pub chain_config: ResolvableChainConfig, + pub height: u64, + pub timestamp: u64, + + pub l1_head: u64, + + pub l1_finalized: Option, + + pub payload_commitment: VidCommitment, + /// Builder commitment is a Sha256 hash output, 32 bytes. + pub builder_commitment: BuilderCommitment, + /// A namespace table + pub ns_table: NsTable, + /// Root Commitment of Block Merkle Tree + pub block_merkle_tree_root: BlockMerkleCommitment, + /// Serialized root Commitment of `FeeMerkleTree` + pub fee_merkle_tree_root: FeeMerkleCommitment, + /// Fee information of this block + pub fee_info: FeeInfo, + // Builder signature is not formally part of the header and not committed. +} + +impl Committable for BlockHeader { + fn commit(&self) -> Commitment { + let mut bmt_bytes = vec![]; + self.block_merkle_tree_root + .serialize_with_mode(&mut bmt_bytes, ark_serialize::Compress::Yes) + .unwrap(); + let mut fmt_bytes = vec![]; + self.fee_merkle_tree_root + .serialize_with_mode(&mut fmt_bytes, ark_serialize::Compress::Yes) + .unwrap(); + + RawCommitmentBuilder::new(&Self::tag()) + .field("chain_config", self.chain_config.commit()) + .u64_field("height", self.height) + .u64_field("timestamp", self.timestamp) + .u64_field("l1_head", self.l1_head) + .optional("l1_finalized", &self.l1_finalized) + .constant_str("payload_commitment") + .fixed_size_bytes(self.payload_commitment.as_ref().as_ref().as_ref()) + .constant_str("builder_commitment") + .fixed_size_bytes(&self.builder_commitment.0) + .field("ns_table", self.ns_table.commit()) + .var_size_field("block_merkle_tree_root", &bmt_bytes) + .var_size_field("fee_merkle_tree_root", &fmt_bytes) + .field("fee_info", self.fee_info.commit()) + .finalize() + } + + fn tag() -> String { + // We use the tag "BLOCK" since blocks are identified by the hash of their + // header. This will thus be more intuitive to users than "HEADER". + "BLOCK".into() + } +} + +#[derive(Hash, Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Default)] +/// `FeeInfo` holds data related to builder fees. +/// Although it's not used. Imported for convenience of serialization. +pub struct FeeInfo { + pub account: FeeAccount, + pub amount: FeeAmount, +} +impl FeeInfo { + pub fn account(&self) -> FeeAccount { + self.account + } + + pub fn amount(&self) -> FeeAmount { + self.amount + } +} + +impl Committable for FeeInfo { + fn commit(&self) -> Commitment { + let mut amt_bytes = [0u8; 32]; + self.amount.0.to_little_endian(&mut amt_bytes); + RawCommitmentBuilder::new(&Self::tag()) + .fixed_size_field("account", &self.account.0.to_fixed_bytes()) + .fixed_size_field("amount", &amt_bytes) + .finalize() + } + fn tag() -> String { + "FEE_INFO".into() + } +} + +/// Global variables for an Espresso blockchain. +#[serde_as] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] +pub struct ChainConfig { + /// Espresso chain ID + pub chain_id: U256, + + /// Maximum size in bytes of a block + #[serde_as(as = "DisplayFromStr")] + pub max_block_size: u64, + + /// Minimum fee in WEI per byte of payload + pub base_fee: U256, + + /// Fee contract H160 on L1. + /// + /// This is optional so that fees can easily be toggled on/off, with no need + /// to deploy a contract when they are off. In a future release, after + /// fees are switched on and thoroughly tested, this may be made + /// mandatory. + pub fee_contract: Option, + + /// Account that receives sequencing fees. + /// + /// This account in the Espresso fee ledger will always receive every fee + /// paid in Espresso, regardless of whether or not their is a + /// `fee_contract` deployed. Once deployed, the fee contract can decide + /// what to do with tokens locked in this account in Espresso. + pub fee_recipient: H160, +} + +impl Committable for ChainConfig { + fn tag() -> String { + "CHAIN_CONFIG".to_string() + } + + fn commit(&self) -> Commitment { + let mut chain_id_bytes = [0u8; 32]; + self.chain_id.to_little_endian(&mut chain_id_bytes); + + let mut base_fee_bytes = [0u8; 32]; + self.base_fee.to_little_endian(&mut base_fee_bytes); + + let comm = committable::RawCommitmentBuilder::new(&Self::tag()) + .fixed_size_field("chain_id", &chain_id_bytes) + .u64_field("max_block_size", self.max_block_size) + .fixed_size_field("base_fee", &base_fee_bytes) + .fixed_size_field("fee_recipient", &self.fee_recipient.to_fixed_bytes()); + let comm = if let Some(addr) = self.fee_contract { + comm.u64_field("fee_contract", 1).fixed_size_bytes(&addr.0) + } else { + comm.u64_field("fee_contract", 0) + }; + comm.finalize() + } +} + +#[derive(Clone, Debug, Copy, PartialEq, Deserialize, Serialize, Eq, Hash)] +pub struct ResolvableChainConfig { + chain_config: Either>, +} + +impl Default for ResolvableChainConfig { + fn default() -> Self { + Self { + chain_config: Either::Left(Default::default()), + } + } +} + +impl ResolvableChainConfig { + pub fn commit(&self) -> Commitment { + match self.chain_config { + Either::Left(config) => config.commit(), + Either::Right(commitment) => commitment, + } + } + pub fn resolve(self) -> Option { + match self.chain_config { + Either::Left(config) => Some(config), + Either::Right(_) => None, + } + } +} + +impl From> for ResolvableChainConfig { + fn from(value: Commitment) -> Self { + Self { + chain_config: Either::Right(value), + } + } +} + +impl From for ResolvableChainConfig { + fn from(value: ChainConfig) -> Self { + Self { + chain_config: Either::Left(value), + } + } +} + +#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Hash, PartialEq, Eq)] +pub struct L1BlockInfo { + pub number: u64, + pub timestamp: U256, + pub hash: H256, +} + +impl Committable for L1BlockInfo { + fn commit(&self) -> Commitment { + let mut timestamp = [0u8; 32]; + self.timestamp.to_little_endian(&mut timestamp); + + RawCommitmentBuilder::new(&Self::tag()) + .u64_field("number", self.number) + // `RawCommitmentBuilder` doesn't have a `u256_field` method, so we simulate it: + .constant_str("timestamp") + .fixed_size_bytes(×tamp) + .constant_str("hash") + .fixed_size_bytes(&self.hash.0) + .finalize() + } + + fn tag() -> String { + "L1BLOCK".into() + } +} + +#[derive( + Debug, Copy, Serialize, Deserialize, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default, +)] +pub struct FeeAccount(pub H160); + +impl ToTraversalPath<256> for FeeAccount { + fn to_traversal_path(&self, height: usize) -> Vec { + self.0 + .to_fixed_bytes() + .into_iter() + .take(height) + .map(|i| i as usize) + .collect() + } +} + +impl CanonicalSerialize for FeeAccount { + fn serialize_with_mode( + &self, + mut writer: W, + _compress: Compress, + ) -> Result<(), SerializationError> { + Ok(writer.write_all(&self.0.to_fixed_bytes())?) + } + + fn serialized_size(&self, _compress: Compress) -> usize { + core::mem::size_of::() + } +} +impl CanonicalDeserialize for FeeAccount { + fn deserialize_with_mode( + mut reader: R, + _compress: Compress, + _validate: Validate, + ) -> Result { + let mut bytes = [0u8; core::mem::size_of::()]; + reader.read_exact(&mut bytes)?; + let value = H160::from_slice(&bytes); + Ok(Self(value)) + } +} + +impl Valid for FeeAmount { + fn check(&self) -> Result<(), SerializationError> { + Ok(()) + } +} + +impl Valid for FeeAccount { + fn check(&self) -> Result<(), SerializationError> { + Ok(()) + } +} + +#[derive( + Debug, Copy, Serialize, Deserialize, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default, +)] +pub struct FeeAmount(pub U256); + +impl CanonicalSerialize for FeeAmount { + fn serialize_with_mode( + &self, + mut writer: W, + _compress: Compress, + ) -> Result<(), SerializationError> { + let mut bytes = [0u8; core::mem::size_of::()]; + self.0.to_little_endian(&mut bytes); + Ok(writer.write_all(&bytes)?) + } + + fn serialized_size(&self, _compress: Compress) -> usize { + core::mem::size_of::() + } +} +impl CanonicalDeserialize for FeeAmount { + fn deserialize_with_mode( + mut reader: R, + _compress: Compress, + _validate: Validate, + ) -> Result { + let mut bytes = [0u8; core::mem::size_of::()]; + reader.read_exact(&mut bytes)?; + let value = U256::from_little_endian(&bytes); + Ok(Self(value)) + } +} + +#[cfg(test)] +mod tests { + use super::BlockHeader; + + #[test] + fn test_header_serialization() { + // This string is tweaked from an actual data from Espresso's staging testnet. + let raw_header_string = r#"{ + "chain_config": { + "chain_config": { + "Left": { + "chain_id": "888888888", + "max_block_size": "30000000", + "base_fee": "0", + "fee_contract": null, + "fee_recipient": "0x0000000000000000000000000000000000000000" + } + } + }, + "height": 69781, + "timestamp": 1720789795, + "l1_head": 5113, + "l1_finalized": { + "number": 5088, + "timestamp": "0x669129ec", + "hash": "0xfc4249b13292d2617cc0dec8b0a9a666491d5fecdfe536c929207847364b2b60" + }, + "payload_commitment": "HASH~3XOkaXVZS5e_7xjbbqN22voRnSe_p7Di-U4OPmdCD0JF", + "builder_commitment": "BUILDER_COMMITMENT~tEvs0rxqOiMCvfe2R0omNNaphSlUiEDrb2q0IZpRcgA_", + "ns_table": { + "bytes": "AAAAAA==" + }, + "block_merkle_tree_root": "MERKLE_COMM~02gWBSt2tcz9XfOOO6xEVicluWIIP95BW8I11f2graggAAAAAAAAAJUQAQAAAAAAUQ", + "fee_merkle_tree_root": "MERKLE_COMM~yB4_Aqa35_PoskgTpcCR1oVLh6BUdLHIs7erHKWi-usUAAAAAAAAAAEAAAAAAAAAJg", + "fee_info": { + "account": "0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f", + "amount": "0" + }, + "builder_signature": { + "r": "0x6291b473fdac85b9ce7b40b530ea4173ac6e71fd29acffc3cbc97ae637d4404d", + "s": "0x3178fe07d5071df7a7ce4106e6e1e3727aa6edc458db03d1774948bdec32eac6", + "v": 28 + } + }"#; + + let header: BlockHeader = serde_json::from_str(raw_header_string).unwrap(); + std::println!("{:?}", header); + } +} diff --git a/sp1/utils/src/block/payload.rs b/sp1/utils/src/block/payload.rs new file mode 100644 index 0000000..b7ae7bc --- /dev/null +++ b/sp1/utils/src/block/payload.rs @@ -0,0 +1,174 @@ +//! Define the payload for an espresso block. +use ark_bn254::Bn254; +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; +use jf_pcs::{ + prelude::UnivariateUniversalParams, univariate_kzg::UnivariateKzgPCS, + PolynomialCommitmentScheme, +}; +use jf_vid::{ + advz::{payload_prover::LargeRangeProof, Advz}, + VidScheme, +}; +use primitive_types::H256; +use serde::{de::Error as _, ser::Error as _, Deserialize, Serialize}; +use sha2::{Digest, Sha256}; +use tagged_base64::tagged; + +use super::RollupCommitment; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Payload(pub Vec); + +/// Private type alias for the EC pairing type parameter for [`Advz`]. +type E = Bn254; +/// Private type alias for the hash type parameter for [`Advz`]. +type H = Sha256; + +/// VidScheme +pub type Vid = Advz; + +/// VID commitment type +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +#[tagged("HASH")] +pub struct VidCommitment(pub ::Commit); + +impl AsRef<::Commit> for VidCommitment { + fn as_ref(&self) -> &::Commit { + &self.0 + } +} + +/// Type of common data for VID scheme +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +pub struct VidCommon(pub ::Common); + +impl AsRef<::Common> for VidCommon { + fn as_ref(&self) -> &::Common { + &self.0 + } +} + +impl Serialize for VidCommon { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for VidCommon { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + <::Common as CanonicalDeserialize>::deserialize_uncompressed_unchecked( + &*bytes, + ) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(VidCommon) + } +} + +/// Public parameters to setup the VID scheme +/// Manual (de)serialization to avoid the expensive validity check. +#[derive(Debug, CanonicalSerialize, CanonicalDeserialize)] +pub struct VidParam(pub UnivariateUniversalParams); + +impl Serialize for VidParam { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for VidParam { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + as CanonicalDeserialize>::deserialize_uncompressed_unchecked( + &*bytes, + ) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(VidParam) + } +} + +type F = as PolynomialCommitmentScheme>::Evaluation; +/// Namespace Proof type +#[derive(Clone, Debug, CanonicalSerialize, CanonicalDeserialize)] +pub struct NsProof(pub LargeRangeProof); + +impl From> for NsProof { + fn from(proof: LargeRangeProof) -> Self { + Self(proof) + } +} + +impl AsRef> for NsProof { + fn as_ref(&self) -> &LargeRangeProof { + &self.0 + } +} + +impl Serialize for NsProof { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let mut bytes = Vec::new(); + self.0 + .serialize_uncompressed(&mut bytes) + .map_err(|e| S::Error::custom(format!("{e:?}")))?; + Serialize::serialize(&bytes, serializer) + } +} + +impl<'de> Deserialize<'de> for NsProof { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + let bytes = as Deserialize>::deserialize(deserializer)?; + as CanonicalDeserialize>::deserialize_uncompressed_unchecked(&*bytes) + .map_err(|e| D::Error::custom(format!("{e:?}"))) + .map(NsProof) + } +} + +/// Dummy rollup payload commit +pub fn rollup_commit(payload: &Payload) -> RollupCommitment { + let bytes: [u8; 32] = Sha256::digest(&payload.0).into(); + bytes.into() +} + +pub fn compute_vid_param_hash(param: &VidParam) -> H256 { + let bytes: [u8; 32] = Sha256::digest(bincode::serialize(param).unwrap()).into(); + bytes.into() +} + +pub const SRS_DEGREE: usize = 2u64.pow(20) as usize + 2; + +/// Construct a VID scheme given the number of storage nodes. +/// Copied from espresso-sequencer repo +pub fn vid_scheme(num_storage_nodes: u32, param: &VidParam) -> Vid { + let recovery_threshold = 1 << num_storage_nodes.ilog2(); + + Advz::new(num_storage_nodes, recovery_threshold, ¶m.0).unwrap_or_else(|err| { + panic!("advz construction failure: (num_storage nodes,recovery_threshold)=({num_storage_nodes},{recovery_threshold}); \ + error: {err}") + }) +} diff --git a/sp1/utils/src/lib.rs b/sp1/utils/src/lib.rs new file mode 100644 index 0000000..fa3f321 --- /dev/null +++ b/sp1/utils/src/lib.rs @@ -0,0 +1,42 @@ +//! Espresso derivation utilities for rollup integration. +// Ideally we could directly import types and structs from `espresso-sequencer`` +// repo. However, one of its dependency, `HotShot` requires a minimum rust version of [1.76.0](https://github.com/EspressoSystems/HotShot/blob/4713af7704f88f38a8a69b708acd4677f76d8ff1/Cargo.toml#L5). +// This is incompatible with the current sp1 rust toolchain 1.75.0. + +use block::{ + header::{BlockHeader, BlockMerkleCommitment, BlockMerkleTreeProof}, + payload::{NsProof, VidCommon}, + RollupCommitment, +}; +use primitive_types::H256; +use serde::{Deserialize, Serialize}; + +pub mod block; +pub mod ns_table; + +#[derive(Serialize, Deserialize, Debug)] +/// Public inputs +pub struct PublicInputs { + pub rollup_txs_commit: RollupCommitment, + /// Hash of the used VID public parameter + pub vid_param_hash: H256, + /// Namespace ID of the rollup + pub ns_id: u32, + /// Block Merkle tree commitment. Block MT contains information about all + /// historical blocks up to some block height. + pub bmt_commitment: BlockMerkleCommitment, +} + +#[derive(Serialize, Deserialize, Debug)] +/// Proves that a slice of payload bytes is derived from an espresso block. +pub struct BlockDerivationProof { + /// A block MT proof for the block header + pub bmt_proof: BlockMerkleTreeProof, + /// Block header + pub block_header: BlockHeader, + /// Common data associated with the VID disperser, used for namespace proof + /// verification + pub vid_common: VidCommon, + /// Namespace proof of the given payload + pub ns_proof: NsProof, +} diff --git a/sp1/utils/src/ns_table.rs b/sp1/utils/src/ns_table.rs new file mode 100644 index 0000000..cf055f1 --- /dev/null +++ b/sp1/utils/src/ns_table.rs @@ -0,0 +1,116 @@ +//! Definitions and utilities for namespace table of an espresso block. +//! Most of contents are "unwrapped" from espresso-sequencer repo. +use committable::{Commitment, Committable, RawCommitmentBuilder}; +use serde::{Deserialize, Serialize}; + +/// Byte lengths for the different items that could appear in a namespace table. +const NUM_NSS_BYTE_LEN: usize = 4; +const NS_OFFSET_BYTE_LEN: usize = 4; + +// Byte length for namespace IDs. +const NS_ID_BYTE_LEN: usize = 4; + +/// Type definition for a namespace table. +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct NsTable { + #[serde(with = "base64_bytes")] + pub bytes: Vec, +} + +impl NsTable { + /// Number of entries in the namespace table. + /// + /// Defined as the maximum number of entries that could fit in the namespace + /// table, ignoring what's declared in the table header. + #[allow(clippy::len_without_is_empty)] + pub fn len(&self) -> u32 { + u32::from_le_bytes(self.bytes[..NUM_NSS_BYTE_LEN].try_into().unwrap()) + } + + /// Read from namespace table given an index. + /// + /// Return None if there's no corresponding entry, or a triple + /// (id, start, end) which specifies the namespacd ID and its range in the + /// payload [start, end). + pub fn read(&self, index: u32) -> Option<(u32, u32, u32)> { + if index >= self.len() { + None + } else { + Some(self.read_unchecked(index)) + } + } + + /// Read from namespace table given an index without range check. + /// + /// Return a triple (id, start, end) which specifies the namespacd ID and + /// its range [start, end) in the payload. + pub fn read_unchecked(&self, index: u32) -> (u32, u32, u32) { + let pos = index as usize * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; + let id = u32::from_le_bytes(self.bytes[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let end = u32::from_le_bytes( + self.bytes[pos + NS_ID_BYTE_LEN..pos + NS_OFFSET_BYTE_LEN + NS_ID_BYTE_LEN] + .try_into() + .unwrap(), + ); + let start = if index == 0 { + 0u32 + } else { + u32::from_le_bytes( + self.bytes[pos - NS_OFFSET_BYTE_LEN..pos] + .try_into() + .unwrap(), + ) + }; + (id, start, end) + } + + /// Read from namespace table given a namespace ID. + /// + /// Return None if given ID is not present, or a tuple (start, end) + /// specifying its bytes range [start, end) in the payload. + pub fn scan_for_id(&self, id: u32) -> Option<(u32, u32)> { + let mut pos = NUM_NSS_BYTE_LEN; + let mut last_offset = 0u32; + for _ in 0..self.len() { + let cur_id = + u32::from_le_bytes(self.bytes[pos..pos + NS_ID_BYTE_LEN].try_into().unwrap()); + let cur_offset = u32::from_le_bytes( + self.bytes[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] + .try_into() + .unwrap(), + ); + if id == cur_id { + return Some((last_offset, cur_offset)); + } + last_offset = cur_offset; + pos += NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN; + } + None + } + + pub fn mock_ns_table(entries: &[(u32, u32)]) -> Self { + let num_entries = entries.len(); + let mut bytes = + vec![0u8; NUM_NSS_BYTE_LEN + num_entries * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN)]; + bytes[0..NUM_NSS_BYTE_LEN].copy_from_slice(&(num_entries as u32).to_le_bytes()); + entries.iter().enumerate().for_each(|(i, (id, offset))| { + let pos = i * (NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN) + NUM_NSS_BYTE_LEN; + bytes[pos..pos + NS_ID_BYTE_LEN].copy_from_slice(&id.to_le_bytes()); + bytes[pos + NS_ID_BYTE_LEN..pos + NS_ID_BYTE_LEN + NS_OFFSET_BYTE_LEN] + .copy_from_slice(&offset.to_le_bytes()); + }); + Self { bytes } + } +} + +impl Committable for NsTable { + fn commit(&self) -> Commitment { + RawCommitmentBuilder::new(&Self::tag()) + .var_size_bytes(&self.bytes) + .finalize() + } + + fn tag() -> String { + "NSTABLE".into() + } +}