Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return ZK #380

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ generic-array = "1.0.0"
num-bigint = { version = "0.4", features = ["serde", "rand"] }
num-traits = "0.2"
num-integer = "0.1"
serde = { version = "1.0", features = ["derive", "rc"] }
serde = { version = "1.0.197", features = ["derive", "rc"] }
bincode = "1.3"
bitvec = "1.0"
byteorder = "1.4.3"
Expand Down Expand Up @@ -94,21 +94,21 @@ harness = false
name = "sha256"
harness = false

[[bench]]
name = "recursive-snark-supernova"
harness = false
# [[bench]]
# name = "recursive-snark-supernova"
# harness = false

[[bench]]
name = "compressed-snark-supernova"
harness = false
# [[bench]]
# name = "compressed-snark-supernova"
# harness = false

[[bench]]
name = "supernova-ci"
harness = false
# harness = false

[[bench]]
name = "pcs"
harness = false
# [[bench]]
# name = "pcs"
# harness = false

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions benches/common/supernova/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::common::supernova::{
num_cons, NonUniformBench, SnarkType, E1, E2, NUM_CONS_VERIFIER_CIRCUIT_PRIMARY, NUM_SAMPLES,
};
use crate::common::{noise_threshold_env, BenchParams};
use arecibo::provider::{PallasEngine, VestaEngine};
use arecibo::{
provider::{Bn256EngineKZG, GrumpkinEngine},
supernova::NonUniformCircuit,
supernova::{snark::CompressedSNARK, PublicParams, RecursiveSNARK},
traits::{
Expand Down Expand Up @@ -144,8 +144,8 @@ pub fn bench_snark_internal_with_arity<
black_box(&mut recursive_snark.clone())
.verify(
black_box(&pp),
black_box(&[<Bn256EngineKZG as Engine>::Scalar::from(2u64)]),
black_box(&[<GrumpkinEngine as Engine>::Scalar::from(2u64)]),
black_box(&[<PallasEngine as Engine>::Scalar::from(2u64)]),
black_box(&[<VestaEngine as Engine>::Scalar::from(2u64)]),
)
.unwrap();
})
Expand Down
14 changes: 7 additions & 7 deletions benches/common/supernova/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ use core::marker::PhantomData;
use ff::PrimeField;
use halo2curves::bn256::Bn256;

pub type E1 = arecibo::provider::Bn256EngineKZG;
pub type E2 = arecibo::provider::GrumpkinEngine;
pub type EE1 = arecibo::provider::hyperkzg::EvaluationEngine<Bn256, E1>;
pub type E1 = arecibo::provider::PallasEngine;
pub type E2 = arecibo::provider::VestaEngine;
pub type EE1 = arecibo::provider::ipa_pc::EvaluationEngine<E1>;
pub type EE2 = arecibo::provider::ipa_pc::EvaluationEngine<E2>;
// SNARKs without computation commitments
pub type S1 = arecibo::spartan::batched::BatchedRelaxedR1CSSNARK<E1, EE1>;
pub type S2 = arecibo::spartan::snark::RelaxedR1CSSNARK<E2, EE2>;
// pub type S1 = arecibo::spartan::batched::BatchedRelaxedR1CSSNARK<E1, EE1>;
// pub type S2 = arecibo::spartan::zksnark::RelaxedR1CSSNARK<E2, EE2>;
// SNARKs with computation commitments
pub type SS1 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E1, EE1>;
pub type SS2 = arecibo::spartan::ppsnark::RelaxedR1CSSNARK<E2, EE2>;
// pub type SS1 = arecibo::spartan::batched_ppsnark::BatchedRelaxedR1CSSNARK<E1, EE1>;
// pub type SS2 = arecibo::spartan::ppsnark::RelaxedR1CSSNARK<E2, EE2>;

// This should match the value in test_supernova_recursive_circuit_pasta
// Note `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` is different for Nova and Supernova
Expand Down
56 changes: 28 additions & 28 deletions benches/common/supernova/targets.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
// Code is considered dead unless used in all benchmark targets
#![allow(dead_code)]
use criterion::Criterion;
// // Code is considered dead unless used in all benchmark targets
// #![allow(dead_code)]
// use criterion::Criterion;

use crate::common::supernova::{bench::run_bench, SnarkType, S1, S2, SS1, SS2};
// use crate::common::supernova::{bench::run_bench, SnarkType, S1, S2, SS1, SS2};

// Recursive Supernova SNARK benchmarks
pub fn bench_one_augmented_circuit_recursive_snark(c: &mut Criterion) {
run_bench::<S1, S2>(c, "RecursiveSNARK-NIVC-1", 1, SnarkType::Recursive)
}
// // Recursive Supernova SNARK benchmarks
// pub fn bench_one_augmented_circuit_recursive_snark(c: &mut Criterion) {
// run_bench::<S1, S2>(c, "RecursiveSNARK-NIVC-1", 1, SnarkType::Recursive)
// }

pub fn bench_two_augmented_circuit_recursive_snark(c: &mut Criterion) {
run_bench::<S1, S2>(c, "RecursiveSNARK-NIVC-2", 2, SnarkType::Recursive)
}
// pub fn bench_two_augmented_circuit_recursive_snark(c: &mut Criterion) {
// run_bench::<S1, S2>(c, "RecursiveSNARK-NIVC-2", 2, SnarkType::Recursive)
// }

// Compressed Supernova SNARK benchmarks
pub fn bench_one_augmented_circuit_compressed_snark(c: &mut Criterion) {
run_bench::<S1, S2>(c, "CompressedSNARK-NIVC-1", 1, SnarkType::Compressed)
}
// // Compressed Supernova SNARK benchmarks
// pub fn bench_one_augmented_circuit_compressed_snark(c: &mut Criterion) {
// run_bench::<S1, S2>(c, "CompressedSNARK-NIVC-1", 1, SnarkType::Compressed)
// }

pub fn bench_two_augmented_circuit_compressed_snark(c: &mut Criterion) {
run_bench::<S1, S2>(c, "CompressedSNARK-NIVC-2", 2, SnarkType::Compressed)
}
// pub fn bench_two_augmented_circuit_compressed_snark(c: &mut Criterion) {
// run_bench::<S1, S2>(c, "CompressedSNARK-NIVC-2", 2, SnarkType::Compressed)
// }

pub fn bench_two_augmented_circuit_compressed_snark_with_computational_commitments(
c: &mut Criterion,
) {
run_bench::<SS1, SS2>(
c,
"CompressedSNARK-NIVC-Commitments-2",
2,
SnarkType::Compressed,
)
}
// pub fn bench_two_augmented_circuit_compressed_snark_with_computational_commitments(
// c: &mut Criterion,
// ) {
// run_bench::<SS1, SS2>(
// c,
// "CompressedSNARK-NIVC-Commitments-2",
// 2,
// SnarkType::Compressed,
// )
// }
54 changes: 27 additions & 27 deletions benches/compressed-snark-supernova.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
use criterion::*;
use std::time::Duration;
// use criterion::*;
// use std::time::Duration;

mod common;
use common::supernova::targets::{
bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark,
bench_two_augmented_circuit_compressed_snark_with_computational_commitments,
};
// mod common;
// use common::supernova::targets::{
// bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark,
// bench_two_augmented_circuit_compressed_snark_with_computational_commitments,
// };

// To run these benchmarks, first download `criterion` with `cargo install cargo-criterion`.
// Then `cargo criterion --bench compressed-snark-supernova`. The results are located in `target/criterion/data/<name-of-benchmark>`.
// For flamegraphs, run `cargo criterion --bench compressed-snark-supernova --features flamegraph -- --profile-time <secs>`.
// The results are located in `target/criterion/profile/<name-of-benchmark>`.
cfg_if::cfg_if! {
if #[cfg(feature = "flamegraph")] {
criterion_group! {
name = compressed_snark_supernova;
config = Criterion::default().warm_up_time(Duration::from_millis(3000)).with_profiler(pprof::criterion::PProfProfiler::new(100, pprof::criterion::Output::Flamegraph(None)));
targets = bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark_with_computational_commitments
}
} else {
criterion_group! {
name = compressed_snark_supernova;
config = Criterion::default().warm_up_time(Duration::from_millis(3000));
targets = bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark_with_computational_commitments
}
}
}
// // To run these benchmarks, first download `criterion` with `cargo install cargo-criterion`.
// // Then `cargo criterion --bench compressed-snark-supernova`. The results are located in `target/criterion/data/<name-of-benchmark>`.
// // For flamegraphs, run `cargo criterion --bench compressed-snark-supernova --features flamegraph -- --profile-time <secs>`.
// // The results are located in `target/criterion/profile/<name-of-benchmark>`.
// cfg_if::cfg_if! {
// if #[cfg(feature = "flamegraph")] {
// criterion_group! {
// name = compressed_snark_supernova;
// config = Criterion::default().warm_up_time(Duration::from_millis(3000)).with_profiler(pprof::criterion::PProfProfiler::new(100, pprof::criterion::Output::Flamegraph(None)));
// targets = bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark_with_computational_commitments
// }
// } else {
// criterion_group! {
// name = compressed_snark_supernova;
// config = Criterion::default().warm_up_time(Duration::from_millis(3000));
// targets = bench_one_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark, bench_two_augmented_circuit_compressed_snark_with_computational_commitments
// }
// }
// }

criterion_main!(compressed_snark_supernova);
// criterion_main!(compressed_snark_supernova);
Loading
Loading