From c776b62b3baae62ea98081b02472f77df5090196 Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Wed, 11 Dec 2024 15:06:26 -0500 Subject: [PATCH 1/3] test: add dynamic dory commitment test for empty committable column --- .../dory/dynamic_dory_compute_commitments_test.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_compute_commitments_test.rs b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_compute_commitments_test.rs index 35c22df32..25f81f7c3 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_compute_commitments_test.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_compute_commitments_test.rs @@ -8,6 +8,15 @@ use ark_ec::pairing::Pairing; use num_traits::Zero; use proof_of_sql_parser::posql_time::{PoSQLTimeUnit, PoSQLTimeZone}; +#[test] +fn we_can_handle_calling_with_an_empty_committable_column() { + let public_parameters = PublicParameters::test_rand(5, &mut test_rng()); + let setup = ProverSetup::from(&public_parameters); + let res = compute_dynamic_dory_commitments(&[], 0, &setup); + + assert!(res.is_empty()); +} + #[test] fn we_can_compute_a_dynamic_dory_commitment_with_unsigned_bigint_values() { let public_parameters = PublicParameters::test_rand(5, &mut test_rng()); From 257b60175b3bcc422f432b20f40e6c3f080efdc1 Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Wed, 11 Dec 2024 15:07:15 -0500 Subject: [PATCH 2/3] fix: dynamic_dory_commitment_helper_gpu should handle empty committable columns --- .../dory/dynamic_dory_commitment_helper_gpu.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_gpu.rs b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_gpu.rs index f3206f7c6..474b9ce3f 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_gpu.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_gpu.rs @@ -34,6 +34,10 @@ pub(super) fn compute_dynamic_dory_commitments( offset: usize, setup: &ProverSetup, ) -> Vec { + if committable_columns.is_empty() { + return vec![]; + } + let Gamma_2 = setup.Gamma_2.last().unwrap(); let (gamma_2_offset, _) = row_and_column_from_index(offset); From 27c158f9089527e0c0326ca538279749d7797f7e Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Wed, 11 Dec 2024 15:08:50 -0500 Subject: [PATCH 3/3] 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])];