diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..18027aae --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "rust-analyzer.check.noDefaultFeatures": true +} \ No newline at end of file diff --git a/src/spartan/batched_ppsnark.rs b/src/spartan/batched_ppsnark.rs index 40bc0a82..63044f56 100644 --- a/src/spartan/batched_ppsnark.rs +++ b/src/spartan/batched_ppsnark.rs @@ -939,9 +939,9 @@ impl> BatchedRelaxedR1CSSNARKTrait let X = { let X = vec![U.u] - .into_iter() - .chain(U.X.iter().cloned()) - .collect::>(); + .into_iter() + .chain(U.X.iter().cloned()) + .collect::>(); SparsePolynomial::new(num_vars_log, X).evaluate(&rand_sc_unpad[1..]) }; diff --git a/src/spartan/mod.rs b/src/spartan/mod.rs index 281d021a..af323500 100644 --- a/src/spartan/mod.rs +++ b/src/spartan/mod.rs @@ -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}, diff --git a/src/spartan/ppsnark.rs b/src/spartan/ppsnark.rs index 5224e89b..1198315c 100644 --- a/src/spartan/ppsnark.rs +++ b/src/spartan/ppsnark.rs @@ -174,7 +174,7 @@ impl R1CSShapeSparkRepr { } } - fn commit(&self, ck: &CommitmentKey) -> R1CSShapeSparkCommitment { + pub(in crate::spartan) fn commit(&self, ck: &CommitmentKey) -> R1CSShapeSparkCommitment { let comm_vec: Vec> = [ &self.row, &self.col, @@ -201,7 +201,7 @@ impl R1CSShapeSparkRepr { } // computes evaluation oracles - pub(in crate::spartan) fn evaluation_oracles( + fn evaluation_oracles( &self, S: &R1CSShape, r_x: &E::Scalar, @@ -257,7 +257,11 @@ pub struct WitnessBoundSumcheck { } impl WitnessBoundSumcheck { - fn new(tau: E::Scalar, poly_W_padded: Vec, num_vars: usize) -> Self { + pub(in crate::spartan) fn new( + tau: E::Scalar, + poly_W_padded: Vec, + 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 @@ -315,7 +319,7 @@ impl SumcheckEngine for WitnessBoundSumcheck { } } -struct MemorySumcheckInstance { +pub(in crate::spartan) struct MemorySumcheckInstance { // row w_plus_r_row: MultilinearPolynomial, t_plus_r_row: MultilinearPolynomial, diff --git a/src/spartan/snark.rs b/src/spartan/snark.rs index b59b6bf5..0a5083d3 100644 --- a/src/spartan/snark.rs +++ b/src/spartan/snark.rs @@ -421,7 +421,7 @@ impl> RelaxedR1CSSNARKTrait 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( +pub(in crate::spartan) fn batch_eval_reduce( u_vec: Vec>, w_vec: Vec>, transcript: &mut E::TE, @@ -495,7 +495,7 @@ fn batch_eval_reduce( /// Verifies a batch of polynomial evaluation claims using Sumcheck /// reducing them to a single claim at the same point. -fn batch_eval_verify( +pub(in crate::spartan) fn batch_eval_verify( u_vec: Vec>, transcript: &mut E::TE, sc_proof_batch: &SumcheckProof, diff --git a/src/supernova/mod.rs b/src/supernova/mod.rs index 4acb62dc..d6ca7b92 100644 --- a/src/supernova/mod.rs +++ b/src/supernova/mod.rs @@ -82,7 +82,7 @@ where C2: StepCircuit, { /// The internal circuit shapes - pub circuit_shapes: Vec>, + circuit_shapes: Vec>, ro_consts_primary: ROConstants, ro_consts_circuit_primary: ROConstantsCircuit, @@ -373,7 +373,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() @@ -1004,30 +1004,6 @@ where fn secondary_circuit(&self) -> C2; } -/// Extension trait to simplify getting scalar form of initial circuit index. -pub trait InitialProgramCounter: NonUniformCircuit -where - E1: Engine::Scalar>, - E2: Engine::Scalar>, - C1: StepCircuit, - C2: StepCircuit, -{ - /// 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> InitialProgramCounter - for T -where - E1: Engine::Scalar>, - E2: Engine::Scalar>, - C1: StepCircuit, - C2: StepCircuit, -{ -} - /// Compute the circuit digest of a supernova [StepCircuit]. /// /// Note for callers: This function should be called with its performance characteristics in mind. @@ -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;