Spartan variant with an IPA-based polynomial commitment scheme for compressing IVC proofs (#80)

* cleanup code

* compiles

* additional plumbing

* add padding

* Add missing file

* integrate

* add a separate test

* cleanup

* cleanup

* add checks for outer sum-check

* sum-checks pass

* sum-checks pass

* sum-checks pass

* Add polycommit checks to the end

* switch to pasta_msm

* clippy

* remove int_log

* switch to pasta_curves

* clippy

* clippy

* add a special case for bases.len() = 1

* use naive MSM to avoid SIGFE error for smaller MSMs

* add rayon parallelism to naive MSM

* update comment since we already implement it

* address clippy

* cleanup map and reduce code

* add parallelism to final SNARK creation and verification

* add par

* add par

* add par

* add par

* store padded shapes in the parameters

* Address clippy

* pass padded shape in params

* pass padded shape in params

* cargo fmt

* add par

* add par

* Add par

* cleanup with a reorg

* factor out spartan-based snark into a separate module

* create traits for RelaxedR1CSSNARK

* make CompressedSNARK parameterized by a SNARK satisfying our new trait

* fix benches

* cleanup code

* remove unused

* move code to Spartan-based SNARK

* make unused function private

* rename IPA types for clarity

* cleanup

* return error types; rename r_j to r_i

* fix duplicate code
This commit is contained in:
Srinath Setty
2022-07-01 15:53:00 -07:00
committed by GitHub
parent 81b12232fe
commit 0ff2e57bfa
15 changed files with 1781 additions and 136 deletions

View File

@@ -1,8 +1,5 @@
#![allow(non_snake_case)]
extern crate flate2;
//use flate2::{write::ZlibEncoder, Compression};
use nova_snark::{
traits::{Group, StepCircuit},
CompressedSNARK, PublicParams, RecursiveSNARK,
@@ -10,6 +7,8 @@ use nova_snark::{
type G1 = pasta_curves::pallas::Point;
type G2 = pasta_curves::vesta::Point;
type S1 = nova_snark::spartan_with_ipa_pc::RelaxedR1CSSNARK<G1>;
type S2 = nova_snark::spartan_with_ipa_pc::RelaxedR1CSSNARK<G2>;
use bellperson::{gadgets::num::AllocatedNum, ConstraintSystem, SynthesisError};
use core::marker::PhantomData;
@@ -65,22 +64,17 @@ fn bench_compressed_snark(c: &mut Criterion, num_samples: usize, num_steps: usiz
// Bench time to produce a compressed SNARK
group.bench_function("Prove", |b| {
b.iter(|| {
assert!(CompressedSNARK::prove(black_box(&pp), black_box(&recursive_snark)).is_ok());
assert!(CompressedSNARK::<_, _, _, _, S1, S2>::prove(
black_box(&pp),
black_box(&recursive_snark)
)
.is_ok());
})
});
let res = CompressedSNARK::prove(&pp, &recursive_snark);
let res = CompressedSNARK::<_, _, _, _, S1, S2>::prove(&pp, &recursive_snark);
assert!(res.is_ok());
let compressed_snark = res.unwrap();
// Output the proof size
//let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default());
//bincode::serialize_into(&mut encoder, &compressed_snark).unwrap();
//let proof_encoded = encoder.finish().unwrap();
//println!(
// "ProofSize: {} B",
// proof_encoded.len(),
//);
// Benchmark the verification time
let name = "Verify";
group.bench_function(name, |b| {

View File

@@ -1,8 +1,5 @@
#![allow(non_snake_case)]
extern crate flate2;
//use flate2::{write::ZlibEncoder, Compression};
use nova_snark::{
traits::{Group, StepCircuit},
PublicParams, RecursiveSNARK,
@@ -75,7 +72,6 @@ fn bench_recursive_snark(c: &mut Criterion, num_samples: usize, num_steps: usize
assert!(res.is_ok());
let recursive_snark = res.unwrap();
// TODO: Output the proof size
// Benchmark the verification time
let name = "Verify";
group.bench_function(name, |b| {