From 34d03d9eec517b39bdc019497957b2d3e2957142 Mon Sep 17 00:00:00 2001 From: Parker Thompson Date: Wed, 1 Nov 2023 10:38:54 -0700 Subject: [PATCH] Upgrade to 0.19 (#66) * Upgrade to 0.19 Co-authored-by: Angelo Capossele * Update .github/workflows/test.yml Co-authored-by: Angelo Capossele --------- Co-authored-by: Angelo Capossele --- .github/workflows/clean.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 28 ++++- Cargo.lock | 225 +++++++++++++++++++++--------------- Cargo.toml | 8 +- README.md | 10 +- lib/risc0 | 2 +- methods/guest/Cargo.lock | 218 +++++++++------------------------- methods/guest/Cargo.toml | 2 +- relay/Cargo.toml | 2 +- relay/src/lib.rs | 19 +-- relay/src/main.rs | 10 +- 12 files changed, 245 insertions(+), 283 deletions(-) diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index 9db41f29..01f80283 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v3 - name: install rust - uses: risc0/risc0/.github/actions/rustup@42266f0b6bd28de208b7c47b50dd4bcf241f76ce + uses: risc0/risc0/.github/actions/rustup@release-0.19 - name: cargo clean run: cargo clean diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea71fef9..2fd64fea 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,7 +18,7 @@ jobs: submodules: recursive - name: install rust - uses: risc0/risc0/.github/actions/rustup@42266f0b6bd28de208b7c47b50dd4bcf241f76ce + uses: risc0/risc0/.github/actions/rustup@release-0.19 - name: install cargo-sort uses: risc0/cargo-install@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c25a0d08..8664f794 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,11 +30,23 @@ jobs: submodules: recursive - name: install rust - uses: risc0/risc0/.github/actions/rustup@42266f0b6bd28de208b7c47b50dd4bcf241f76ce + uses: risc0/risc0/.github/actions/rustup@release-0.19 - name: Install Foundry uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f + - name: Install cargo-install + uses: risc0/cargo-install@v1 + with: + crate: cargo-binstall + version: "1.4" + + - name: Cargo binstall cargo-risczero + run: cargo binstall -y cargo-risczero@0.19.0 + + - name: risczero toolchain install + run: cargo risczero install + - name: build solidity contracts run: forge build @@ -58,11 +70,23 @@ jobs: submodules: recursive - name: install rust - uses: risc0/risc0/.github/actions/rustup@42266f0b6bd28de208b7c47b50dd4bcf241f76ce + uses: risc0/risc0/.github/actions/rustup@release-0.19 - name: Install Foundry uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f + - name: Install cargo-install + uses: risc0/cargo-install@v1 + with: + crate: cargo-binstall + version: "1.4" + + - name: Cargo binstall cargo-risczero + run: cargo binstall -y cargo-risczero@0.19.0 + + - name: risczero toolchain install + run: cargo risczero install + - name: build solidity contracts run: forge build diff --git a/Cargo.lock b/Cargo.lock index ce171a2b..6d3651d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,12 +28,21 @@ name = "addr2line" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli 0.27.3", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "cpp_demangle", "fallible-iterator", - "gimli", + "gimli 0.28.0", "memmap2", - "object", + "object 0.32.1", "rustc-demangle", "smallvec", ] @@ -279,12 +288,12 @@ version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ - "addr2line", + "addr2line 0.20.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.31.1", "rustc-demangle", ] @@ -406,7 +415,7 @@ dependencies = [ [[package]] name = "bonsai-ethereum-contracts" version = "0.1.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "ethers", @@ -415,7 +424,7 @@ dependencies = [ [[package]] name = "bonsai-ethereum-relay" version = "0.1.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "async-trait", @@ -434,19 +443,14 @@ dependencies = [ "pin-project", "reqwest", "risc0-zkvm", - "rusoto_core", - "rusoto_kms", - "semver", "serde", "serde_json", - "snafu", "thiserror", "tokio", "tokio-stream", "tower-http", "tracing", "tracing-subscriber", - "typed-builder", "utoipa", "utoipa-swagger-ui", "validator", @@ -474,31 +478,26 @@ dependencies = [ [[package]] name = "bonsai-rest-api-mock" version = "0.1.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "axum", "bincode", "bonsai-sdk", - "displaydoc", "hex", - "hyper", "risc0-zkvm", - "serde", "serde_json", "thiserror", "tokio", - "tokio-stream", "tower-http", "tracing", - "tracing-subscriber", "uuid 1.4.1", ] [[package]] name = "bonsai-sdk" -version = "0.4.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.5.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "reqwest", "serde", @@ -1057,10 +1056,10 @@ dependencies = [ ] [[package]] -name = "doc-comment" -version = "0.3.3" +name = "docker-generate" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +checksum = "ccf673e0848ef09fa4aeeba78e681cf651c0c7d35f76ee38cec8e55bc32fa111" [[package]] name = "downcast-rs" @@ -1068,6 +1067,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "downloader" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05213e96f184578b5f70105d4d0a644a168e99e12d7bea0b200c15d67b5c182" +dependencies = [ + "digest 0.10.7", + "futures", + "rand", + "reqwest", + "thiserror", + "tokio", +] + [[package]] name = "dunce" version = "1.0.4" @@ -1524,9 +1537,9 @@ dependencies = [ [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fastrand" @@ -1784,6 +1797,12 @@ name = "gimli" version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" dependencies = [ "fallible-iterator", "stable_deref_trait", @@ -2572,6 +2591,15 @@ name = "object" version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "flate2", "memchr", @@ -3265,8 +3293,8 @@ dependencies = [ [[package]] name = "risc0-binfmt" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "elf", @@ -3278,34 +3306,65 @@ dependencies = [ [[package]] name = "risc0-build" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ + "anyhow", "cargo_metadata 0.17.0", + "docker-generate", "risc0-binfmt", "risc0-zkp", "risc0-zkvm-platform", "serde", "serde_json", + "tempfile", ] [[package]] name = "risc0-build-kernel" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "cc", "directories", - "glob", "hex", "sha2 0.10.7", "tempfile", ] +[[package]] +name = "risc0-circuit-recursion" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" +dependencies = [ + "anyhow", + "bytemuck", + "downloader", + "log", + "rand", + "rayon", + "risc0-circuit-recursion-sys", + "risc0-core", + "risc0-zkp", + "sha2 0.10.7", + "tracing", + "zip", +] + +[[package]] +name = "risc0-circuit-recursion-sys" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" +dependencies = [ + "glob", + "risc0-build-kernel", + "risc0-core", +] + [[package]] name = "risc0-circuit-rv32im" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "log", @@ -3313,7 +3372,6 @@ dependencies = [ "rayon", "risc0-circuit-rv32im-sys", "risc0-core", - "risc0-sys", "risc0-zkp", "risc0-zkvm-platform", "tracing", @@ -3321,19 +3379,18 @@ dependencies = [ [[package]] name = "risc0-circuit-rv32im-sys" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "glob", "risc0-build-kernel", "risc0-core", - "risc0-sys", ] [[package]] name = "risc0-core" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "bytemuck", "rand_core", @@ -3341,19 +3398,16 @@ dependencies = [ [[package]] name = "risc0-sys" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ - "cc", - "glob", "risc0-build-kernel", - "risc0-core", ] [[package]] name = "risc0-zkp" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "blake2", @@ -3378,10 +3432,10 @@ dependencies = [ [[package]] name = "risc0-zkvm" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ - "addr2line", + "addr2line 0.21.0", "anyhow", "bincode", "bonsai-sdk", @@ -3393,33 +3447,37 @@ dependencies = [ "getrandom", "hex", "lazy-regex", - "libm", "log", "num-derive", "num-traits", "prost", "prost-build", "protobuf-src", - "rand", "rayon", "risc0-binfmt", + "risc0-circuit-recursion", "risc0-circuit-rv32im", "risc0-core", "risc0-zkp", "risc0-zkvm-platform", "rrs-lib", + "semver", "serde", "sha2 0.10.7", "tempfile", - "thiserror", "tracing", "typetag", ] [[package]] name = "risc0-zkvm-platform" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?rev=4652f9c#4652f9c4333dff162743911a67a5103f01ded5dc" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" +dependencies = [ + "bytemuck", + "getrandom", + "libm", +] [[package]] name = "rlp" @@ -3678,12 +3736,12 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ruzstd" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a15e661f0f9dac21f3494fe5d23a6338c0ac116a2d22c2b63010acd89467ffe" +checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" dependencies = [ "byteorder", - "thiserror", + "thiserror-core", "twox-hash", ] @@ -4001,28 +4059,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" -[[package]] -name = "snafu" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "socket2" version = "0.4.9" @@ -4219,6 +4255,26 @@ dependencies = [ "thiserror-impl", ] +[[package]] +name = "thiserror-core" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +dependencies = [ + "thiserror-core-impl", +] + +[[package]] +name = "thiserror-core-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "thiserror-impl" version = "1.0.44" @@ -4586,17 +4642,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "typed-builder" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6179333b981641242a768f30f371c9baccbfcc03749627000c500ab88bf4528b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "typenum" version = "1.16.0" diff --git a/Cargo.toml b/Cargo.toml index 59af558c..7a57dab6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,10 +3,10 @@ members = ["methods", "relay"] resolver = "2" [workspace.dependencies] -risc0-build = { git = "https://github.com/risc0/risc0", rev = "4652f9c" } -risc0-zkvm = { git = "https://github.com/risc0/risc0", rev = "4652f9c", default-features = false } -bonsai-sdk = { git = "https://github.com/risc0/risc0", rev = "4652f9c" } -bonsai-ethereum-relay = { git = "https://github.com/risc0/risc0", rev = "4652f9c" } +risc0-build = { git = "https://github.com/risc0/risc0", branch = "release-0.19" } +risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "release-0.19", default-features = false } +bonsai-sdk = { git = "https://github.com/risc0/risc0", branch = "release-0.19" } +bonsai-ethereum-relay = { git = "https://github.com/risc0/risc0", branch = "release-0.19" } methods = { path = "./methods", package = "bonsai-starter-methods" } # Always optimize; building and running the guest takes much longer without optimization. diff --git a/README.md b/README.md index 98011eb6..1eed6f75 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ First, [install Rust] and [Foundry], and then restart your terminal. Next, you w cargo install cargo-risczero ``` -For the above commands to build successfully you will need to have installed the required dependencies. +For the above commands to build successfully you will need to have installed the required dependencies. ```bash sudo apt install curl build-essential libssl-dev pkgconf @@ -29,9 +29,9 @@ cargo risczero install ``` ## Quick Start -First, install the RISC Zero toolchain using the instructions above. +First, install the RISC Zero toolchain using the instructions above. -Now, you can initialize a new Bonsai project at a location of your choosing: +Now, you can initialize a new Bonsai project at a location of your choosing: ```bash forge init -t risc0/bonsai-foundry-template ./my-project @@ -48,7 +48,7 @@ Your new project consists of: ### Test Your Project - Use `cargo build` to test compilation of your zkVM program. -- Use `cargo test` to run the tests in your zkVM program. +- Use `cargo test` to run the tests in your zkVM program. - Use `forge test` to test your Solidity contracts and their interaction with your zkVM program. ### Configuring Bonsai @@ -69,7 +69,7 @@ RISC0_DEV_MODE=false forge test ``` ## Next Steps -To build your application, you'll need to make changes in two folders: +To build your application, you'll need to make changes in two folders: - write the code you want proven in the [methods] folder - write the on-chain part of your project in the [contracts] folder diff --git a/lib/risc0 b/lib/risc0 index 4652f9c4..6cb217a2 160000 --- a/lib/risc0 +++ b/lib/risc0 @@ -1 +1 @@ -Subproject commit 4652f9c4333dff162743911a67a5103f01ded5dc +Subproject commit 6cb217a2716e7330690bfc154560d1566dc37266 diff --git a/methods/guest/Cargo.lock b/methods/guest/Cargo.lock index 2f5fb533..32aca03f 100644 --- a/methods/guest/Cargo.lock +++ b/methods/guest/Cargo.lock @@ -14,18 +14,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - [[package]] name = "blake2" version = "0.10.6" @@ -79,15 +67,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -138,31 +117,16 @@ dependencies = [ ] [[package]] -name = "elf" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" - -[[package]] -name = "errno" -version = "0.3.3" +name = "downcast-rs" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "elf" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] +checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" [[package]] name = "ethabi" @@ -186,12 +150,6 @@ dependencies = [ "uint", ] -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - [[package]] name = "fixed-hash" version = "0.8.0" @@ -251,12 +209,6 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" -[[package]] -name = "linux-raw-sys" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" - [[package]] name = "log" version = "0.4.20" @@ -334,19 +286,10 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "risc0-binfmt" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "elf", @@ -356,10 +299,23 @@ dependencies = [ "serde", ] +[[package]] +name = "risc0-circuit-recursion" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" +dependencies = [ + "anyhow", + "bytemuck", + "log", + "risc0-core", + "risc0-zkp", + "tracing", +] + [[package]] name = "risc0-circuit-rv32im" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "log", @@ -371,8 +327,8 @@ dependencies = [ [[package]] name = "risc0-core" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "bytemuck", "rand_core", @@ -380,8 +336,8 @@ dependencies = [ [[package]] name = "risc0-zkp" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "blake2", @@ -400,32 +356,48 @@ dependencies = [ [[package]] name = "risc0-zkvm" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" dependencies = [ "anyhow", "bytemuck", "cfg-if", "getrandom", "hex", - "libm", "log", "num-derive", "num-traits", "risc0-binfmt", + "risc0-circuit-recursion", "risc0-circuit-rv32im", "risc0-core", "risc0-zkp", "risc0-zkvm-platform", + "rrs-lib", + "semver", "serde", - "tempfile", "tracing", ] [[package]] name = "risc0-zkvm-platform" -version = "0.18.0" -source = "git+https://github.com/risc0/risc0?branch=release-0.18#29cc16f84e1f5f2af34120528b1f18a33e00ce71" +version = "0.19.0" +source = "git+https://github.com/risc0/risc0?branch=release-0.19#6cb217a2716e7330690bfc154560d1566dc37266" +dependencies = [ + "bytemuck", + "getrandom", + "libm", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] [[package]] name = "rustc-hex" @@ -434,17 +406,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] -name = "rustix" -version = "0.38.13" +name = "semver" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" @@ -510,19 +475,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - [[package]] name = "tracing" version = "0.1.37" @@ -587,69 +539,3 @@ name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/methods/guest/Cargo.toml b/methods/guest/Cargo.toml index 1e39e38c..b5bcab13 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 = { git = "https://github.com/risc0/risc0", branch = "release-0.18", default-features = false, features = ["std"] } +risc0-zkvm = { git = "https://github.com/risc0/risc0", branch = "release-0.19", 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 d081a5c9..8746dc37 100644 --- a/relay/Cargo.toml +++ b/relay/Cargo.toml @@ -16,5 +16,5 @@ ethers-signers = { version = "2.0", features = ["aws"] } hex = "0.4.3" methods = { workspace = true } risc0-build = { workspace = true, features = ["guest-list"] } -risc0-zkvm = { workspace = true, default-features = false, features = ["prove"] } +risc0-zkvm = { workspace = true, default-features = false } tokio = { version = "1.19", features = ["full", "sync"] } diff --git a/relay/src/lib.rs b/relay/src/lib.rs index 333011da..51861478 100644 --- a/relay/src/lib.rs +++ b/relay/src/lib.rs @@ -17,11 +17,13 @@ use std::time::Duration; use anyhow::{anyhow, bail, Context, Result}; use bonsai_sdk::alpha::{responses::SnarkReceipt, Client}; use risc0_build::GuestListEntry; -use risc0_zkvm::{Executor, ExecutorEnv, MemoryImage, Program, Receipt, MEM_SIZE, PAGE_SIZE}; +use risc0_zkvm::{ + default_executor, ExecutorEnv, Journal, MemoryImage, Program, Receipt, GUEST_MAX_MEM, PAGE_SIZE, +}; /// Result of executing a guest image, possibly containing a proof. pub enum Output { - Execution { journal: Vec }, + Execution { journal: Journal }, Bonsai { snark_receipt: SnarkReceipt }, } @@ -31,13 +33,13 @@ 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() - .add_input(&input) + .write_slice(&input) .build() .context("Failed to build exec env")?; - let mut exec = Executor::from_elf(env, elf).context("Failed to instantiate executor")?; + let exec = default_executor(); let session = exec - .run() - .context(format!("Failed to run executor {:?}", &input))?; + .execute_elf(env, elf) + .with_context(|| format!("Failed to run executor {:?}", &input))?; Ok(Output::Execution { journal: session.journal, @@ -47,13 +49,14 @@ pub fn execute_locally(elf: &[u8], input: Vec) -> Result { pub const POLL_INTERVAL_SEC: u64 = 4; fn get_digest(elf: &[u8]) -> Result { - let program = Program::load_elf(elf, MEM_SIZE as u32)?; + 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())) } pub fn prove_alpha(elf: &[u8], input: Vec) -> Result { - let client = Client::from_env().context("Failed to create client from env var")?; + let client = + 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())?; diff --git a/relay/src/main.rs b/relay/src/main.rs index 56597316..70fd8c6f 100644 --- a/relay/src/main.rs +++ b/relay/src/main.rs @@ -122,7 +122,7 @@ async fn main() -> anyhow::Result<()> { .context("failed to resolve image output")?; match (dev_mode, output) { (true, Output::Execution { journal }) => { - vec![Token::Bytes(journal)] + vec![Token::Bytes(journal.bytes)] } (false, Output::Bonsai { snark_receipt }) => { vec![ @@ -234,8 +234,12 @@ async fn upload_images( ))); // upload binary to Bonsai - let bonsai_client = - get_client_from_parts(bonsai_api_url.to_string(), bonsai_api_key.to_string()).await?; + let bonsai_client = get_client_from_parts( + bonsai_api_url.to_string(), + bonsai_api_key.to_string(), + risc0_zkvm::VERSION, + ) + .await?; let img_id = image_id.clone(); upload_img(