Skip to content

Commit

Permalink
fix: blitzar_metadata_table should handle empty committable columns
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtrombetta committed Dec 11, 2024
1 parent 257b601 commit 27c158f
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ pub fn signed_commits(
all_sub_commits: &Vec<G1Affine>,
committable_columns: &[CommittableColumn],
) -> Vec<G1Affine> {
if committable_columns.is_empty() {
return vec![];
}

if_rayon!(
all_sub_commits.par_chunks_exact(committable_columns.len() * 2),
all_sub_commits.chunks_exact(committable_columns.len() * 2)
Expand Down Expand Up @@ -143,6 +147,10 @@ pub fn create_blitzar_metadata_tables(
committable_columns: &[CommittableColumn],
offset: usize,
) -> (Vec<u32>, Vec<u32>, Vec<u8>) {
if committable_columns.is_empty() {
return (vec![], vec![], vec![]);
}

// Keep track of the lengths of the columns to handled signed data columns.
let ones_columns_lengths = committable_columns
.iter()
Expand Down Expand Up @@ -298,6 +306,11 @@ mod tests {
);
}

#[test]
fn we_can_handle_empty_committable_columns_in_blitzar_metadata_tables() {
assert_blitzar_metadata(&[], 0, &[], &[], &[]);
}

#[test]
fn we_can_populate_blitzar_metadata_tables_with_empty_columns_and_offset_that_fills_row() {
let committable_columns = [CommittableColumn::BigInt(&[0; 0])];
Expand Down

0 comments on commit 27c158f

Please sign in to comment.