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..efc548f7a 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 @@ -1,12 +1,12 @@ -use super::{ - dynamic_dory_structure::{ - full_width_of_row, index_from_row_and_column, matrix_size, row_and_column_from_index, - }, - G1Affine, F, -}; +use super::{G1Affine, F}; use crate::{ base::{commitment::CommittableColumn, database::ColumnType, if_rayon}, - proof_primitive::dory::offset_to_bytes::OffsetToBytes, + proof_primitive::{ + dory::offset_to_bytes::OffsetToBytes, + dynamic_matrix_utils::matrix_structure::{ + full_width_of_row, index_from_row_and_column, matrix_size, row_and_column_from_index, + }, + }, }; use alloc::{vec, vec::Vec}; use ark_ec::CurveGroup; diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_build_vmv_state.rs b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_build_vmv_state.rs index 43ef11cc0..baba2fd5a 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_build_vmv_state.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_build_vmv_state.rs @@ -1,8 +1,13 @@ use super::{ - dynamic_dory_helper::{compute_dynamic_v_vec, compute_dynamic_vecs}, - DeferredGT, G1Affine, VMVProverState, VMVVerifierState, F, + dynamic_dory_helper::compute_dynamic_v_vec, DeferredGT, G1Affine, VMVProverState, + VMVVerifierState, F, +}; +use crate::{ + base::scalar::MontScalar, + proof_primitive::dynamic_matrix_utils::standard_basis_helper::compute_dynamic_vecs, }; use alloc::vec::Vec; +use itertools::Itertools; /// Builds a [`VMVProverState`] from the given parameters. pub(super) fn build_dynamic_vmv_prover_state( @@ -11,7 +16,12 @@ pub(super) fn build_dynamic_vmv_prover_state( T_vec_prime: Vec, nu: usize, ) -> VMVProverState { - let (lo_vec, hi_vec) = compute_dynamic_vecs(b_point); + let (lo_vec, hi_vec) = + compute_dynamic_vecs(&b_point.iter().copied().map(MontScalar).collect_vec()); + let (lo_vec, hi_vec) = ( + lo_vec.into_iter().map(|m| m.0).collect_vec(), + hi_vec.into_iter().map(|m| m.0).collect_vec(), + ); let v_vec = compute_dynamic_v_vec(a, &hi_vec, nu); VMVProverState { v_vec, 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 b36e1177d..042645192 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,8 +1,10 @@ -use super::{ - dynamic_dory_structure::{full_width_of_row, row_and_column_from_index, row_start_index}, - pairings, DoryScalar, DynamicDoryCommitment, G1Projective, ProverSetup, GT, +use super::{pairings, DoryScalar, DynamicDoryCommitment, G1Projective, ProverSetup, GT}; +use crate::{ + base::{commitment::CommittableColumn, if_rayon, slice_ops::slice_cast}, + proof_primitive::dynamic_matrix_utils::matrix_structure::{ + full_width_of_row, row_and_column_from_index, row_start_index, + }, }; -use crate::base::{commitment::CommittableColumn, if_rayon, slice_ops::slice_cast}; use alloc::vec::Vec; use ark_ec::VariableBaseMSM; use bytemuck::TransparentWrapper; 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..7bab283bc 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 @@ -1,9 +1,11 @@ use super::{ blitzar_metadata_table::{create_blitzar_metadata_tables, signed_commits}, - dynamic_dory_structure::row_and_column_from_index, pairings, DynamicDoryCommitment, G1Affine, ProverSetup, }; -use crate::base::{commitment::CommittableColumn, if_rayon, slice_ops::slice_cast}; +use crate::{ + base::{commitment::CommittableColumn, if_rayon, slice_ops::slice_cast}, + proof_primitive::dynamic_matrix_utils::matrix_structure::row_and_column_from_index, +}; use blitzar::compute::ElementP2; #[cfg(feature = "rayon")] use rayon::iter::{IntoParallelIterator, ParallelIterator}; diff --git a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_helper.rs b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_helper.rs index 24bf4054a..a8bf890c7 100644 --- a/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_helper.rs +++ b/crates/proof-of-sql/src/proof_primitive/dory/dynamic_dory_helper.rs @@ -1,13 +1,17 @@ use super::{ - blitzar_metadata_table::create_blitzar_metadata_tables, - dynamic_dory_standard_basis_helper::fold_dynamic_standard_basis_tensors, - dynamic_dory_structure::row_and_column_from_index, ExtendedVerifierState, G1Affine, + blitzar_metadata_table::create_blitzar_metadata_tables, ExtendedVerifierState, G1Affine, ProverSetup, F, }; use crate::{ - base::{commitment::CommittableColumn, slice_ops::slice_cast}, - proof_primitive::dory::{ - dynamic_dory_standard_basis_helper::compute_dynamic_standard_basis_vecs, DoryScalar, + base::{commitment::CommittableColumn, scalar::MontScalar, slice_ops::slice_cast}, + proof_primitive::{ + dory::{ + dynamic_dory_standard_basis_helper::compute_dynamic_standard_basis_vecs, DoryScalar, + }, + dynamic_matrix_utils::{ + matrix_structure::row_and_column_from_index, + standard_basis_helper::fold_dynamic_standard_basis_tensors, + }, }, }; use alloc::{vec, vec::Vec}; @@ -137,11 +141,20 @@ pub(super) fn fold_dynamic_tensors(state: &ExtendedVerifierState) -> (F, F) { }) .collect_vec(); let (lo_fold, hi_fold) = fold_dynamic_standard_basis_tensors( - &standard_basis_point, - &state.alphas, - &state.alpha_invs, + &standard_basis_point + .iter() + .copied() + .map(MontScalar) + .collect_vec(), + &state.alphas.iter().copied().map(MontScalar).collect_vec(), + &state + .alpha_invs + .iter() + .copied() + .map(MontScalar) + .collect_vec(), ); - (lo_fold * lo_inv_prod, hi_fold * hi_inv_prod) + (lo_fold.0 * lo_inv_prod, hi_fold.0 * hi_inv_prod) } #[cfg(test)]