Skip to content

Commit

Permalink
replace asserts with bail! in STARK verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed May 1, 2023
1 parent 5d3dd1a commit 7cf318b
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions triton-vm/src/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,26 @@ impl Stark {

prof_start!(maybe_profiler, "linear combination");
let num_checks = parameters.num_combination_codeword_checks;
assert_eq!(num_checks, revealed_current_row_indices.len());
assert_eq!(num_checks, base_table_rows.len());
assert_eq!(num_checks, ext_table_rows.len());
assert_eq!(num_checks, revealed_quotient_values.len());
assert_eq!(num_checks, revealed_fri_values.len());
let num_revealed_row_indices = revealed_current_row_indices.len();
let num_base_table_rows = base_table_rows.len();
let num_ext_table_rows = ext_table_rows.len();
let num_revealed_quotient_values = revealed_quotient_values.len();
let num_revealed_fri_values = revealed_fri_values.len();
if num_revealed_row_indices != num_checks
|| num_base_table_rows != num_checks
|| num_ext_table_rows != num_checks
|| num_revealed_quotient_values != num_checks
|| num_revealed_fri_values != num_checks
{
bail!(
"Expected {num_checks} revealed indices and values, but got \
{num_revealed_row_indices} revealed row indices, \
{num_base_table_rows} base table rows, \
{num_ext_table_rows} extension table rows, \
{num_revealed_quotient_values} quotient values, and \
{num_revealed_fri_values} FRI values."
);
}
prof_start!(maybe_profiler, "main loop");
for (row_idx, base_row, ext_row, quotient_value, fri_value) in izip!(
revealed_current_row_indices,
Expand Down

0 comments on commit 7cf318b

Please sign in to comment.