Skip to content

Commit

Permalink
chore: removing all uneeded public modifiers
Browse files Browse the repository at this point in the history
- removing public modifier in  src/spartan/ppsnark.rs

- removing public modifier in  src/spartan/sumcheck/mod.rs

- removing public modifier in src/spartan/mod.rs

- removing public modifier in src/spartan/polys/masked_eq.rs

- removing public modifier in src/supernova/mod.rs
  • Loading branch information
huitseeker committed Jun 8, 2024
1 parent 754fdb2 commit f9970d9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"rust-analyzer.check.noDefaultFeatures": true
}
6 changes: 3 additions & 3 deletions src/spartan/batched_ppsnark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ impl<E: Engine, EE: EvaluationEngineTrait<E>> BatchedRelaxedR1CSSNARKTrait<E>

let X = {
let X = vec![U.u]
.into_iter()
.chain(U.X.iter().cloned())
.collect::<Vec<E::Scalar>>();
.into_iter()
.chain(U.X.iter().cloned())
.collect::<Vec<E::Scalar>>();
SparsePolynomial::new(num_vars_log, X).evaluate(&rand_sc_unpad[1..])
};

Expand Down
4 changes: 2 additions & 2 deletions src/spartan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ pub mod batched_ppsnark;
pub mod direct;
#[macro_use]
mod macros;
pub(crate) mod math;
mod math;
pub mod polys;
pub mod ppsnark;
pub mod snark;
mod sumcheck;
pub(in crate::spartan) mod sumcheck;

use crate::{
r1cs::{R1CSShape, SparseMatrix},
Expand Down
12 changes: 8 additions & 4 deletions src/spartan/ppsnark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl<E: Engine> R1CSShapeSparkRepr<E> {
}
}

fn commit(&self, ck: &CommitmentKey<E>) -> R1CSShapeSparkCommitment<E> {
pub(in crate::spartan) fn commit(&self, ck: &CommitmentKey<E>) -> R1CSShapeSparkCommitment<E> {
let comm_vec: Vec<Commitment<E>> = [
&self.row,
&self.col,
Expand All @@ -201,7 +201,7 @@ impl<E: Engine> R1CSShapeSparkRepr<E> {
}

// computes evaluation oracles
pub(in crate::spartan) fn evaluation_oracles(
fn evaluation_oracles(
&self,
S: &R1CSShape<E>,
r_x: &E::Scalar,
Expand Down Expand Up @@ -257,7 +257,11 @@ pub struct WitnessBoundSumcheck<E: Engine> {
}

impl<E: Engine> WitnessBoundSumcheck<E> {
fn new(tau: E::Scalar, poly_W_padded: Vec<E::Scalar>, num_vars: usize) -> Self {
pub(in crate::spartan) fn new(
tau: E::Scalar,
poly_W_padded: Vec<E::Scalar>,
num_vars: usize,
) -> Self {
let num_vars_log = num_vars.log_2();
// When num_vars = num_rounds, we shouldn't have to prove anything
// but we still want this instance to compute the evaluation of W
Expand Down Expand Up @@ -315,7 +319,7 @@ impl<E: Engine> SumcheckEngine<E> for WitnessBoundSumcheck<E> {
}
}

struct MemorySumcheckInstance<E: Engine> {
pub(in crate::spartan) struct MemorySumcheckInstance<E: Engine> {
// row
w_plus_r_row: MultilinearPolynomial<E::Scalar>,
t_plus_r_row: MultilinearPolynomial<E::Scalar>,
Expand Down
4 changes: 2 additions & 2 deletions src/spartan/snark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl<E: Engine, EE: EvaluationEngineTrait<E>> RelaxedR1CSSNARKTrait<E> for Relax
///
/// We allow the polynomial Pᵢ to have different sizes, by appropriately scaling
/// the claims and resulting evaluations from Sumcheck.
fn batch_eval_reduce<E: Engine>(
pub(in crate::spartan) fn batch_eval_reduce<E: Engine>(
u_vec: Vec<PolyEvalInstance<E>>,
w_vec: Vec<PolyEvalWitness<E>>,
transcript: &mut E::TE,
Expand Down Expand Up @@ -495,7 +495,7 @@ fn batch_eval_reduce<E: Engine>(

/// Verifies a batch of polynomial evaluation claims using Sumcheck
/// reducing them to a single claim at the same point.
fn batch_eval_verify<E: Engine>(
pub(in crate::spartan) fn batch_eval_verify<E: Engine>(
u_vec: Vec<PolyEvalInstance<E>>,
transcript: &mut E::TE,
sc_proof_batch: &SumcheckProof<E>,
Expand Down
30 changes: 3 additions & 27 deletions src/supernova/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
C2: StepCircuit<E2::Scalar>,
{
/// The internal circuit shapes
pub circuit_shapes: Vec<R1CSWithArity<E1>>,
circuit_shapes: Vec<R1CSWithArity<E1>>,

ro_consts_primary: ROConstants<E1>,
ro_consts_circuit_primary: ROConstantsCircuit<E2>,
Expand Down Expand Up @@ -373,7 +373,7 @@ where
}

/// Returns all the primary R1CS Shapes
pub fn primary_r1cs_shapes(&self) -> Vec<&R1CSShape<E1>> {
fn primary_r1cs_shapes(&self) -> Vec<&R1CSShape<E1>> {
self
.circuit_shapes
.iter()
Expand Down Expand Up @@ -1004,30 +1004,6 @@ where
fn secondary_circuit(&self) -> C2;
}

/// Extension trait to simplify getting scalar form of initial circuit index.
pub trait InitialProgramCounter<E1, E2, C1, C2>: NonUniformCircuit<E1, E2, C1, C2>
where
E1: Engine<Base = <E2 as Engine>::Scalar>,
E2: Engine<Base = <E1 as Engine>::Scalar>,
C1: StepCircuit<E1::Scalar>,
C2: StepCircuit<E2::Scalar>,
{
/// Initial program counter is the initial circuit index as a `Scalar`.
fn initial_program_counter(&self) -> E1::Scalar {
E1::Scalar::from(self.initial_circuit_index() as u64)
}
}

impl<E1, E2, C1, C2, T: NonUniformCircuit<E1, E2, C1, C2>> InitialProgramCounter<E1, E2, C1, C2>
for T
where
E1: Engine<Base = <E2 as Engine>::Scalar>,
E2: Engine<Base = <E1 as Engine>::Scalar>,
C1: StepCircuit<E1::Scalar>,
C2: StepCircuit<E2::Scalar>,
{
}

/// Compute the circuit digest of a supernova [StepCircuit].
///
/// Note for callers: This function should be called with its performance characteristics in mind.
Expand Down Expand Up @@ -1078,7 +1054,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;

0 comments on commit f9970d9

Please sign in to comment.