diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4986751..2709d9b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,9 @@ concurrency: env: RUST_BACKTRACE: "1" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RISC0_VERSION: 0.20.1 + RISC0_TOOLCHAIN_VERSION: test-release-2 jobs: integration: @@ -39,13 +42,12 @@ jobs: uses: risc0/cargo-install@v1 with: crate: cargo-binstall - version: "1.4" - name: Cargo binstall cargo-risczero - run: cargo binstall -y --force cargo-risczero@0.19.1 + run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_VERSION }} - name: risczero toolchain install - run: cargo risczero install + run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION - name: build solidity contracts run: forge build @@ -79,13 +81,12 @@ jobs: uses: risc0/cargo-install@v1 with: crate: cargo-binstall - version: "1.4" - name: Cargo binstall cargo-risczero - run: cargo binstall -y --force cargo-risczero@0.19.1 + run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_VERSION }} - name: risczero toolchain install - run: cargo risczero install + run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION - name: build solidity contracts run: forge build diff --git a/.gitmodules b/.gitmodules index 7efe6d52..a7430ba0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,4 +13,4 @@ [submodule "lib/risc0"] path = lib/risc0 url = https://github.com/risc0/risc0 - branch = "release-0.19" + branch = "release-0.20" diff --git a/Cargo.lock b/Cargo.lock index 13302f42..48dd7923 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,18 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.0.3" @@ -90,7 +102,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", "syn-solidity", "tiny-keccak", ] @@ -176,6 +188,52 @@ version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2 0.10.7", +] + +[[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", + "num-traits", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -259,6 +317,46 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[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", +] + +[[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" @@ -275,11 +373,35 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", "num-bigint", ] +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -336,7 +458,7 @@ checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -379,20 +501,20 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.20" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" dependencies = [ "async-trait", "axum-core", "axum-macros", - "bitflags 1.3.2", "bytes", "futures-util", - "headers", - "http", - "http-body", - "hyper", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.1.0", + "hyper-util", "itoa", "matchit", "memchr", @@ -409,35 +531,54 @@ dependencies = [ "tower", "tower-layer", "tower-service", + "tracing", ] [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper", "tower-layer", "tower-service", + "tracing", ] [[package]] name = "axum-macros" -version = "0.3.8" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdca6a10ecad987bda04e95606ef85a5417dcaac1a78455242d72e031e2b6b62" +checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", +] + +[[package]] +name = "backoff" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62ddb9cb1ec0a098ad4bbf9344d0713fa193ae1a80af55febcff2627b6a00c1" +dependencies = [ + "futures-core", + "getrandom", + "instant", + "pin-project-lite", + "rand", + "tokio", ] [[package]] @@ -572,9 +713,9 @@ dependencies = [ [[package]] name = "bonsai-ethereum-contracts" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1af3b51edcb9d2127f65748f97fcf0533226795e7115d6ffd2549e67b5f915c3" +checksum = "500fc613726ab11d784a115217f921633c871513e96b0d1cddd863f2bd377f64" dependencies = [ "anyhow", "ethers", @@ -582,13 +723,14 @@ dependencies = [ [[package]] name = "bonsai-ethereum-relay" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372b5a392faeaa4837ca701297c0475704c839ee4bbfc9d64f35c210f8302cab" +checksum = "1bbe24ac42f57ec3a9080f01dd675431ea9f66d8aa4480a5e9f2d907092ca91c" dependencies = [ "anyhow", "async-trait", "axum", + "backoff", "bincode", "bonsai-ethereum-contracts", "bonsai-rest-api-mock", @@ -599,7 +741,6 @@ dependencies = [ "ethers-signers", "futures", "hex", - "hyper", "pin-project", "reqwest", "risc0-zkvm", @@ -610,7 +751,7 @@ dependencies = [ "tokio-stream", "tower-http", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.17", "utoipa", "utoipa-swagger-ui", "validator", @@ -632,6 +773,7 @@ dependencies = [ "ethers", "ethers-signers", "hex", + "humantime", "risc0-build", "risc0-zkvm", "tokio", @@ -639,9 +781,9 @@ dependencies = [ [[package]] name = "bonsai-rest-api-mock" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa1fb49039705dc5e14e4ad72c62abb76a6c5837d30f52ae961a563a357d893" +checksum = "e326649da91b08b03c4543c40db9603459cd2a206614d4431ff1efde2403e821" dependencies = [ "anyhow", "axum", @@ -659,9 +801,9 @@ dependencies = [ [[package]] name = "bonsai-sdk" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "441d1092e11977985946b6564251df91d80ae36982128e53be52a32548ad8762" +checksum = "d5f0a6b186dce8b2f945bd3ecc5d35a36280400200ed57878c7c3f2aeb01632e" dependencies = [ "reqwest", "serde", @@ -715,7 +857,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -765,9 +907,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" dependencies = [ "serde", ] @@ -870,7 +1012,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -1218,7 +1360,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -1484,7 +1626,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.28", + "syn 2.0.48", "toml", "walkdir", ] @@ -1502,7 +1644,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -1528,7 +1670,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.28", + "syn 2.0.48", "tempfile", "thiserror", "tiny-keccak", @@ -1596,7 +1738,7 @@ dependencies = [ "futures-util", "hashers", "hex", - "http", + "http 0.2.9", "instant", "once_cell", "pin-project", @@ -1739,21 +1881,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.0" @@ -1845,7 +1972,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -1967,7 +2094,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.9", "indexmap 1.9.3", "slab", "tokio", @@ -1975,12 +2102,40 @@ dependencies = [ "tracing", ] +[[package]] +name = "h2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 1.0.0", + "indexmap 2.0.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" 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.0" @@ -1996,31 +2151,6 @@ dependencies = [ "fxhash", ] -[[package]] -name = "headers" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" -dependencies = [ - "base64 0.13.1", - "bitflags 1.3.2", - "bytes", - "headers-core", - "http", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http", -] - [[package]] name = "heck" version = "0.4.1" @@ -2084,6 +2214,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.5" @@ -2091,15 +2232,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http", + "http 0.2.9", "pin-project-lite", ] [[package]] -name = "http-range-header" -version = "0.3.1" +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "pin-project-lite", +] [[package]] name = "httparse" @@ -2113,6 +2271,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.27" @@ -2123,9 +2287,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.20", + "http 0.2.9", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -2137,14 +2301,33 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.2", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "tokio", +] + [[package]] name = "hyper-rustls" version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "http", - "hyper", + "http 0.2.9", + "hyper 0.14.27", "log", "rustls 0.20.8", "rustls-native-certs", @@ -2159,24 +2342,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.9", + "hyper 0.14.27", "rustls 0.21.6", "tokio", "tokio-rustls 0.24.1", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" dependencies = [ "bytes", - "hyper", - "native-tls", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.1.0", + "pin-project-lite", + "socket2 0.5.3", "tokio", - "tokio-native-tls", + "tracing", ] [[package]] @@ -2534,24 +2722,6 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -2587,7 +2757,7 @@ checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -2638,7 +2808,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -2687,50 +2857,12 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "openssl" -version = "0.10.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.28", -] - [[package]] name = "openssl-probe" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "openssl-sys" -version = "0.9.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "overload" version = "0.1.1" @@ -2898,7 +3030,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -2936,7 +3068,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -2986,7 +3118,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" dependencies = [ "proc-macro2", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -3039,9 +3171,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -3093,7 +3225,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.28", + "syn 2.0.48", "tempfile", "which", ] @@ -3108,7 +3240,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -3137,9 +3269,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3302,17 +3434,15 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.20", + "http 0.2.9", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls 0.24.1", - "hyper-tls", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -3322,7 +3452,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "tokio", - "tokio-native-tls", "tokio-rustls 0.24.1", "tokio-util", "tower-service", @@ -3371,25 +3500,26 @@ dependencies = [ [[package]] name = "risc0-binfmt" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923c85a23cb9a9475b8cd4479ad3a06252604a361626e9ae7dc0dc635af22c22" +checksum = "9d263c6370d7714d2a634b6d88deb3871d0fad1f9486a9da6d48139c1ac85b26" dependencies = [ "anyhow", "elf", - "log", "risc0-zkp", "risc0-zkvm-platform", "serde", + "tracing", ] [[package]] name = "risc0-build" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e58d4cc25e243e52d1ccd75d357b0aa55081736bf3052c65a823fdf169586843" +checksum = "a636849a58335ebece68161006a53d5590a6698092c3ca8e8a40a7c0aa8a20fb" dependencies = [ "anyhow", + "cargo-platform", "cargo_metadata 0.17.0", "docker-generate", "risc0-binfmt", @@ -3402,13 +3532,13 @@ dependencies = [ [[package]] name = "risc0-circuit-recursion" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97547e10e9fdaaab8b64ffb45dc158b31f023b1a68015c6ce9f12fe3e403012a" +checksum = "bc9835069929a0e7b6b4b34e6a83f08aaa9d34b30023b9ccaf96ddbe20404eba" dependencies = [ "anyhow", "bytemuck", - "log", + "hex", "risc0-core", "risc0-zkp", "tracing", @@ -3416,12 +3546,11 @@ dependencies = [ [[package]] name = "risc0-circuit-rv32im" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a269d01b18cba24ee1a08f68726fc3623e8705ed79d158377d12e9129dcde2e" +checksum = "cb1caa759ab74d08779e062fcf98f5bd34397dfde572516a52369f0ec46db650" dependencies = [ "anyhow", - "log", "risc0-core", "risc0-zkp", "risc0-zkvm-platform", @@ -3430,9 +3559,9 @@ dependencies = [ [[package]] name = "risc0-core" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "477e0bb8d2ec0b7955088b521eb596901e652d0faa2ea73bda0b77e05af5c07d" +checksum = "be79c89bcd18886b376073e3da22f8b7963247a42dce7b49cf3d09853f51641e" dependencies = [ "bytemuck", "rand_core", @@ -3440,16 +3569,15 @@ dependencies = [ [[package]] name = "risc0-zkp" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5abb1a0cf847d3f9aed1e563b76c358107e7ba66dbfab28f7144252c990bd82" +checksum = "e20a57e04840a5afadebb5d232546245f4fd8bd0e774bd69bf4bf25f8ab90c04" dependencies = [ "anyhow", "blake2", "bytemuck", "digest 0.10.7", "hex", - "log", "paste", "rand_core", "risc0-core", @@ -3461,11 +3589,14 @@ dependencies = [ [[package]] name = "risc0-zkvm" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf80df202c038efc2199be34fda8114b38bfc5b2b51c60cbbdf1f425b07b384" +checksum = "922588cb4b884b3951316a65581ccdfd1174af93c54093190878366812073329" dependencies = [ "anyhow", + "ark-bn254", + "ark-groth16", + "ark-serialize 0.4.2", "bincode", "bonsai-sdk", "bytemuck", @@ -3473,7 +3604,7 @@ dependencies = [ "cfg-if", "getrandom", "hex", - "log", + "num-bigint", "num-derive", "num-traits", "prost", @@ -3488,14 +3619,15 @@ dependencies = [ "rrs-lib", "semver 1.0.18", "serde", + "sha2 0.10.7", "tracing", ] [[package]] name = "risc0-zkvm-platform" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dcd6b66f7a4972001db0acf3f06d99b7851c8d9f0de1f7e0fb4496c66c5cd02" +checksum = "cc5819c0c3bfd8f20b1226c9d4ca1f342eb3d8385e71211a9383a879643d1dde" dependencies = [ "bytemuck", "getrandom", @@ -3575,8 +3707,8 @@ dependencies = [ "bytes", "crc32fast", "futures", - "http", - "hyper", + "http 0.2.9", + "hyper 0.14.27", "hyper-rustls 0.23.2", "lazy_static", "log", @@ -3599,7 +3731,7 @@ dependencies = [ "chrono", "dirs-next", "futures", - "hyper", + "hyper 0.14.27", "serde", "serde_json", "shlex", @@ -3634,8 +3766,8 @@ dependencies = [ "futures", "hex", "hmac 0.11.0", - "http", - "hyper", + "http 0.2.9", + "hyper 0.14.27", "log", "md-5 0.9.1", "percent-encoding", @@ -3649,9 +3781,9 @@ dependencies = [ [[package]] name = "rust-embed" -version = "6.8.1" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661" +checksum = "a82c0bbc10308ed323529fd3c1dce8badda635aa319a5ff0e6466f33b8101e3f" dependencies = [ "rust-embed-impl", "rust-embed-utils", @@ -3660,23 +3792,23 @@ dependencies = [ [[package]] name = "rust-embed-impl" -version = "6.8.1" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" +checksum = "6227c01b1783cdfee1bcf844eb44594cd16ec71c35305bf1c9fb5aade2735e16" dependencies = [ "proc-macro2", "quote", "rust-embed-utils", "shellexpand", - "syn 2.0.28", + "syn 2.0.48", "walkdir", ] [[package]] name = "rust-embed-utils" -version = "7.8.1" +version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74" +checksum = "8cb0a25bfbb2d4b4402179c2cf030387d9990857ce08a32592c6238db9fa8665" dependencies = [ "sha2 0.10.7", "walkdir", @@ -3971,22 +4103,22 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.183" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -4087,9 +4219,9 @@ dependencies = [ [[package]] name = "shellexpand" -version = "2.1.2" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4" +checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b" dependencies = [ "dirs", ] @@ -4243,7 +4375,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -4285,9 +4417,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -4303,7 +4435,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -4359,7 +4491,7 @@ checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -4440,17 +4572,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", + "syn 2.0.48", ] [[package]] @@ -4566,17 +4688,15 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ae70283aba8d2a8b411c695c437fe25b8b5e44e23e780662002fc72fb47a82" +checksum = "0da193277a4e2c33e59e09b5861580c33dd0a637c3883d0fa74ba40c0374af2e" dependencies = [ "bitflags 2.4.0", "bytes", - "futures-core", - "futures-util", - "http", - "http-body", - "http-range-header", + "http 1.0.0", + "http-body 1.0.0", + "http-body-util", "pin-project-lite", "tower-layer", "tower-service", @@ -4616,7 +4736,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] @@ -4660,6 +4780,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.17" @@ -4696,7 +4825,7 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.9", "httparse", "log", "rand", @@ -4805,9 +4934,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "utoipa" -version = "3.4.4" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de634b7f8178c9c246c88ea251f3a0215c9a4d80778db2d7bd4423a78b5170ec" +checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" dependencies = [ "indexmap 2.0.0", "serde", @@ -4817,23 +4946,23 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "3.4.5" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcba79cb3e5020d9bcc8313cd5aadaf51d6d54a6b3fd08c3d0360ae6b3c83d0" +checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc" dependencies = [ "proc-macro-error", "proc-macro2", "quote", "regex", - "syn 2.0.28", + "syn 2.0.48", "uuid 1.4.1", ] [[package]] name = "utoipa-swagger-ui" -version = "3.1.5" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653" +checksum = "f839caa8e09dddc3ff1c3112a91ef7da0601075ba5025d9f33ae99c4cb9b6e51" dependencies = [ "axum", "mime_guess", @@ -4913,12 +5042,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.4" @@ -4980,7 +5103,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -5014,7 +5137,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5251,6 +5374,26 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "zeroize" version = "1.6.0" @@ -5268,7 +5411,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.48", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 84142d8e..53dd7077 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,11 +3,11 @@ members = ["methods", "relay"] resolver = "2" [workspace.dependencies] -risc0-build = { version = "0.19.1" } -risc0-zkvm = { version = "0.19.1", default-features = false } -bonsai-sdk = { version = "0.5.1" } -bonsai-ethereum-relay = { version = "0.5.1" } +bonsai-ethereum-relay = { version = "0.6.1" } +bonsai-sdk = { version = "0.6.1" } methods = { path = "./methods", package = "bonsai-starter-methods" } +risc0-build = { version = "0.20" } +risc0-zkvm = { version = "0.20", default-features = false } # Always optimize; building and running the guest takes much longer without optimization. [profile.dev] diff --git a/README.md b/README.md index 2ee8f10a..1bc11be3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The picture below shows a simplified overview of how users can integrate Bonsai ![Bonsai Relay Diagram](images/BonsaiRelay.png) -1. Users can delegate their smart contract's logic to Bonsai. The [Bonsai Relay Contract](lib/risc0/bonsai/ethereum/contracts/BonsaiRelay.sol) provides a `Request Callback` interface. This interface, accessible both *off-chain* (through HTTP REST API) and *on-chain*, emits an event detected by the `Ethereum Bonsai Relayer`. +1. Users can delegate their smart contract's logic to Bonsai. The [Bonsai Relay Contract](lib/risc0/bonsai/ethereum/contracts/relay/BonsaiRelay.sol) provides a `Request Callback` interface. This interface, accessible both *off-chain* (through HTTP REST API) and *on-chain*, emits an event detected by the `Ethereum Bonsai Relayer`. 2. The `Ethereum Bonsai Relayer` sends the proof request to Bonsai. 3. Bonsai generates a Snark proof and its result, encapsulated in a journal. 4. The `Ethereum Bonsai Relayer` submits this proof and journal on-chain to the `Bonsai Relay Contract` for validation. diff --git a/contracts/BonsaiStarter.sol b/contracts/BonsaiStarter.sol index 8a4d1d38..7188993b 100644 --- a/contracts/BonsaiStarter.sol +++ b/contracts/BonsaiStarter.sol @@ -16,8 +16,8 @@ pragma solidity ^0.8.17; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; -import {BonsaiCallbackReceiver} from "bonsai/BonsaiCallbackReceiver.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; +import {BonsaiCallbackReceiver} from "bonsai/relay/BonsaiCallbackReceiver.sol"; /// @title A starter application using Bonsai through the on-chain relay. /// @dev This contract demonstrates one pattern for offloading the computation of an expensive diff --git a/contracts/BonsaiStarterLowLevel.sol b/contracts/BonsaiStarterLowLevel.sol index 96648b88..6961c797 100644 --- a/contracts/BonsaiStarterLowLevel.sol +++ b/contracts/BonsaiStarterLowLevel.sol @@ -16,8 +16,8 @@ pragma solidity ^0.8.17; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; -import {BonsaiLowLevelCallbackReceiver} from "bonsai/BonsaiLowLevelCallbackReceiver.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; +import {BonsaiLowLevelCallbackReceiver} from "bonsai/relay/BonsaiLowLevelCallbackReceiver.sol"; /// @title A starter application using Bonsai through the on-chain relay. /// @dev This contract demonstrates one pattern for offloading the computation of an expensive diff --git a/lib/risc0 b/lib/risc0 index bcfc9c6a..e37f5be4 160000 --- a/lib/risc0 +++ b/lib/risc0 @@ -1 +1 @@ -Subproject commit bcfc9c6a55d00eb4696d3c9e20aff0bcff11f8ef +Subproject commit e37f5be4e95ca05c85e3c32f5c5a50943ac0abb5 diff --git a/methods/guest/Cargo.lock b/methods/guest/Cargo.lock index 04f8c75d..6c5d925b 100644 --- a/methods/guest/Cargo.lock +++ b/methods/guest/Cargo.lock @@ -2,12 +2,198 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "anyhow" version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +[[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", + "ark-std", +] + +[[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", + "ark-relations", + "ark-serialize", + "ark-snark", + "ark-std", + "blake2", + "derivative", + "digest", + "sha2", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown", + "itertools", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff", + "ark-std", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[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", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -58,7 +244,7 @@ checksum = "fdde5c9cd29ebd706ce1b35600920a33550e402fc998a2e53ad3b42c3c47a192" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -104,6 +290,17 @@ dependencies = [ "typenum", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.10.7" @@ -122,6 +319,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + [[package]] name = "elf" version = "0.7.2" @@ -182,12 +385,30 @@ dependencies = [ "wasi", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "keccak" version = "0.1.4" @@ -215,6 +436,17 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-derive" version = "0.4.0" @@ -223,7 +455,17 @@ checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", ] [[package]] @@ -235,6 +477,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + [[package]] name = "paste" version = "1.0.14" @@ -247,6 +495,12 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "primitive-types" version = "0.12.1" @@ -259,18 +513,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -280,6 +534,26 @@ name = "radium" version = "0.7.1" source = "git+https://github.com/bitvecto-rs/radium?rev=723bed5abd75994ee4b7221b8b12c9f4e77ce408#723bed5abd75994ee4b7221b8b12c9f4e77ce408" +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -288,27 +562,27 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "risc0-binfmt" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923c85a23cb9a9475b8cd4479ad3a06252604a361626e9ae7dc0dc635af22c22" +checksum = "9d263c6370d7714d2a634b6d88deb3871d0fad1f9486a9da6d48139c1ac85b26" dependencies = [ "anyhow", "elf", - "log", "risc0-zkp", "risc0-zkvm-platform", "serde", + "tracing", ] [[package]] name = "risc0-circuit-recursion" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97547e10e9fdaaab8b64ffb45dc158b31f023b1a68015c6ce9f12fe3e403012a" +checksum = "bc9835069929a0e7b6b4b34e6a83f08aaa9d34b30023b9ccaf96ddbe20404eba" dependencies = [ "anyhow", "bytemuck", - "log", + "hex", "risc0-core", "risc0-zkp", "tracing", @@ -316,12 +590,11 @@ dependencies = [ [[package]] name = "risc0-circuit-rv32im" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a269d01b18cba24ee1a08f68726fc3623e8705ed79d158377d12e9129dcde2e" +checksum = "cb1caa759ab74d08779e062fcf98f5bd34397dfde572516a52369f0ec46db650" dependencies = [ "anyhow", - "log", "risc0-core", "risc0-zkp", "risc0-zkvm-platform", @@ -330,9 +603,9 @@ dependencies = [ [[package]] name = "risc0-core" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "477e0bb8d2ec0b7955088b521eb596901e652d0faa2ea73bda0b77e05af5c07d" +checksum = "be79c89bcd18886b376073e3da22f8b7963247a42dce7b49cf3d09853f51641e" dependencies = [ "bytemuck", "rand_core", @@ -340,16 +613,15 @@ dependencies = [ [[package]] name = "risc0-zkp" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5abb1a0cf847d3f9aed1e563b76c358107e7ba66dbfab28f7144252c990bd82" +checksum = "e20a57e04840a5afadebb5d232546245f4fd8bd0e774bd69bf4bf25f8ab90c04" dependencies = [ "anyhow", "blake2", "bytemuck", "digest", "hex", - "log", "paste", "rand_core", "risc0-core", @@ -361,16 +633,19 @@ dependencies = [ [[package]] name = "risc0-zkvm" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf80df202c038efc2199be34fda8114b38bfc5b2b51c60cbbdf1f425b07b384" +checksum = "922588cb4b884b3951316a65581ccdfd1174af93c54093190878366812073329" dependencies = [ "anyhow", + "ark-bn254", + "ark-groth16", + "ark-serialize", "bytemuck", "cfg-if", "getrandom", "hex", - "log", + "num-bigint", "num-derive", "num-traits", "risc0-binfmt", @@ -382,14 +657,15 @@ dependencies = [ "rrs-lib", "semver", "serde", + "sha2", "tracing", ] [[package]] name = "risc0-zkvm-platform" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dcd6b66f7a4972001db0acf3f06d99b7851c8d9f0de1f7e0fb4496c66c5cd02" +checksum = "cc5819c0c3bfd8f20b1226c9d4ca1f342eb3d8385e71211a9383a879643d1dde" dependencies = [ "bytemuck", "getrandom", @@ -412,6 +688,15 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "semver" version = "1.0.20" @@ -435,7 +720,7 @@ checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -473,9 +758,20 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "2.0.28" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -489,6 +785,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -502,7 +799,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.48", ] [[package]] @@ -510,6 +807,19 @@ name = "tracing-core" version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[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 = "typenum" @@ -535,6 +845,12 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" @@ -546,3 +862,43 @@ name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] diff --git a/methods/guest/Cargo.toml b/methods/guest/Cargo.toml index 5b1a6cc4..37679f01 100644 --- a/methods/guest/Cargo.toml +++ b/methods/guest/Cargo.toml @@ -11,7 +11,7 @@ path = "src/bin/fibonacci.rs" ethabi = { version = "18.0", default-features = false } # Directly import radium to silence warning about unused patch. See https://github.com/risc0/risc0/issues/549 radium = "=0.7.1" -risc0-zkvm = { version = "0.19.1", default-features = false, features = ["std"] } +risc0-zkvm = { version = "0.20", default-features = false, features = ["std"] } [patch.crates-io] radium = { git = "https://github.com/bitvecto-rs/radium", rev = "723bed5abd75994ee4b7221b8b12c9f4e77ce408" } diff --git a/relay/Cargo.toml b/relay/Cargo.toml index 80dd2e1f..932c9fec 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -15,6 +15,7 @@ clap = { version = "4.4", features = ["derive", "env"] } ethers = { version = "2.0", features = ["rustls", "ws"] } ethers-signers = { version = "2.0", features = ["aws"] } hex = "0.4.3" +humantime = "2.1.0" methods = { workspace = true } risc0-build = { workspace = true, features = ["guest-list"] } risc0-zkvm = { workspace = true, default-features = false } diff --git a/relay/src/lib.rs b/relay/src/lib.rs index 51861478..677eb6db 100644 --- a/relay/src/lib.rs +++ b/relay/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2023 RISC Zero, Inc. +// Copyright 2024 RISC Zero, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,41 +17,32 @@ use std::time::Duration; use anyhow::{anyhow, bail, Context, Result}; use bonsai_sdk::alpha::{responses::SnarkReceipt, Client}; use risc0_build::GuestListEntry; -use risc0_zkvm::{ - default_executor, ExecutorEnv, Journal, MemoryImage, Program, Receipt, GUEST_MAX_MEM, PAGE_SIZE, -}; +use risc0_zkvm::{compute_image_id, default_executor, ExecutorEnv, Receipt}; + +pub const POLL_INTERVAL_SEC: u64 = 4; /// Result of executing a guest image, possibly containing a proof. pub enum Output { - Execution { journal: Journal }, + Execution { journal: Vec }, Bonsai { snark_receipt: SnarkReceipt }, } -/// Execute and prove the guest locally, on this machine, as opposed to sending -/// the proof request to the Bonsai service. +/// Execute the guest locally, as opposed to sending the proof request to the +/// Bonsai service. pub fn execute_locally(elf: &[u8], input: Vec) -> Result { - // Execute the guest program, generating the session trace needed to prove the - // computation. let env = ExecutorEnv::builder() .write_slice(&input) .build() - .context("Failed to build exec env")?; + .context("Failed to build ExecutorEnv")?; let exec = default_executor(); - let session = exec - .execute_elf(env, elf) - .with_context(|| format!("Failed to run executor {:?}", &input))?; - + let session_info = exec.execute(env, elf).context("Execution failed")?; Ok(Output::Execution { - journal: session.journal, + journal: session_info.journal.bytes, }) } -pub const POLL_INTERVAL_SEC: u64 = 4; - fn get_digest(elf: &[u8]) -> Result { - let program = Program::load_elf(elf, GUEST_MAX_MEM as u32)?; - let image = MemoryImage::new(&program, PAGE_SIZE as u32)?; - Ok(hex::encode(image.compute_id())) + Ok(hex::encode(compute_image_id(elf)?)) } pub fn prove_alpha(elf: &[u8], input: Vec) -> Result { @@ -59,6 +50,7 @@ pub fn prove_alpha(elf: &[u8], input: Vec) -> Result { Client::from_env(risc0_zkvm::VERSION).context("Failed to create client from env var")?; let img_id = get_digest(elf).context("Failed to generate elf memory image")?; + client.upload_img(&img_id, elf.to_vec())?; let input_id = client @@ -66,7 +58,7 @@ pub fn prove_alpha(elf: &[u8], input: Vec) -> Result { .context("Failed to upload input data")?; let session = client - .create_session(img_id, input_id) + .create_session(img_id, input_id, vec![]) .context("Failed to create remote proving session")?; // Poll and await the result of the STARK rollup proving session. @@ -92,7 +84,7 @@ pub fn prove_alpha(elf: &[u8], input: Vec) -> Result { ) .context("Failed to download receipt")?; let receipt: Receipt = bincode::deserialize(&receipt_buf) - .context("Failed to deserialize SessionReceipt")?; + .context("Failed to deserialize Receipt")?; // eprintln!("Completed STARK proof on bonsai alpha backend!"); return Ok(receipt); } diff --git a/relay/src/main.rs b/relay/src/main.rs index 70fd8c6f..9ec39c43 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -1,4 +1,4 @@ -// Copyright 2023 RISC Zero, Inc. +// Copyright 2024 RISC Zero, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -29,6 +29,12 @@ use risc0_zkvm::sha::Digest; /// Index 0 private key generated by default in Anvil. const ANVIL_DEFAULT_KEY: &str = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; +/// Interval between connection attempts in case of connection loss. +const CONNECTION_RETRY_INTERVAL: std::time::Duration = std::time::Duration::from_secs(5); + +/// Number of connection attempts. +const CONNECTION_RETRY_ATTEMPTS: u64 = 60; + #[derive(Subcommand)] enum Command { /// Runs the RISC-V ELF binary. @@ -69,6 +75,14 @@ enum Command { default_value = ANVIL_DEFAULT_KEY )] private_key: String, + + /// Number of connection attempts. + #[arg(short = 'a', long, env, default_value_t = CONNECTION_RETRY_ATTEMPTS)] + connection_retry_attempts: u64, + + /// Interval between connection attempts. + #[arg(short = 'i', long, env, default_value_t = CONNECTION_RETRY_INTERVAL.into(), value_parser = humantime::parse_duration)] + connection_retry_interval: humantime::Duration, }, } @@ -122,7 +136,7 @@ async fn main() -> anyhow::Result<()> { .context("failed to resolve image output")?; match (dev_mode, output) { (true, Output::Execution { journal }) => { - vec![Token::Bytes(journal.bytes)] + vec![Token::Bytes(journal)] } (false, Output::Bonsai { snark_receipt }) => { vec![ @@ -176,6 +190,8 @@ async fn main() -> anyhow::Result<()> { eth_node, eth_chain_id, private_key, + connection_retry_attempts, + connection_retry_interval, } => { let relayer = Relayer { rest_api: true, @@ -189,8 +205,8 @@ async fn main() -> anyhow::Result<()> { eth_node, eth_chain_id, private_key.try_into()?, - 1, - std::time::Duration::from_secs(10), + connection_retry_attempts, + connection_retry_interval.into(), ); let server_handle = tokio::spawn(relayer.run(client_config)); @@ -221,8 +237,8 @@ async fn upload_images( ) -> anyhow::Result> { // Create a list of either the single binary name to upload or all guests. let guest_entries = guest_binary.map_or_else( - || Ok::<_, anyhow::Error>(GUEST_LIST.to_vec()), - |name| Ok(vec![resolve_guest_entry(GUEST_LIST, &name)?]), + || Ok::<_, anyhow::Error>(GUEST_LIST.iter().cloned().collect::>()), + |name| Ok(vec![resolve_guest_entry(&GUEST_LIST, &name)?]), )?; // Upload each guest binary. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 07e01793..6c18dfcd 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,4 @@ [toolchain] -channel = "1.72" -components = [ "rustfmt" ] \ No newline at end of file +channel = "stable" +components = ["rustfmt", "rust-src"] +profile = "minimal" \ No newline at end of file diff --git a/script/BonsaiDeploy.sol b/script/BonsaiDeploy.sol index 4e29ad71..1c7f9c71 100644 --- a/script/BonsaiDeploy.sol +++ b/script/BonsaiDeploy.sol @@ -18,11 +18,12 @@ pragma solidity ^0.8.17; import {Script} from "forge-std/Script.sol"; import {console2} from "forge-std/console2.sol"; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; -import {BonsaiRelay} from "bonsai/BonsaiRelay.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; +import {BonsaiRelay} from "bonsai/relay/BonsaiRelay.sol"; import {BonsaiCheats} from "bonsai/BonsaiCheats.sol"; -import {BonsaiTestRelay} from "bonsai/BonsaiTestRelay.sol"; -import {ControlID, RiscZeroGroth16Verifier} from "bonsai/groth16/RiscZeroGroth16Verifier.sol"; +import {BonsaiTestRelay} from "bonsai/relay/BonsaiTestRelay.sol"; +import {ControlID} from "bonsai/groth16/ControlID.sol"; +import {RiscZeroGroth16Verifier} from "bonsai/groth16/RiscZeroGroth16Verifier.sol"; import {IRiscZeroVerifier} from "bonsai/IRiscZeroVerifier.sol"; /// @notice Base deployment script for Bonsai projects with Foundry and it's dependencies. diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index a7c5c237..a9bd3d58 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import {Script} from "forge-std/Script.sol"; import {console2} from "forge-std/console2.sol"; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; import {BonsaiCheats} from "bonsai/BonsaiCheats.sol"; import {BonsaiDeploy} from "./BonsaiDeploy.sol"; diff --git a/tests/BonsaiStarter.t.sol b/tests/BonsaiStarter.t.sol index 6e14650c..1697d378 100644 --- a/tests/BonsaiStarter.t.sol +++ b/tests/BonsaiStarter.t.sol @@ -17,7 +17,7 @@ pragma solidity ^0.8.17; import {BonsaiTest} from "bonsai/BonsaiTest.sol"; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; import {BonsaiStarter} from "contracts/BonsaiStarter.sol"; contract BonsaiStarterTest is BonsaiTest { diff --git a/tests/BonsaiStarterLowLevel.t.sol b/tests/BonsaiStarterLowLevel.t.sol index 32dcb41b..0ce1b702 100644 --- a/tests/BonsaiStarterLowLevel.t.sol +++ b/tests/BonsaiStarterLowLevel.t.sol @@ -17,7 +17,7 @@ pragma solidity ^0.8.17; import {BonsaiTest} from "bonsai/BonsaiTest.sol"; -import {IBonsaiRelay} from "bonsai/IBonsaiRelay.sol"; +import {IBonsaiRelay} from "bonsai/relay/IBonsaiRelay.sol"; import {BonsaiStarterLowLevel} from "../contracts/BonsaiStarterLowLevel.sol"; contract BonsaiStarterLowLevelTest is BonsaiTest {