Skip to content

Commit a0deba3

Browse files
committed
fix: call prove-snark twice as the first may fail for dark reasons
1 parent bfc3d5b commit a0deba3

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

aggregation_mode/proof_aggregator/src/aggregators/zisk_aggregator.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,26 @@ pub(crate) fn run_chunk_aggregator(
208208
let stark_proof_path = format!("{OUTPUT_PATH}/vadcop_final_proof.bin");
209209
let home_dir = std::env::var("HOME").expect("HOME environment variable not set");
210210
let proving_key_path = format!("{home_dir}/{PROVING_KEY_SNARK_DIR}");
211-
let mut snark_command = std::process::Command::new("cargo-zisk");
212-
let snark_status = snark_command
213-
.env("RUSTC", &zisk_rustc_path)
214-
.args([
215-
"prove-snark",
216-
"-p",
217-
&stark_proof_path,
218-
"-k",
219-
&proving_key_path,
220-
"-o",
221-
SNARK_OUTPUT_PATH,
222-
])
223-
.current_dir(ZISK_PROGRAMS_DIR)
224-
.status()?;
211+
let snark_status = {
212+
let mut run_snark = || {
213+
std::process::Command::new("cargo-zisk")
214+
.env("RUSTC", &zisk_rustc_path)
215+
.args([
216+
"prove-snark",
217+
"-p",
218+
&stark_proof_path,
219+
"-k",
220+
&proving_key_path,
221+
"-o",
222+
SNARK_OUTPUT_PATH,
223+
])
224+
.current_dir(ZISK_PROGRAMS_DIR)
225+
.status()
226+
};
227+
// Dark magic: the first run tends to fail, while the second succeeds.
228+
let _ = run_snark()?;
229+
run_snark()?
230+
};
225231

226232
if !snark_status.success() {
227233
return Err(AlignedZiskError::Aggregation(format!(

0 commit comments

Comments
 (0)