Skip to content

Commit

Permalink
Update guest target path
Browse files Browse the repository at this point in the history
  • Loading branch information
xander42280 committed Dec 16, 2024
1 parent c544e1d commit 70fe7fa
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 27 deletions.
12 changes: 10 additions & 2 deletions host-program/mem-alloc-vec/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
fn main() {
zkm_build::build_program(&format!(
let guest_path = format!(
"{}/../../guest-program/mem-alloc-vec",
env!("CARGO_MANIFEST_DIR")
));
);
zkm_build::build_program(&guest_path);
let guest_target_path = format!(
"{}/{}/{}",
guest_path,
zkm_build::DEFAULT_OUTPUT_DIR,
zkm_build::BUILD_TARGET
);
println!("cargo:rustc-env=GUEST_TARGET_PATH={}", guest_target_path);
}
7 changes: 1 addition & 6 deletions host-program/mem-alloc-vec/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ use zkm_sdk::{prover::ClientCfg, prover::ProverInput, ProverClient};
pub const DEFAULT_PROVER_NETWORK_RPC: &str = "https://152.32.186.45:20002";
pub const DEFALUT_PROVER_NETWORK_DOMAIN: &str = "stage";

const ELF_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../guest-program/mem-alloc-vec/elf/mips-unknown-linux-musl"
);

#[tokio::main]
async fn main() -> Result<()> {
env_logger::try_init().unwrap_or_default();
Expand All @@ -31,7 +26,7 @@ async fn main() -> Result<()> {
.and_then(|seg| seg.parse::<bool>().ok())
.unwrap_or(false);

let elf_path = env::var("ELF_PATH").unwrap_or(ELF_PATH.to_string());
let elf_path = env::var("ELF_PATH").unwrap_or(env!("GUEST_TARGET_PATH").to_string());
let proof_results_path = env::var("PROOF_RESULTS_PATH").unwrap_or("../contracts".to_string());
let vk_path = env::var("VERIFYING_KEY_PATH").unwrap_or("/tmp/input".to_string());

Expand Down
13 changes: 9 additions & 4 deletions host-program/revme/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
fn main() {
zkm_build::build_program(&format!(
"{}/../../guest-program/revme",
env!("CARGO_MANIFEST_DIR")
));
let guest_path = format!("{}/../../guest-program/revme", env!("CARGO_MANIFEST_DIR"));
zkm_build::build_program(&guest_path);
let guest_target_path = format!(
"{}/{}/{}",
guest_path,
zkm_build::DEFAULT_OUTPUT_DIR,
zkm_build::BUILD_TARGET
);
println!("cargo:rustc-env=GUEST_TARGET_PATH={}", guest_target_path);
}
6 changes: 1 addition & 5 deletions host-program/revme/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ use zkm_sdk::{prover::ClientCfg, prover::ProverInput, ProverClient};

pub const DEFAULT_PROVER_NETWORK_RPC: &str = "https://152.32.186.45:20002";
pub const DEFALUT_PROVER_NETWORK_DOMAIN: &str = "stage";
const ELF_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../guest-program/revme/elf/mips-unknown-linux-musl"
);

#[tokio::main]
async fn main() -> Result<()> {
Expand All @@ -30,7 +26,7 @@ async fn main() -> Result<()> {
.and_then(|seg| seg.parse::<bool>().ok())
.unwrap_or(false);

let elf_path = env::var("ELF_PATH").unwrap_or(ELF_PATH.to_string());
let elf_path = env::var("ELF_PATH").unwrap_or(env!("GUEST_TARGET_PATH").to_string());
let json_path = env::var("JSON_PATH").expect("JSON PATH is missing");
let proof_results_path = env::var("PROOF_RESULTS_PATH").unwrap_or("../contracts".to_string());
let vk_path = env::var("VERIFYING_KEY_PATH").unwrap_or("/tmp/input".to_string());
Expand Down
4 changes: 2 additions & 2 deletions host-program/sha2-go/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use zkm_sdk::{prover::ClientCfg, prover::ProverInput, ProverClient};
pub const DEFAULT_PROVER_NETWORK_RPC: &str = "https://152.32.186.45:20002";
pub const DEFALUT_PROVER_NETWORK_DOMAIN: &str = "stage";

const ELF_PATH: &str = concat!(
const GUEST_TARGET_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../guest-program/sha2-go/sha2-go"
);
Expand All @@ -31,7 +31,7 @@ async fn main() -> Result<()> {
.and_then(|seg| seg.parse::<bool>().ok())
.unwrap_or(false);

let elf_path = env::var("ELF_PATH").unwrap_or(ELF_PATH.to_string());
let elf_path = env::var("ELF_PATH").unwrap_or(GUEST_TARGET_PATH.to_string());
let args_parameter = env::var("ARGS").unwrap_or("data-to-hash".to_string());
//let json_path = env::var("JSON_PATH").expect("JSON PATH is missing");
let proof_results_path = env::var("PROOF_RESULTS_PATH").unwrap_or("../contracts".to_string());
Expand Down
12 changes: 10 additions & 2 deletions host-program/sha2-rust/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
fn main() {
zkm_build::build_program(&format!(
let guest_path = format!(
"{}/../../guest-program/sha2-rust",
env!("CARGO_MANIFEST_DIR")
));
);
zkm_build::build_program(&guest_path);
let guest_target_path = format!(
"{}/{}/{}",
guest_path,
zkm_build::DEFAULT_OUTPUT_DIR,
zkm_build::BUILD_TARGET
);
println!("cargo:rustc-env=GUEST_TARGET_PATH={}", guest_target_path);
}
7 changes: 1 addition & 6 deletions host-program/sha2-rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ use zkm_sdk::{prover::ClientCfg, prover::ProverInput, ProverClient};
pub const DEFAULT_PROVER_NETWORK_RPC: &str = "https://152.32.186.45:20002";
pub const DEFALUT_PROVER_NETWORK_DOMAIN: &str = "stage";

const ELF_PATH: &str = concat!(
env!("CARGO_MANIFEST_DIR"),
"/../../guest-program/sha2-rust/elf/mips-unknown-linux-musl"
);

#[tokio::main]
async fn main() -> Result<()> {
env_logger::try_init().unwrap_or_default();
Expand All @@ -32,7 +27,7 @@ async fn main() -> Result<()> {
.and_then(|seg| seg.parse::<bool>().ok())
.unwrap_or(false);

let elf_path = env::var("ELF_PATH").unwrap_or(ELF_PATH.to_string());
let elf_path = env::var("ELF_PATH").unwrap_or(env!("GUEST_TARGET_PATH").to_string());
let proof_results_path = env::var("PROOF_RESULTS_PATH").unwrap_or("../contracts".to_string());
let vk_path = env::var("VERIFYING_KEY_PATH").unwrap_or("/tmp/input".to_string());

Expand Down

0 comments on commit 70fe7fa

Please sign in to comment.