Skip to content

Commit 777c2c4

Browse files
committed
fix(stark): return pool buffers on prove_rounds_2_to_4 error
Move pool-return (into_columns + move-back) before the error match, so subsequent tables in the same partition get valid buffers even if a prior table's proving fails.
1 parent faf58fb commit 777c2c4

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

crypto/stark/src/prover.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,19 +1974,13 @@ pub trait IsStarkProver<
19741974
.append_field_element(&bpi.table_contribution);
19751975
}
19761976

1977-
let proof = match Self::prove_rounds_2_to_4(
1977+
let proof_result = Self::prove_rounds_2_to_4(
19781978
*air,
19791979
*pub_inputs,
19801980
&round_1_result,
19811981
table_transcript,
19821982
domain,
1983-
) {
1984-
Ok(p) => p,
1985-
Err(e) => {
1986-
results.push(Err(e));
1987-
continue;
1988-
}
1989-
};
1983+
);
19901984

19911985
#[cfg(feature = "instruments")]
19921986
let timing = {
@@ -2002,7 +1996,8 @@ pub trait IsStarkProver<
20021996
)
20031997
};
20041998

2005-
// Return column Vecs to pool
1999+
// Always return column Vecs to pool, even on error,
2000+
// so subsequent tables in this partition get valid buffers.
20062001
let (main_cols, aux_cols) =
20072002
round_1_result.lde_trace.into_columns();
20082003
for (slot, col) in pool_set.main.iter_mut().zip(main_cols) {
@@ -2012,6 +2007,14 @@ pub trait IsStarkProver<
20122007
*slot = col;
20132008
}
20142009

2010+
let proof = match proof_result {
2011+
Ok(p) => p,
2012+
Err(e) => {
2013+
results.push(Err(e));
2014+
continue;
2015+
}
2016+
};
2017+
20152018
#[cfg(feature = "instruments")]
20162019
results.push(Ok((idx, proof, timing)));
20172020
#[cfg(not(feature = "instruments"))]

0 commit comments

Comments
 (0)