From b88935c011f164c06142fe0902a54d48405b3f63 Mon Sep 17 00:00:00 2001 From: Jacob Trombetta Date: Wed, 9 Oct 2024 09:31:02 -0400 Subject: [PATCH] fix: dynamic Dory commitment computation should handle empty column --- .../dory/dynamic_dory_commitment_helper_cpu.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_cpu.rs b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_cpu.rs index 7187f5abe..8ed2ddbb5 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_cpu.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_commitment_helper_cpu.rs @@ -1,9 +1,10 @@ use super::{ dynamic_dory_structure::row_and_column_from_index, pairings, DoryScalar, DynamicDoryCommitment, - G1Affine, G1Projective, ProverSetup, + G1Affine, G1Projective, ProverSetup, GT, }; use crate::base::commitment::CommittableColumn; use alloc::{vec, vec::Vec}; +use num_traits::Zero; #[tracing::instrument(name = "compute_dory_commitment_impl (cpu)", level = "debug", skip_all)] /// # Panics @@ -71,6 +72,11 @@ pub(super) fn compute_dynamic_dory_commitments( ) -> Vec { committable_columns .iter() - .map(|column| compute_dory_commitment(column, offset, setup)) + .map(|column| { + column + .is_empty() + .then(|| DynamicDoryCommitment(GT::zero())) + .unwrap_or_else(|| compute_dory_commitment(column, offset, setup)) + }) .collect() }