Skip to content

Commit

Permalink
replace unwrap_unchecked() for expect since still is it possible to g…
Browse files Browse the repository at this point in the history
…et a denominator equal to zero
  • Loading branch information
jotabulacios committed Feb 21, 2025
1 parent 3445ff0 commit de9dce0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion provers/plonk/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ where
* lp(c_i, &(&cpi.domain[i] * &k2));
let den = lp(a_i, &s1[i]) * lp(b_i, &s2[i]) * lp(c_i, &s3[i]);
// We are using that den != 0 with high probability because beta and gamma are random elements.
let new_factor = unsafe { (num / den).unwrap_unchecked() };
let new_factor = (num / den).expect("Unexpected zero denominator in round 2");

let new_term = coefficients.last().unwrap() * &new_factor;
coefficients.push(new_term);
}
Expand Down

0 comments on commit de9dce0

Please sign in to comment.