Skip to content

Commit

Permalink
refactor: add panic if the row index returned exceeds u32::MAX in the…
Browse files Browse the repository at this point in the history
… blitzar_metadata_table module
  • Loading branch information
jacobtrombetta committed Oct 22, 2024
1 parent 6966dbb commit ae3c542
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ fn copy_column_data_to_slice(
///
/// A tuple containing the output bit table, output length table,
/// and scalars required to call Blitzar's `vlen_msm` function.
///
/// # Panics
///
/// Panics if the row of a column exceeds `u32::MAX`.
#[tracing::instrument(name = "create_blitzar_metadata_tables", level = "debug", skip_all)]
pub fn create_blitzar_metadata_tables(
committable_columns: &[CommittableColumn],
Expand Down Expand Up @@ -188,11 +192,11 @@ pub fn create_blitzar_metadata_tables(
/ single_entry_in_blitzar_output_bit_table.len())
.flat_map(|i| {
itertools::repeat_n(
u32::try_from(full_width_of_row(i)),
u32::try_from(full_width_of_row(i))
.expect("row lengths should never exceed u32::MAX"),
single_entry_in_blitzar_output_bit_table.len(),
)
})
.flatten()
.collect();

// Create a cumulative length table to be used when packing the scalar vector.
Expand Down

0 comments on commit ae3c542

Please sign in to comment.