diff --git a/host-program/mem-alloc-vec/build.rs b/host-program/mem-alloc-vec/build.rs index 5913df6..044ace5 100644 --- a/host-program/mem-alloc-vec/build.rs +++ b/host-program/mem-alloc-vec/build.rs @@ -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); } diff --git a/host-program/mem-alloc-vec/src/main.rs b/host-program/mem-alloc-vec/src/main.rs index 5855559..565aa7c 100644 --- a/host-program/mem-alloc-vec/src/main.rs +++ b/host-program/mem-alloc-vec/src/main.rs @@ -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(); @@ -31,7 +26,7 @@ async fn main() -> Result<()> { .and_then(|seg| seg.parse::().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()); diff --git a/host-program/revme/build.rs b/host-program/revme/build.rs index 1e87a7a..8ce911c 100644 --- a/host-program/revme/build.rs +++ b/host-program/revme/build.rs @@ -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); } diff --git a/host-program/revme/src/main.rs b/host-program/revme/src/main.rs index bcf12f6..ca532dc 100644 --- a/host-program/revme/src/main.rs +++ b/host-program/revme/src/main.rs @@ -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<()> { @@ -30,7 +26,7 @@ async fn main() -> Result<()> { .and_then(|seg| seg.parse::().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()); diff --git a/host-program/sha2-go/src/main.rs b/host-program/sha2-go/src/main.rs index 21b5d41..90d4f19 100644 --- a/host-program/sha2-go/src/main.rs +++ b/host-program/sha2-go/src/main.rs @@ -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" ); @@ -31,7 +31,7 @@ async fn main() -> Result<()> { .and_then(|seg| seg.parse::().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()); diff --git a/host-program/sha2-rust/build.rs b/host-program/sha2-rust/build.rs index c7212e6..b7a85aa 100644 --- a/host-program/sha2-rust/build.rs +++ b/host-program/sha2-rust/build.rs @@ -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); } diff --git a/host-program/sha2-rust/src/main.rs b/host-program/sha2-rust/src/main.rs index 4411605..1e36bbe 100644 --- a/host-program/sha2-rust/src/main.rs +++ b/host-program/sha2-rust/src/main.rs @@ -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(); @@ -32,7 +27,7 @@ async fn main() -> Result<()> { .and_then(|seg| seg.parse::().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());