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

chore: use panic instead of assert #8703

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ impl PublicContext {
_function_selector: FunctionSelector,
_args: [Field]
) -> FunctionReturns<RETURNS_COUNT> {
assert(false, "'delegate_call_public_function' not implemented!");
FunctionReturns::new([0; RETURNS_COUNT])
panic(f"'delegate_call_public_function' not implemented!")
}

fn push_note_hash(_self: &mut Self, note_hash: Field) {
Expand Down
3 changes: 1 addition & 2 deletions noir-projects/aztec-nr/aztec/src/utils/comparison.nr
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ pub fn compare(lhs: Field, operation: u8, rhs: Field) -> bool {
} else if (operation == Comparator.GTE) {
!is_lt
} else {
assert(false, "Invalid operation");
false // Noir would complain without boolean value here
panic(f"Invalid operation")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ impl PublicCallDataValidator {
} else if self.phase == PublicKernelPhase.TEARDOWN {
previous_kernel.public_teardown_call_stack
} else {
assert(false, "Unknown phase");
[PublicCallRequest::empty(); MAX_PUBLIC_CALL_STACK_LENGTH_PER_TX]
panic(f"Unknown phase")
};

let call_request = call_stack[array_length(call_stack) - 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ pub fn calculate_empty_tree_root(depth: u32) -> Field {
} else if depth == 10 {
0x2a775ea761d20435b31fa2c33ff07663e24542ffb9e7b293dfce3042eb104686
} else {
assert(false, "depth should be between 0 and 10");
0
panic(f"depth should be between 0 and 10")
}
}

Expand Down
Loading