Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add assert_satisfied_at_rows_par variant #139

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions halo2_proofs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,7 @@ impl<F: FieldExt> MockProver<F> {

/// Returns `Ok(())` if this `MockProver` is satisfied, or a list of errors indicating
/// the reasons that the circuit is not satisfied.
/// Constraints are only checked at `gate_row_ids`,
/// and lookup inputs are only checked at `lookup_input_row_ids`, parallelly.
/// Constraints are only checked at `gate_row_ids`, and lookup inputs are only checked at `lookup_input_row_ids`, parallelly.
pub fn verify_at_rows_par<I: Clone + Iterator<Item = usize>>(
&self,
gate_row_ids: I,
Expand Down Expand Up @@ -1354,6 +1353,31 @@ impl<F: FieldExt> MockProver<F> {
}
}

/// Panics if the circuit being checked by this `MockProver` is not satisfied.
///
/// Any verification failures will be pretty-printed to stderr before the function
/// panics.
///
/// Constraints are only checked at `gate_row_ids`, and lookup inputs are only checked at `lookup_input_row_ids`, parallelly.
///
/// Apart from the stderr output, this method is equivalent to:
/// ```ignore
/// assert_eq!(prover.verify_at_rows_par(), Ok(()));
/// ```
pub fn assert_satisfied_at_rows_par<I: Clone + Iterator<Item = usize>>(
&self,
gate_row_ids: I,
lookup_input_row_ids: I,
) {
if let Err(errs) = self.verify_at_rows_par(gate_row_ids, lookup_input_row_ids) {
for err in errs {
err.emit(self);
eprintln!();
}
panic!("circuit was not satisfied");
}
}

/// Returns the list of Fixed Columns used within a MockProver instance and the associated values contained on each Cell.
pub fn fixed(&self) -> &Vec<Vec<CellValue<F>>> {
&self.fixed
Expand Down