Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dynamic dory commitment GPU computation should handle empty committable columns #429

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pub(super) fn compute_dynamic_dory_commitments(
offset: usize,
setup: &ProverSetup,
) -> Vec<DynamicDoryCommitment> {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading