diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dory_compute_commitments_test.rs b/crates/proof-of-sql/src/proof_primitive/dory/dory_compute_commitments_test.rs index 58f454524..d2b09559b 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dory_compute_commitments_test.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dory_compute_commitments_test.rs @@ -322,11 +322,11 @@ fn we_can_compute_an_empty_dory_commitment() { let public_parameters = PublicParameters::test_rand(5, &mut test_rng()); let prover_setup = ProverSetup::from(&public_parameters); let setup = DoryProverPublicSetup::new(&prover_setup, 2); - let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0, 0])], 0, &setup); + let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0; 0])], 0, &setup); assert_eq!(res[0].0, GT::zero()); - let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0, 0])], 5, &setup); + let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0; 0])], 5, &setup); assert_eq!(res[0].0, GT::zero()); - let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0, 0])], 20, &setup); + let res = compute_dory_commitments(&[CommittableColumn::BigInt(&[0; 0])], 20, &setup); assert_eq!(res[0].0, GT::zero()); } 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() }