Skip to content

Commit

Permalink
chore: Remove redundant absorptions in MLKZG implementation (microsof…
Browse files Browse the repository at this point in the history
…t#206)

* chore: Remove redundant data absorptions while 'q' computing

* chore: Remove redundant absorptions to transcript while 'd_0' computing

* chore: Remove redundant absorptions to transcript while 'r' computing

* chore: Apply rustfmt

* chore: Absorb 'com' while 'r' computing
  • Loading branch information
storojs72 authored and huitseeker committed Feb 21, 2024
1 parent 3b73759 commit d576e67
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 482 deletions.
3 changes: 2 additions & 1 deletion benches/compressed-snark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use halo2curves::bn256::Bn256;
use core::marker::PhantomData;
use criterion::{measurement::WallTime, *};
use ff::PrimeField;
Expand All @@ -17,7 +18,7 @@ use std::time::Duration;

type E1 = Bn256EngineKZG;
type E2 = GrumpkinEngine;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<E1>;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<Bn256, E1>;
type EE2 = nova_snark::provider::ipa_pc::EvaluationEngine<E2>;
// SNARKs without computational commitments
type S1 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E1, EE1>;
Expand Down
3 changes: 2 additions & 1 deletion benches/ppsnark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(non_snake_case)]

use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use halo2curves::bn256::Bn256;
use core::marker::PhantomData;
use criterion::*;
use ff::PrimeField;
Expand All @@ -12,7 +13,7 @@ use nova_snark::{
use std::time::Duration;

type E = Bn256EngineKZG;
type EE = nova_snark::provider::hyperkzg::EvaluationEngine<E>;
type EE = nova_snark::provider::hyperkzg::EvaluationEngine<Bn256, E>;
type S = nova_snark::spartan::ppsnark::RelaxedR1CSSNARK<E, EE>;

// To run these benchmarks, first download `criterion` with `cargo install cargo install cargo-criterion`.
Expand Down
3 changes: 2 additions & 1 deletion examples/and.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use core::marker::PhantomData;
use ff::Field;
use ff::{PrimeField, PrimeFieldBits};
use flate2::{write::ZlibEncoder, Compression};
use halo2curves::bn256::Bn256;
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand All @@ -22,7 +23,7 @@ use std::time::Instant;

type E1 = Bn256EngineKZG;
type E2 = GrumpkinEngine;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<E1>;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<Bn256, E1>;
type EE2 = nova_snark::provider::ipa_pc::EvaluationEngine<E2>;
type S1 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E1, EE1>; // non-preprocessing SNARK
type S2 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E2, EE2>; // non-preprocessing SNARK
Expand Down
3 changes: 2 additions & 1 deletion examples/hashchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use ff::Field;
use flate2::{write::ZlibEncoder, Compression};
use generic_array::typenum::U24;
use halo2curves::bn256::Bn256;
use neptune::{
circuit2::Elt,
sponge::{
Expand All @@ -26,7 +27,7 @@ use std::time::Instant;

type E1 = Bn256EngineKZG;
type E2 = GrumpkinEngine;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<E1>;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<Bn256, E1>;
type EE2 = nova_snark::provider::ipa_pc::EvaluationEngine<E2>;
type S1 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E1, EE1>; // non-preprocessing SNARK
type S2 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E2, EE2>; // non-preprocessing SNARK
Expand Down
3 changes: 2 additions & 1 deletion examples/minroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use bellpepper_core::{num::AllocatedNum, ConstraintSystem, SynthesisError};
use ff::Field;
use flate2::{write::ZlibEncoder, Compression};
use halo2curves::bn256::Bn256;
use nova_snark::{
provider::{Bn256EngineKZG, GrumpkinEngine},
traits::{
Expand All @@ -18,7 +19,7 @@ use std::time::Instant;

type E1 = Bn256EngineKZG;
type E2 = GrumpkinEngine;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<E1>;
type EE1 = nova_snark::provider::hyperkzg::EvaluationEngine<Bn256, E1>;
type EE2 = nova_snark::provider::ipa_pc::EvaluationEngine<E2>;
type S1 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E1, EE1>; // non-preprocessing SNARK
type S2 = nova_snark::spartan::snark::RelaxedR1CSSNARK<E2, EE2>; // non-preprocessing SNARK
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ mod tests {
use halo2curves::bn256::Bn256;

type EE<E> = provider::ipa_pc::EvaluationEngine<E>;
type EEPrime<E> = provider::hyperkzg::EvaluationEngine<E>;
type EEPrime<E> = provider::hyperkzg::EvaluationEngine<Bn256, E>;
type S<E, EE> = spartan::snark::RelaxedR1CSSNARK<E, EE>;
type SPrime<E, EE> = spartan::ppsnark::RelaxedR1CSSNARK<E, EE>;

Expand Down Expand Up @@ -1202,7 +1202,7 @@ mod tests {
test_ivc_nontrivial_with_spark_compression_with::<
Bn256EngineKZG,
GrumpkinEngine,
provider::hyperkzg::EvaluationEngine<_>,
provider::hyperkzg::EvaluationEngine<Bn256, _>,
EE<_>,
>();
}
Expand Down
Loading

0 comments on commit d576e67

Please sign in to comment.