From accd1bf6434da2b47681b9c979d37f0f7d739d8e Mon Sep 17 00:00:00 2001 From: Victor Sint Nicolaas Date: Fri, 29 Nov 2024 18:52:59 +0100 Subject: [PATCH] Do not hardcode the hiding mode --- algorithms/src/snark/varuna/ahp/indexer/circuit.rs | 2 +- algorithms/src/snark/varuna/ahp/matrices.rs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/algorithms/src/snark/varuna/ahp/indexer/circuit.rs b/algorithms/src/snark/varuna/ahp/indexer/circuit.rs index fb48461b83..c938b6e1d3 100644 --- a/algorithms/src/snark/varuna/ahp/indexer/circuit.rs +++ b/algorithms/src/snark/varuna/ahp/indexer/circuit.rs @@ -142,7 +142,7 @@ impl Circuit { pub fn interpolate_matrix_evals(&self) -> Result>> { let mut iters = Vec::with_capacity(3); for (label, evals) in [("a", &self.a_arith), ("b", &self.b_arith), ("c", &self.c_arith)] { - iters.push(MatrixArithmetization::new(&self.id, label, evals)?.into_iter()); + iters.push(MatrixArithmetization::new::(&self.id, label, evals)?.into_iter()); } Ok(iters.into_iter().flatten()) } diff --git a/algorithms/src/snark/varuna/ahp/matrices.rs b/algorithms/src/snark/varuna/ahp/matrices.rs index 4f57b78d9b..7a730ea90c 100644 --- a/algorithms/src/snark/varuna/ahp/matrices.rs +++ b/algorithms/src/snark/varuna/ahp/matrices.rs @@ -20,7 +20,7 @@ use crate::{ polycommit::sonic_pc::LabeledPolynomial, r1cs::{ConstraintSystem, Index as VarIndex}, snark::varuna::{ - VarunaHidingMode, + SNARKMode, ahp::{AHPForR1CS, CircuitId, indexer::Matrix}, }, }; @@ -210,7 +210,11 @@ pub struct MatrixArithmetization { impl MatrixArithmetization { /// Create a new MatrixArithmetization - pub fn new(id: &CircuitId, label: &str, matrix_evals: &MatrixEvals) -> Result> { + pub fn new( + id: &CircuitId, + label: &str, + matrix_evals: &MatrixEvals, + ) -> Result> { let interpolate_time = start_timer!(|| "Interpolating on K"); let non_zero_domain = matrix_evals.domain()?; let row = matrix_evals.row.clone().interpolate(); @@ -228,7 +232,7 @@ impl MatrixArithmetization { let row_col_val = matrix_evals.row_col_val.clone().interpolate(); end_timer!(interpolate_time); - let mut labels = AHPForR1CS::::index_polynomial_labels_single(label, id); + let mut labels = AHPForR1CS::::index_polynomial_labels_single(label, id); ensure!(labels.len() == 4); Ok(MatrixArithmetization { @@ -266,7 +270,7 @@ pub(crate) fn transpose( #[cfg(test)] mod tests { use super::*; - use crate::snark::varuna::num_non_zero; + use crate::snark::varuna::{VarunaHidingMode, num_non_zero}; use snarkvm_curves::bls12_377::Fr as F; use snarkvm_fields::{One, Zero}; use std::{borrow::Cow, collections::HashMap}; @@ -332,7 +336,7 @@ mod tests { ) .unwrap(); let dummy_id = CircuitId([0; 32]); - let arith = MatrixArithmetization::new(&dummy_id, label, &evals).unwrap(); + let arith = MatrixArithmetization::new::(&dummy_id, label, &evals).unwrap(); for (k_index, k) in interpolation_domain.elements().enumerate() { let row_val = arith.row.evaluate(k);