Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions compiler/noirc_evaluator/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub enum RuntimeError {
UnconstrainedOracleReturnToConstrained { call_stack: CallStack },
#[error("Could not resolve some references to the array. All references must be resolved at compile time")]
UnknownReference { call_stack: CallStack },
#[error("Assertion is false")]
AssertFailed { call_stack: CallStack },
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -157,6 +159,7 @@ impl RuntimeError {
| RuntimeError::BigIntModulus { call_stack, .. }
| RuntimeError::UnconstrainedSliceReturnToConstrained { call_stack }
| RuntimeError::UnconstrainedOracleReturnToConstrained { call_stack }
| RuntimeError::AssertFailed { call_stack }
| RuntimeError::UnknownReference { call_stack } => call_stack,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ impl<F: AcirField> AcirContext<F> {
self.mark_variables_equivalent(lhs, rhs)?;
return Ok(());
}
if diff_expr.is_const() {
// Constraint is always false, returns an error
return Err(RuntimeError::AssertFailed { call_stack: self.get_call_stack() });
}

self.acir_ir.assert_is_zero(diff_expr);
if let Some(payload) = assert_message {
Expand Down