From 5594b3fe1e8eebec478cd65df5fd16cded94eb16 Mon Sep 17 00:00:00 2001 From: oskarth Date: Mon, 19 Feb 2024 11:23:31 +0800 Subject: [PATCH] chore(core): Assert files exists --- mopro-core/build.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mopro-core/build.rs b/mopro-core/build.rs index d999b429..9626a472 100644 --- a/mopro-core/build.rs +++ b/mopro-core/build.rs @@ -73,6 +73,7 @@ fn build_dylib(wasm_path: String, dylib_name: String) -> Result<()> { Ok(()) } + fn build_circuit(config: &Config) -> Result<()> { let project_dir = env::var("CARGO_MANIFEST_DIR")?; let circuit_dir = &config.circuit.dir; @@ -91,6 +92,17 @@ fn build_circuit(config: &Config) -> Result<()> { circuit_dir, circuit_name )); + // TODO: Improve this to be more user-friendly + assert!( + zkey_path.exists(), + "Make sure the zkey file exists. Did you forget to run a trusted setup? Adjust prepare.sh if necessary." + ); + assert!( + wasm_path.exists(), + "Make sure the wasm file exists. Did you forget to compile the circuit to wasm? Adjust prepare.sh if necessary." + ); + assert!(arkzkey_path.exists(), "Make sure the arkzkey file exists. Did you forget to generate the arkzkey? Adjust prepare.sh if necessary."); + println!("cargo:warning=zkey_file: {}", zkey_path.display()); println!("cargo:warning=wasm_file: {}", wasm_path.display()); println!("cargo:warning=arkzkey_file: {}", arkzkey_path.display());