Skip to content

Commit

Permalink
fix up build and use local clone of risc0-ethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
nategraf committed Feb 16, 2024
1 parent 39ec285 commit 6bd720f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 40 deletions.
62 changes: 31 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
resolver = "2"
members = ["apps", "methods"]
exclude = ["lib"]

[workspace.package]
version = "0.1.0"
Expand All @@ -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]
Expand Down
4 changes: 1 addition & 3 deletions methods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
9 changes: 5 additions & 4 deletions methods/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down Expand Up @@ -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)
})
Expand All @@ -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
Expand Down

0 comments on commit 6bd720f

Please sign in to comment.