diff --git a/src/provider/ipa_pc.rs b/src/provider/ipa_pc.rs index 471a095eb..38dd829e6 100644 --- a/src/provider/ipa_pc.rs +++ b/src/provider/ipa_pc.rs @@ -112,7 +112,7 @@ fn inner_product(a: &[T], b: &[T]) -> T { /// An inner product instance consists of a commitment to a vector `a` and another vector `b` /// and the claim that c = . -pub struct InnerProductInstance { +struct InnerProductInstance { comm_a_vec: Commitment, b_vec: Vec, c: E::Scalar, diff --git a/src/provider/mod.rs b/src/provider/mod.rs index 1f4dd7a19..7f12139c6 100644 --- a/src/provider/mod.rs +++ b/src/provider/mod.rs @@ -7,15 +7,15 @@ pub mod non_hiding_zeromorph; // crate-public modules, made crate-public mostly for tests pub(crate) mod bn256_grumpkin; -pub(crate) mod pasta; -pub(crate) mod pedersen; +mod pasta; +mod pedersen; pub(crate) mod poseidon; pub(crate) mod secp_secq; pub(crate) mod traits; // a non-hiding variant of {kzg, zeromorph} -pub(crate) mod kzg_commitment; -pub(crate) mod non_hiding_kzg; -pub(crate) mod util; +mod kzg_commitment; +mod non_hiding_kzg; +mod util; // crate-private modules mod keccak; diff --git a/src/provider/non_hiding_kzg.rs b/src/provider/non_hiding_kzg.rs index 93aa4bb30..855bb03c5 100644 --- a/src/provider/non_hiding_kzg.rs +++ b/src/provider/non_hiding_kzg.rs @@ -310,7 +310,7 @@ where /// Verifies that `value` is the evaluation at `x` of the polynomial /// committed inside `comm`. #[allow(dead_code, clippy::unnecessary_wraps)] - pub fn verify( + fn verify( verifier_param: impl Borrow>, commitment: &UVKZGCommitment, point: &E::Fr, diff --git a/src/provider/non_hiding_zeromorph.rs b/src/provider/non_hiding_zeromorph.rs index f7cea4b7c..3d6295161 100644 --- a/src/provider/non_hiding_zeromorph.rs +++ b/src/provider/non_hiding_zeromorph.rs @@ -69,7 +69,7 @@ pub struct ZMVerifierKey { // // TODO: important, we need a better way to handle that the commitment key should be 2^max_degree sized, // see the runtime error in commit() below -pub fn trim( +fn trim( params: &UniversalKZGParam, max_degree: usize, ) -> (ZMProverKey, ZMVerifierKey) { @@ -93,7 +93,7 @@ pub fn trim( #[derive(Debug, Clone, Eq, PartialEq, Default, Serialize, Deserialize)] pub struct ZMCommitment( /// the actual commitment is an affine point. - pub E::G1Affine, + E::G1Affine, ); impl From> for ZMCommitment { @@ -126,11 +126,11 @@ impl From> for ZMEvaluation { /// Proofs pub struct ZMProof { /// proof - pub pi: E::G1Affine, + pi: E::G1Affine, /// Polynomial commitment to qhat - pub cqhat: UVKZGCommitment, + cqhat: UVKZGCommitment, /// Polynomial commitment to qk - pub ck: Vec>, + ck: Vec>, } #[derive(Debug, Clone, Eq, PartialEq, Default)] @@ -155,7 +155,7 @@ where /// Generate a commitment for a polynomial /// Note that the scheme is not hidding - pub fn commit( + fn commit( pp: impl Borrow>, poly: &MultilinearPolynomial, ) -> Result, NovaError> { @@ -168,7 +168,7 @@ where /// On input a polynomial `poly` and a point `point`, outputs a proof for the /// same. - pub fn open( + fn open( pp: &impl Borrow>, comm: &ZMCommitment, poly: &MultilinearPolynomial, @@ -252,7 +252,7 @@ where /// Verifies that `value` is the evaluation at `x` of the polynomial /// committed inside `comm`. - pub fn verify( + fn verify( vk: &impl Borrow>, transcript: &mut impl TranscriptEngineTrait, comm: &ZMCommitment, @@ -819,7 +819,7 @@ mod test { } } - pub fn commit_filtered( + fn commit_filtered( prover_param: impl Borrow>, poly: &UVKZGPoly, ) -> Result, NovaError> diff --git a/src/provider/util/fb_msm.rs b/src/provider/util/fb_msm.rs index bc5b88bee..dfab2916e 100644 --- a/src/provider/util/fb_msm.rs +++ b/src/provider/util/fb_msm.rs @@ -84,7 +84,7 @@ where /// Given a scalar and a table of pre-computed multiples of a base point, this function /// efficiently computes the scalar multiplication by breaking the scalar into windows and /// adding the corresponding multiples from the table. -pub(crate) fn windowed_mul( +fn windowed_mul( outerc: usize, window: usize, multiples_of_g: &[Vec], diff --git a/src/provider/util/mod.rs b/src/provider/util/mod.rs index c7d12f20f..94a76af98 100644 --- a/src/provider/util/mod.rs +++ b/src/provider/util/mod.rs @@ -23,7 +23,7 @@ pub mod test_utils { use rand_core::{CryptoRng, RngCore}; /// Returns a random polynomial, a point and calculate its evaluation. - pub fn random_poly_with_eval( + fn random_poly_with_eval( num_vars: usize, mut rng: &mut R, ) -> ( @@ -65,7 +65,7 @@ pub mod test_utils { prove_verify_with::(&ck, &commitment, &poly, &point, &eval, true) } - pub(crate) fn prove_verify_with>( + fn prove_verify_with>( ck: &<::CE as CommitmentEngineTrait>::CommitmentKey, commitment: &<::CE as CommitmentEngineTrait>::Commitment, poly: &MultilinearPolynomial<::Scalar>, diff --git a/src/spartan/mod.rs b/src/spartan/mod.rs index f7c9552f5..175c00b39 100644 --- a/src/spartan/mod.rs +++ b/src/spartan/mod.rs @@ -10,11 +10,11 @@ pub mod batched; pub mod batched_ppsnark; #[macro_use] mod macros; -pub(crate) mod math; +mod math; pub mod polys; pub mod ppsnark; pub mod snark; -pub(in crate::spartan) mod sumcheck; +mod sumcheck; use crate::{ r1cs::{R1CSShape, SparseMatrix}, @@ -35,7 +35,7 @@ fn powers(s: &E::Scalar, n: usize) -> Vec { } /// A type that holds a witness to a polynomial evaluation instance -pub struct PolyEvalWitness { +struct PolyEvalWitness { p: Vec, // polynomial } @@ -114,7 +114,7 @@ impl PolyEvalWitness { } /// A type that holds a polynomial evaluation instance -pub struct PolyEvalInstance { +struct PolyEvalInstance { c: Commitment, // commitment to the polynomial x: Vec, // evaluation point e: E::Scalar, // claimed evaluation @@ -185,7 +185,7 @@ impl PolyEvalInstance { } /// Bounds "row" variables of (A, B, C) matrices viewed as 2d multilinear polynomials -pub fn compute_eval_table_sparse( +fn compute_eval_table_sparse( S: &R1CSShape, rx: &[E::Scalar], ) -> (Vec, Vec, Vec) { diff --git a/src/spartan/polys/masked_eq.rs b/src/spartan/polys/masked_eq.rs index 3d6ac7507..5fa5fe224 100644 --- a/src/spartan/polys/masked_eq.rs +++ b/src/spartan/polys/masked_eq.rs @@ -62,7 +62,7 @@ impl<'a, Scalar: PrimeField> MaskedEqPolynomial<'a, Scalar> { /// representation. /// /// Returns a vector of Scalars, each corresponding to the polynomial evaluation at a specific point. - pub fn evals_from_points(r: &[Scalar], num_masked_vars: usize) -> Vec { + fn evals_from_points(r: &[Scalar], num_masked_vars: usize) -> Vec { let mut evals = EqPolynomial::evals_from_points(r); // replace the first 2^m evaluations with 0 diff --git a/src/spartan/polys/univariate.rs b/src/spartan/polys/univariate.rs index 3eb0e99ec..9dbb7a219 100644 --- a/src/spartan/polys/univariate.rs +++ b/src/spartan/polys/univariate.rs @@ -70,7 +70,7 @@ impl UniPoly { } } - pub fn is_zero(&self) -> bool { + fn is_zero(&self) -> bool { self.coeffs.is_empty() || self.coeffs.iter().all(|c| c == &Scalar::ZERO) } @@ -80,7 +80,7 @@ impl UniPoly { } } - pub fn leading_coefficient(&self) -> Option<&Scalar> { + fn leading_coefficient(&self) -> Option<&Scalar> { self.coeffs.last() } diff --git a/src/spartan/ppsnark.rs b/src/spartan/ppsnark.rs index 65c7b3611..2d6cfc642 100644 --- a/src/spartan/ppsnark.rs +++ b/src/spartan/ppsnark.rs @@ -218,7 +218,7 @@ impl R1CSShapeSparkRepr { } // computes evaluation oracles - pub(in crate::spartan) fn evaluation_oracles( + fn evaluation_oracles( &self, S: &R1CSShape, r_x: &E::Scalar, diff --git a/src/spartan/sumcheck/mod.rs b/src/spartan/sumcheck/mod.rs index a2f84cc5a..704f47cf8 100644 --- a/src/spartan/sumcheck/mod.rs +++ b/src/spartan/sumcheck/mod.rs @@ -99,7 +99,7 @@ impl SumcheckProof { } #[inline] - pub(in crate::spartan) fn compute_eval_points_quad( + fn compute_eval_points_quad( poly_A: &MultilinearPolynomial, poly_B: &MultilinearPolynomial, comb_func: &F, @@ -300,7 +300,7 @@ impl SumcheckProof { } #[inline] - pub(in crate::spartan) fn compute_eval_points_cubic( + fn compute_eval_points_cubic( poly_A: &MultilinearPolynomial, poly_B: &MultilinearPolynomial, poly_C: &MultilinearPolynomial, @@ -344,7 +344,7 @@ impl SumcheckProof { } #[inline] - pub(in crate::spartan) fn compute_eval_points_cubic_with_additive_term( + fn compute_eval_points_cubic_with_additive_term( poly_A: &MultilinearPolynomial, poly_B: &MultilinearPolynomial, poly_C: &MultilinearPolynomial, diff --git a/src/supernova/mod.rs b/src/supernova/mod.rs index 3e5c94dc2..9a1c10cef 100644 --- a/src/supernova/mod.rs +++ b/src/supernova/mod.rs @@ -85,7 +85,7 @@ where C2: StepCircuit, { /// The internal circuit shapes - pub circuit_shapes: Vec>, + circuit_shapes: Vec>, ro_consts_primary: ROConstants, ro_consts_circuit_primary: ROConstantsCircuit, @@ -383,7 +383,7 @@ where } /// Returns all the primary R1CS Shapes - pub fn primary_r1cs_shapes(&self) -> Vec<&R1CSShape> { + fn primary_r1cs_shapes(&self) -> Vec<&R1CSShape> { self .circuit_shapes .iter() @@ -396,7 +396,7 @@ where /// which allows the reuse of memory allocations and avoids unnecessary new allocations in the critical section. #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(bound = "")] -pub struct ResourceBuffer { +struct ResourceBuffer { l_w: Option>, l_u: Option>, @@ -1075,7 +1075,7 @@ where } /// Extension trait to simplify getting scalar form of initial circuit index. -pub trait InitialProgramCounter: NonUniformCircuit +trait InitialProgramCounter: NonUniformCircuit where E1: Engine::Scalar>, E2: Engine::Scalar>, @@ -1148,7 +1148,7 @@ fn num_ro_inputs(num_circuits: usize, num_limbs: usize, arity: usize, is_primary pub mod error; pub mod snark; -pub(crate) mod utils; +mod utils; #[cfg(test)] mod test;