Skip to content
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
17 changes: 17 additions & 0 deletions halo2-base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ impl<F: ScalarField> AssignedValue<F> {
_ => unreachable!(), // if trying to fetch an un-evaluated fraction, you will have to do something manual
}
}

/// Debug helper function for writing negative tests. This will change the **witness** value of the assigned cell
/// to `prank_value`. It does not change any constraints.
#[cfg(test)]
pub fn debug_prank(&mut self, prank_value: F) {
self.value = Assigned::Trivial(prank_value);
}
}

/// Represents a single thread of an execution trace.
Expand Down Expand Up @@ -413,4 +420,14 @@ impl<F: ScalarField> Context<F> {
self.zero_cell = Some(zero_cell);
zero_cell
}

/// Helper function for debugging using `MockProver`. This adds a constraint that always fails.
/// The `MockProver` will print out the row, column where it fails, so it serves as a debugging "break point"
/// so you can add to your code to search for where the actual constraint failure occurs.
#[cfg(test)]
pub fn debug_assert_false(&mut self) {
let one = self.load_constant(F::one());
let zero = self.load_zero();
self.constrain_equal(&one, &zero);
}
}