From 6bd720f3f16d4fa15dfb77131bbee28cc348df35 Mon Sep 17 00:00:00 2001 From: Victor Graf Date: Thu, 15 Feb 2024 17:28:00 -0800 Subject: [PATCH] fix up build and use local clone of risc0-ethereum --- Cargo.lock | 62 +++++++++++++++++++++++----------------------- Cargo.toml | 8 ++++-- methods/Cargo.toml | 4 +-- methods/build.rs | 9 ++++--- 4 files changed, 43 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f269f713..83f80a71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -625,6 +625,7 @@ dependencies = [ "alloy-sol-types", "hex", "risc0-build", + "risc0-zkp 0.20.1", "risc0-zkvm", ] @@ -3110,37 +3111,37 @@ checksum = "9d263c6370d7714d2a634b6d88deb3871d0fad1f9486a9da6d48139c1ac85b26" dependencies = [ "anyhow", "elf", - "risc0-zkp 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-zkp 0.20.1", + "risc0-zkvm-platform 0.20.1", "serde", "tracing", ] [[package]] name = "risc0-binfmt" -version = "0.20.1" -source = "git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20#74c59219f487f6963cff883d69c344088358891f" +version = "0.21.0-alpha.1" +source = "git+https://github.com/risc0/risc0?rev=7f73166#7f731662eaeb2d91b332cf85d4cbd61c87fc5c67" dependencies = [ "anyhow", "elf", - "risc0-zkp 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", - "risc0-zkvm-platform 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", + "risc0-zkp 0.21.0-alpha.1", + "risc0-zkvm-platform 0.21.0-alpha.1", "serde", "tracing", ] [[package]] name = "risc0-build" -version = "0.20.1" -source = "git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20#74c59219f487f6963cff883d69c344088358891f" +version = "0.21.0-alpha.1" +source = "git+https://github.com/risc0/risc0?rev=7f73166#7f731662eaeb2d91b332cf85d4cbd61c87fc5c67" dependencies = [ "anyhow", "cargo-platform", "cargo_metadata 0.17.0", "docker-generate", - "risc0-binfmt 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", - "risc0-zkp 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", - "risc0-zkvm-platform 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", + "risc0-binfmt 0.21.0-alpha.1", + "risc0-zkp 0.21.0-alpha.1", + "risc0-zkvm-platform 0.21.0-alpha.1", "serde", "serde_json", "tempfile", @@ -3155,8 +3156,8 @@ dependencies = [ "anyhow", "bytemuck", "hex", - "risc0-core 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-core 0.20.1", + "risc0-zkp 0.20.1", "tracing", ] @@ -3167,9 +3168,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb1caa759ab74d08779e062fcf98f5bd34397dfde572516a52369f0ec46db650" dependencies = [ "anyhow", - "risc0-core 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-core 0.20.1", + "risc0-zkp 0.20.1", + "risc0-zkvm-platform 0.20.1", "tracing", ] @@ -3185,8 +3186,8 @@ dependencies = [ [[package]] name = "risc0-core" -version = "0.20.1" -source = "git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20#74c59219f487f6963cff883d69c344088358891f" +version = "0.21.0-alpha.1" +source = "git+https://github.com/risc0/risc0?rev=7f73166#7f731662eaeb2d91b332cf85d4cbd61c87fc5c67" dependencies = [ "bytemuck", "rand_core", @@ -3195,7 +3196,6 @@ dependencies = [ [[package]] name = "risc0-ethereum-contracts" version = "0.7.0-alpha.1" -source = "git+http://github.com/risc0/risc0-ethereum?rev=3be9ef901d723e8f3efd4536bcd742f33d6fb16d#3be9ef901d723e8f3efd4536bcd742f33d6fb16d" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -3217,8 +3217,8 @@ dependencies = [ "hex", "paste", "rand_core", - "risc0-core 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-core 0.20.1", + "risc0-zkvm-platform 0.20.1", "serde", "sha2", "tracing", @@ -3226,8 +3226,8 @@ dependencies = [ [[package]] name = "risc0-zkp" -version = "0.20.1" -source = "git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20#74c59219f487f6963cff883d69c344088358891f" +version = "0.21.0-alpha.1" +source = "git+https://github.com/risc0/risc0?rev=7f73166#7f731662eaeb2d91b332cf85d4cbd61c87fc5c67" dependencies = [ "anyhow", "blake2", @@ -3236,8 +3236,8 @@ dependencies = [ "hex", "paste", "rand_core", - "risc0-core 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", - "risc0-zkvm-platform 0.20.1 (git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20)", + "risc0-core 0.21.0-alpha.1", + "risc0-zkvm-platform 0.21.0-alpha.1", "serde", "sha2", "tracing", @@ -3266,12 +3266,12 @@ dependencies = [ "prost", "prost-build", "protobuf-src", - "risc0-binfmt 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-binfmt 0.20.1", "risc0-circuit-recursion", "risc0-circuit-rv32im", - "risc0-core 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkp 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", - "risc0-zkvm-platform 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "risc0-core 0.20.1", + "risc0-zkp 0.20.1", + "risc0-zkvm-platform 0.20.1", "rrs-lib", "semver 1.0.21", "serde", @@ -3292,8 +3292,8 @@ dependencies = [ [[package]] name = "risc0-zkvm-platform" -version = "0.20.1" -source = "git+http://github.com/risc0/risc0?branch=capossele/foundry-template-0.20#74c59219f487f6963cff883d69c344088358891f" +version = "0.21.0-alpha.1" +source = "git+https://github.com/risc0/risc0?rev=7f73166#7f731662eaeb2d91b332cf85d4cbd61c87fc5c67" [[package]] name = "rlp" diff --git a/Cargo.toml b/Cargo.toml index eecf98f1..277b539c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [workspace] resolver = "2" members = ["apps", "methods"] +exclude = ["lib"] [workspace.package] version = "0.1.0" @@ -17,9 +18,12 @@ ethers = { version = "2.0" } hex = { version = "0.4" } log = { version = "0.4" } methods = { path = "./methods", package = "bonsai-starter-methods" } -risc0-build = { git = "http://github.com/risc0/risc0", branch = "capossele/foundry-template-0.20", features = ["guest-list", "docker"] } -risc0-ethereum-contracts = { git = "http://github.com/risc0/risc0-ethereum", rev = "3be9ef901d723e8f3efd4536bcd742f33d6fb16d" } +# DO NOT MERGE: Figure out what reference to use for this. Cherry pick to the release branch? +risc0-build = { git = "https://github.com/risc0/risc0", rev = "7f73166", features = ["docker"] } +# NOTE: Forge requires risc0-ethereum as a submodule, so we reuse it here as a path dependency. +risc0-ethereum-contracts = { path = "lib/risc0-ethereum/contracts" } risc0-zkvm = { version = "0.20", default-features = false } +risc0-zkp = { version = "0.20", default-features = false } serde = { version = "1.0", features = ["derive", "std"] } [profile.release] diff --git a/methods/Cargo.toml b/methods/Cargo.toml index 31c2b7dd..845a8279 100644 --- a/methods/Cargo.toml +++ b/methods/Cargo.toml @@ -9,9 +9,7 @@ methods = ["guest"] [build-dependencies] hex = { workspace = true } risc0-build = { workspace = true } - -[dependencies] -risc0-build = { workspace = true } +risc0-zkp = { workspace = true } [dev-dependencies] alloy-primitives = { workspace = true } diff --git a/methods/build.rs b/methods/build.rs index 887e9d9a..728bb5b8 100644 --- a/methods/build.rs +++ b/methods/build.rs @@ -15,6 +15,7 @@ use std::{collections::HashMap, env, fs, process::Command}; use risc0_build::{embed_methods_with_options, DockerOptions, GuestOptions}; +use risc0_zkp::core::digest::Digest; const SOL_HEADER: &str = r#"// Copyright 2024 RISC Zero, Inc. // @@ -66,12 +67,12 @@ fn main() { .iter() .map(|method| { let name = method.name.to_uppercase().replace('-', "_"); - let image_id = hex::encode(method.make_image_id()); + let image_id = hex::encode(Digest::from(method.image_id)); let image_id_declaration = format!("bytes32 public constant {name}_ID = bytes32(0x{image_id});"); - let elf = method.elf_path.to_string_lossy().to_string(); - let elf_declaration = format!("string public constant {name}_PATH = \"{elf}\";"); + let elf_path = method.path.to_string(); + let elf_declaration = format!("string public constant {name}_PATH = \"{elf_path}\";"); (image_id_declaration, elf_declaration) }) @@ -82,7 +83,7 @@ fn main() { // Building the final image_ID file content. let file_content = format!("{SOL_HEADER}{IMAGE_ID_LIB_HEADER}\n{image_ids}\n}}"); - fs::write(SOLIDITY_IMAGE_ID_PATH, &file_content).unwrap_or_else(|err| { + fs::write(SOLIDITY_IMAGE_ID_PATH, file_content).unwrap_or_else(|err| { panic!( "failed to save changes to {}: {}", SOLIDITY_IMAGE_ID_PATH, err