From 195b56032e399fb04a0e0e28163ea29044b63922 Mon Sep 17 00:00:00 2001 From: smtmfft <99081233+smtmfft@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:07:27 +0800 Subject: [PATCH] use runtime env::var to avoid compiling time error. (#65) * use runtime env::var * using expect instead of unwrap --- raiko-host/src/prover/proof/risc0/snarks.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/raiko-host/src/prover/proof/risc0/snarks.rs b/raiko-host/src/prover/proof/risc0/snarks.rs index c46dfa1e..131c153b 100644 --- a/raiko-host/src/prover/proof/risc0/snarks.rs +++ b/raiko-host/src/prover/proof/risc0/snarks.rs @@ -85,10 +85,11 @@ pub async fn verify_groth16_snark( image_id: Digest, snark_receipt: SnarkReceipt, ) -> anyhow::Result<()> { - let verifier_rpc_url = env!("GROTH16_VERIFIER_RPC_URL"); + let verifier_rpc_url = + std::env::var("GROTH16_VERIFIER_RPC_URL").expect("env GROTH16_VERIFIER_RPC_URL"); let groth16_verifier_addr = { - let addr = env!("GROTH16_VERIFIER_ADDRESS"); - H160::from_str(addr).unwrap() + let addr = std::env::var("GROTH16_VERIFIER_ADDRESS").expect("env GROTH16_VERIFIER_RPC_URL"); + H160::from_str(&addr).unwrap() }; let http_client = Arc::new(Provider::>::new_client(