Skip to content

Commit

Permalink
refactor: substitute batched pre-processing SNARK for preprocecssing …
Browse files Browse the repository at this point in the history
…SNARK
  • Loading branch information
huitseeker committed Feb 23, 2024
1 parent 2020d73 commit 72e6c8e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 937 deletions.
34 changes: 2 additions & 32 deletions benches/compressed-snark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ cfg_if::cfg_if! {
criterion_group! {
name = compressed_snark;
config = Criterion::default().warm_up_time(Duration::from_millis(3000)).with_profiler(pprof::criterion::PProfProfiler::new(100, pprof::criterion::Output::Flamegraph(None)));
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark_with_computational_commitments
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments,
}
} else {
criterion_group! {
name = compressed_snark;
config = Criterion::default().warm_up_time(Duration::from_millis(3000));
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments, bench_compressed_batched_snark_with_computational_commitments
targets = bench_compressed_snark, bench_compressed_snark_with_computational_commitments,
}
}
}
Expand Down Expand Up @@ -188,36 +188,6 @@ fn bench_compressed_snark_with_computational_commitments(c: &mut Criterion) {
}
}

// SNARKs with computation commitmnets
type BSS1 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E1, EE1>;
type BSS2 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E2, EE2>;

fn bench_compressed_batched_snark_with_computational_commitments(c: &mut Criterion) {
// we vary the number of constraints in the step circuit
for &num_cons_in_augmented_circuit in [
NUM_CONS_VERIFIER_CIRCUIT_PRIMARY,
16384,
32768,
65536,
131072,
262144,
]
.iter()
{
// number of constraints in the step circuit
let num_cons = num_cons_in_augmented_circuit - NUM_CONS_VERIFIER_CIRCUIT_PRIMARY;

let mut group = c.benchmark_group("BatchedCompressedSNARK-Commitments");
group.sampling_mode(SamplingMode::Flat);
group.sample_size(NUM_SAMPLES);
group.noise_threshold(noise_threshold_env().unwrap_or(0.05));

bench_compressed_snark_internal::<BSS1, BSS2>(&mut group, num_cons);

group.finish();
}
}

#[derive(Clone, Debug, Default)]
struct NonTrivialCircuit<F: PrimeField> {
num_cons: usize,
Expand Down
1 change: 0 additions & 1 deletion src/spartan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use crate::{
};
use ff::Field;
use itertools::Itertools as _;
use polys::multilinear::SparsePolynomial;
use rayon::{iter::IntoParallelRefIterator, prelude::*};
use rayon_scan::ScanParallelIterator as _;
use ref_cast::RefCast;
Expand Down
7 changes: 0 additions & 7 deletions src/spartan/polys/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ impl<Scalar: PrimeField> PowPolynomial<Scalar> {
pub fn coordinates(self) -> Vec<Scalar> {
self.eq.r
}

/// Evaluates the `PowPolynomial` at all the `2^|t_pow|` points in its domain.
///
/// Returns a vector of Scalars, each corresponding to the polynomial evaluation at a specific point.
pub fn evals(&self) -> Vec<Scalar> {
self.eq.evals()
}
}

impl<Scalar: PrimeField> From<PowPolynomial<Scalar>> for EqPolynomial<Scalar> {
Expand Down
Loading

0 comments on commit 72e6c8e

Please sign in to comment.