From 39335b4d433d5d28de5954d7fa4147d1040b30d1 Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Wed, 7 Aug 2024 20:23:24 +0530 Subject: [PATCH 1/2] set env var at runtime --- zero_bin/verifier/src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zero_bin/verifier/src/main.rs b/zero_bin/verifier/src/main.rs index e14ad7827..ec0ed0cd4 100644 --- a/zero_bin/verifier/src/main.rs +++ b/zero_bin/verifier/src/main.rs @@ -12,10 +12,23 @@ use zero_bin_common::version; mod cli; mod init; +const EVM_ARITHMETIZATION_PKG_VER: &str = "EVM_ARITHMETIZATION_PKG_VER"; + fn main() -> Result<()> { dotenv().ok(); init::tracing(); + if env::var_os(EVM_ARITHMETIZATION_PKG_VER).is_none() { + // Safety: + // - we're early enough in main that nothing else should race + unsafe { + env::set_var( + EVM_ARITHMETIZATION_PKG_VER, + env!("EVM_ARITHMETIZATION_PKG_VER"), + ); + } + } + let args: Vec = env::args().collect(); if args.contains(&"--version".to_string()) { version::print_version( From cf3da2b8eb9c1de0d613c891314e6679e0ea45db Mon Sep 17 00:00:00 2001 From: Arpit Temani Date: Wed, 7 Aug 2024 21:28:58 +0530 Subject: [PATCH 2/2] env var already set at compiletime --- zero_bin/common/src/prover_state/persistence.rs | 8 ++++---- zero_bin/verifier/src/main.rs | 13 ------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/zero_bin/common/src/prover_state/persistence.rs b/zero_bin/common/src/prover_state/persistence.rs index 87eb7d1ae..750726696 100644 --- a/zero_bin/common/src/prover_state/persistence.rs +++ b/zero_bin/common/src/prover_state/persistence.rs @@ -109,7 +109,7 @@ impl DiskResource for BaseProverResource { "{}/{}_base_{}_{}", &relative_circuit_dir_path(), PROVER_STATE_FILE_PREFIX, - env::var("EVM_ARITHMETIZATION_PKG_VER").unwrap_or("NA".to_string()), + env!("EVM_ARITHMETIZATION_PKG_VER"), p.get_configuration_digest() ) } @@ -145,7 +145,7 @@ impl DiskResource for MonolithicProverResource { "{}/{}_monolithic_{}_{}", &relative_circuit_dir_path(), PROVER_STATE_FILE_PREFIX, - env::var("EVM_ARITHMETIZATION_PKG_VER").unwrap_or("NA".to_string()), + env!("EVM_ARITHMETIZATION_PKG_VER"), p.get_configuration_digest() ) } @@ -180,7 +180,7 @@ impl DiskResource for RecursiveCircuitResource { "{}/{}_{}_{}_{}", &relative_circuit_dir_path(), PROVER_STATE_FILE_PREFIX, - env::var("EVM_ARITHMETIZATION_PKG_VER").unwrap_or("NA".to_string()), + env!("EVM_ARITHMETIZATION_PKG_VER"), circuit_type.as_short_str(), size ) @@ -224,7 +224,7 @@ impl DiskResource for VerifierResource { "{}/{}_{}_{}", &relative_circuit_dir_path(), VERIFIER_STATE_FILE_PREFIX, - env::var("EVM_ARITHMETIZATION_PKG_VER").unwrap_or("NA".to_string()), + env!("EVM_ARITHMETIZATION_PKG_VER"), p.get_configuration_digest() ) } diff --git a/zero_bin/verifier/src/main.rs b/zero_bin/verifier/src/main.rs index ec0ed0cd4..e14ad7827 100644 --- a/zero_bin/verifier/src/main.rs +++ b/zero_bin/verifier/src/main.rs @@ -12,23 +12,10 @@ use zero_bin_common::version; mod cli; mod init; -const EVM_ARITHMETIZATION_PKG_VER: &str = "EVM_ARITHMETIZATION_PKG_VER"; - fn main() -> Result<()> { dotenv().ok(); init::tracing(); - if env::var_os(EVM_ARITHMETIZATION_PKG_VER).is_none() { - // Safety: - // - we're early enough in main that nothing else should race - unsafe { - env::set_var( - EVM_ARITHMETIZATION_PKG_VER, - env!("EVM_ARITHMETIZATION_PKG_VER"), - ); - } - } - let args: Vec = env::args().collect(); if args.contains(&"--version".to_string()) { version::print_version(