From 27c158f9089527e0c0326ca538279749d7797f7e Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Wed, 11 Dec 2024 15:08:50 -0500 Subject: [PATCH] fix: blitzar_metadata_table should handle empty committable columns --- .../proof_primitive/dory/blitzar_metadata_table.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/blitzar_metadata_table.rs b/crates/proof-of-sql/src/proof_primitive/dory/blitzar_metadata_table.rs index 6c2217c35..a4a28225d 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/blitzar_metadata_table.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/blitzar_metadata_table.rs @@ -57,6 +57,10 @@ pub fn signed_commits( all_sub_commits: &Vec, committable_columns: &[CommittableColumn], ) -> Vec { + 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) @@ -143,6 +147,10 @@ pub fn create_blitzar_metadata_tables( committable_columns: &[CommittableColumn], offset: usize, ) -> (Vec, Vec, Vec) { + 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() @@ -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])];