diff --git a/benches/end2end.rs b/benches/end2end.rs index 77ffecdd95..72e7d4a982 100644 --- a/benches/end2end.rs +++ b/benches/end2end.rs @@ -9,7 +9,6 @@ use lurk::{ field::LurkField, lem::{ eval::{evaluate, evaluate_simple}, - multiframe::MultiFrame, pointers::Ptr, store::Store, }, @@ -74,7 +73,7 @@ fn end2end_benchmark(c: &mut Criterion) { true, Kind::NovaPublicParams, ); - let pp = public_parameters::public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_parameters::public_params(&instance).unwrap(); let size = (10, 0); let benchmark_id = BenchmarkId::new("end2end_go_base_nova", format!("_{}_{}", size.0, size.1)); @@ -245,7 +244,7 @@ fn prove_benchmark(c: &mut Criterion) { true, Kind::NovaPublicParams, ); - let pp = public_parameters::public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_parameters::public_params(&instance).unwrap(); group.bench_with_input(benchmark_id, &size, |b, &s| { let ptr = go_base::(&store, state.clone(), s.0, s.1); @@ -293,7 +292,7 @@ fn prove_compressed_benchmark(c: &mut Criterion) { true, Kind::NovaPublicParams, ); - let pp = public_parameters::public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_parameters::public_params(&instance).unwrap(); group.bench_with_input(benchmark_id, &size, |b, &s| { let ptr = go_base::(&store, state.clone(), s.0, s.1); @@ -335,7 +334,7 @@ fn verify_benchmark(c: &mut Criterion) { true, Kind::NovaPublicParams, ); - let pp = public_parameters::public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_parameters::public_params(&instance).unwrap(); let sizes = [(10, 0)]; for size in sizes { @@ -387,7 +386,7 @@ fn verify_compressed_benchmark(c: &mut Criterion) { true, Kind::NovaPublicParams, ); - let pp = public_parameters::public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_parameters::public_params(&instance).unwrap(); let sizes = [(10, 0)]; for size in sizes { diff --git a/benches/fibonacci.rs b/benches/fibonacci.rs index 1a3b3f1711..9eee2d4125 100644 --- a/benches/fibonacci.rs +++ b/benches/fibonacci.rs @@ -8,7 +8,7 @@ use std::{sync::Arc, time::Duration}; use lurk::{ eval::lang::{Coproc, Lang}, - lem::{eval::evaluate, multiframe::MultiFrame, store::Store}, + lem::{eval::evaluate, store::Store}, proof::nova::NovaProver, proof::Prover, public_parameters::{ @@ -95,7 +95,7 @@ fn fibonacci_prove( true, Kind::NovaPublicParams, ); - let pp = public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_params(&instance).unwrap(); // Track the number of `Lurk frames / sec` let rc = prove_params.reduction_count as u64; diff --git a/benches/sha256.rs b/benches/sha256.rs index c6796eaaa1..9242f146c1 100644 --- a/benches/sha256.rs +++ b/benches/sha256.rs @@ -19,7 +19,6 @@ use lurk::{ field::LurkField, lem::{ eval::{evaluate, make_cprocs_funcs_from_lang, make_eval_step_from_config, EvalConfig}, - multiframe::MultiFrame, pointers::Ptr, store::Store, }, @@ -112,13 +111,13 @@ fn sha256_ivc_prove( let lurk_step = make_eval_step_from_config(&EvalConfig::new_ivc(&lang)); // use cached public params - let instance: Instance<'_, Fr, Sha256Coproc, MultiFrame<'_, _, _>> = Instance::new( + let instance: Instance<'_, Fr, Sha256Coproc> = Instance::new( reduction_count, lang_rc.clone(), true, Kind::NovaPublicParams, ); - let pp = public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_params(&instance).unwrap(); c.bench_with_input( BenchmarkId::new(prove_params.name(), arity), @@ -199,7 +198,7 @@ fn sha256_ivc_prove_compressed( true, Kind::NovaPublicParams, ); - let pp = public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_params(&instance).unwrap(); c.bench_with_input( BenchmarkId::new(prove_params.name(), arity), @@ -283,7 +282,7 @@ fn sha256_nivc_prove( true, Kind::SuperNovaAuxParams, ); - let pp = supernova_public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = supernova_public_params(&instance).unwrap(); c.bench_with_input( BenchmarkId::new(prove_params.name(), arity), diff --git a/examples/circom.rs b/examples/circom.rs index c03b73c886..42039e990a 100644 --- a/examples/circom.rs +++ b/examples/circom.rs @@ -34,7 +34,6 @@ use std::time::Instant; use lurk::circuit::gadgets::circom::CircomGadget; use lurk::circuit::gadgets::pointer::AllocatedPtr; -use lurk::lem::multiframe::MultiFrame; #[cfg(not(target_arch = "wasm32"))] use lurk::coprocessor::circom::non_wasm::CircomCoprocessor; @@ -116,7 +115,7 @@ fn main() { let pp_start = Instant::now(); let instance = Instance::new(REDUCTION_COUNT, lang_rc, true, Kind::NovaPublicParams); - let pp = public_params::<_, _, MultiFrame<'_, _, _>>(&instance).unwrap(); + let pp = public_params(&instance).unwrap(); let pp_end = pp_start.elapsed(); println!("Public parameters took {pp_end:?}"); diff --git a/examples/sha256_nivc.rs b/examples/sha256_nivc.rs index 1b55ee6633..b8769f6102 100644 --- a/examples/sha256_nivc.rs +++ b/examples/sha256_nivc.rs @@ -9,7 +9,6 @@ use lurk::{ field::LurkField, lem::{ eval::{evaluate, make_cprocs_funcs_from_lang, make_eval_step_from_config, EvalConfig}, - multiframe::MultiFrame, pointers::Ptr, store::Store, }, @@ -87,7 +86,7 @@ fn main() { let pp_start = Instant::now(); let instance_primary = Instance::new(REDUCTION_COUNT, lang_rc, true, Kind::SuperNovaAuxParams); - let pp = supernova_public_params::<_, _, MultiFrame<'_, _, _>>(&instance_primary).unwrap(); + let pp = supernova_public_params(&instance_primary).unwrap(); let pp_end = pp_start.elapsed(); println!("Running claim parameters took {:?}", pp_end); diff --git a/src/proof/nova.rs b/src/proof/nova.rs index c5453bd7ee..97ce49dd3f 100644 --- a/src/proof/nova.rs +++ b/src/proof/nova.rs @@ -180,17 +180,12 @@ where /// /// Note: For now, we use ad-hoc circuit cache keys. /// See: [crate::public_parameters::instance] -pub fn circuit_cache_key< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, ->( +pub fn circuit_cache_key<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( rc: usize, lang: Arc>, ) -> F { let folding_config = Arc::new(FoldingConfig::new_ivc(lang, 2)); - let circuit = M::blank(folding_config, 0); + let circuit = C1LEM::<'a, F, C>::blank(folding_config, 0); F::from(rc as u64) * nova::circuit_digest::(&circuit) } diff --git a/src/proof/supernova.rs b/src/proof/supernova.rs index bbf05ae666..10ce369a5e 100644 --- a/src/proof/supernova.rs +++ b/src/proof/supernova.rs @@ -331,12 +331,7 @@ impl> FoldingConfig { /// /// Note: For now, we use ad-hoc circuit cache keys. /// See: [crate::public_parameters::instance] -pub fn circuit_cache_key< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C> + SuperStepCircuit + NonUniformCircuit, E2, M, C2>, ->( +pub fn circuit_cache_key<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( rc: usize, lang: Arc>, circuit_index: usize, @@ -346,7 +341,7 @@ where < as Engine>::Scalar as PrimeField>::Repr: Abomonation, { let folding_config = Arc::new(FoldingConfig::new_nivc(lang, 2)); - let circuit = M::blank(folding_config, 0); + let circuit = C1LEM::<'a, F, C>::blank(folding_config, 0); let num_circuits = circuit.num_circuits(); let circuit = circuit.primary_circuit(circuit_index); F::from(rc as u64) * supernova::circuit_digest::(&circuit, num_circuits) @@ -354,12 +349,7 @@ where /// Collects all the cache keys of supernova instance. We need all of them to compute /// a cache key for the digest of the [PublicParams] of the supernova instance. -pub fn circuit_cache_keys< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C> + SuperStepCircuit + NonUniformCircuit, E2, M, C2>, ->( +pub fn circuit_cache_keys<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( rc: usize, lang: &Arc>, ) -> CircuitDigests> @@ -369,7 +359,7 @@ where { let num_circuits = lang.coprocessor_count() + 1; let digests = (0..num_circuits) - .map(|circuit_index| circuit_cache_key::(rc, lang.clone(), circuit_index)) + .map(|circuit_index| circuit_cache_key::(rc, lang.clone(), circuit_index)) .collect(); CircuitDigests::new(digests) } diff --git a/src/public_parameters/disk_cache.rs b/src/public_parameters/disk_cache.rs index 312793a797..c54cbc27a2 100644 --- a/src/public_parameters/disk_cache.rs +++ b/src/public_parameters/disk_cache.rs @@ -8,8 +8,7 @@ use nova::traits::Engine; use crate::config::lurk_config; use crate::coprocessor::Coprocessor; -use crate::proof::nova::{CurveCycleEquipped, PublicParams, E1, E2}; -use crate::proof::MultiFrameTrait; +use crate::proof::nova::{CurveCycleEquipped, PublicParams, C1LEM, E1, E2}; use crate::public_parameters::error::Error; use super::instance::Instance; @@ -20,18 +19,16 @@ pub(crate) fn public_params_dir() -> &'static Utf8PathBuf { &lurk_config(None, None).public_params_dir } -pub(crate) struct DiskCache<'a, F, C, M> +pub(crate) struct DiskCache<'a, F, C> where F: CurveCycleEquipped, C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, { dir: Utf8PathBuf, - _t: PhantomData<(&'a (), F, C, M)>, + _t: PhantomData<(&'a (), F, C)>, } -impl<'a, F: CurveCycleEquipped, C: Coprocessor + 'a, M: MultiFrameTrait<'a, F, C>> - DiskCache<'a, F, C, M> +impl<'a, F: CurveCycleEquipped, C: Coprocessor + 'a> DiskCache<'a, F, C> where // technical bounds that would disappear once associated_type_bounds stabilizes < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, @@ -48,8 +45,8 @@ where pub(crate) fn read( &self, - instance: &Instance<'a, F, C, M>, - ) -> Result, Error> { + instance: &Instance<'a, F, C>, + ) -> Result>, Error> { let file = instance.open(&self.dir)?; let reader = BufReader::new(file); bincode::deserialize_from(reader) @@ -58,7 +55,7 @@ where pub(crate) fn read_bytes( &self, - instance: &Instance<'a, F, C, M>, + instance: &Instance<'a, F, C>, byte_sink: &mut Vec, ) -> Result<(), Error> { let file = instance.open(&self.dir)?; @@ -69,8 +66,8 @@ where pub(crate) fn write( &self, - instance: &Instance<'a, F, C, M>, - data: &PublicParams, + instance: &Instance<'a, F, C>, + data: &PublicParams>, ) -> Result<(), Error> { let file = instance.create(&self.dir)?; let writer = BufWriter::new(&file); @@ -80,7 +77,7 @@ where pub(crate) fn write_abomonated( &self, - instance: &Instance<'a, F, C, M>, + instance: &Instance<'a, F, C>, data: &V, ) -> Result<(), Error> { let mut file = instance.create(&self.dir)?; diff --git a/src/public_parameters/instance.rs b/src/public_parameters/instance.rs index f30cc3977c..ad378467ab 100644 --- a/src/public_parameters/instance.rs +++ b/src/public_parameters/instance.rs @@ -42,11 +42,7 @@ use std::{ sync::Arc, }; -use ::nova::{ - constants::NUM_HASH_BITS, - supernova::{NonUniformCircuit, StepCircuit as SuperStepCircuit}, - traits::Engine, -}; +use ::nova::{constants::NUM_HASH_BITS, traits::Engine}; use abomonation::Abomonation; use camino::Utf8Path; use serde::{Deserialize, Serialize}; @@ -55,10 +51,9 @@ use sha2::{Digest, Sha256}; use crate::{ coprocessor::Coprocessor, eval::lang::Lang, - proof::MultiFrameTrait, proof::{ nova::{self, CurveCycleEquipped, E1, E2}, - supernova::{self, C2}, + supernova::{self}, }, }; @@ -74,14 +69,13 @@ use crate::{ /// we derive the `num_circuits + 1` circuit param instances. This makes sure that we keep the SuperNova /// instances as modular as possible, and reuse as much overlapping circuit params as possible. #[derive(Debug)] -pub struct Instance<'a, F: CurveCycleEquipped, C: Coprocessor + 'a, M: MultiFrameTrait<'a, F, C>> -{ +pub struct Instance<'a, F: CurveCycleEquipped, C: Coprocessor + 'a> { pub rc: usize, pub lang: Arc>, pub abomonated: bool, pub cache_key: F, pub kind: Kind, - pub _p: PhantomData<&'a M>, + pub _p: PhantomData<&'a ()>, } /// From [::nova], there are 3 "kinds" of public param objects that need to be cached. @@ -112,13 +106,8 @@ pub struct Metadata { } impl Metadata { - fn from_instance< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, - >( - instance: &Instance<'a, F, C, M>, + fn from_instance<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( + instance: &Instance<'a, F, C>, ) -> Self { Metadata { rc: instance.rc, @@ -130,24 +119,17 @@ impl Metadata { } } -impl< - 'a, - F: CurveCycleEquipped, - C: Coprocessor, - M: MultiFrameTrait<'a, F, C> + SuperStepCircuit + NonUniformCircuit, E2, M, C2>, - > Instance<'a, F, C, M> +impl<'a, F: CurveCycleEquipped, C: Coprocessor> Instance<'a, F, C> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { pub fn new(rc: usize, lang: Arc>, abomonated: bool, kind: Kind) -> Self { let cache_key = match kind { - Kind::NovaPublicParams => nova::circuit_cache_key::<'a, F, C, M>(rc, lang.clone()), - Kind::SuperNovaAuxParams => { - supernova::circuit_cache_keys::(rc, &lang).digest() - } + Kind::NovaPublicParams => nova::circuit_cache_key::<'a, F, C>(rc, lang.clone()), + Kind::SuperNovaAuxParams => supernova::circuit_cache_keys::(rc, &lang).digest(), Kind::SuperNovaCircuitParams(circuit_index) => { - supernova::circuit_cache_key::<'a, F, C, M>(rc, lang.clone(), circuit_index) + supernova::circuit_cache_key::<'a, F, C>(rc, lang.clone(), circuit_index) } }; Instance { @@ -193,8 +175,7 @@ where } } -impl<'a, F: CurveCycleEquipped, C: Coprocessor, M: MultiFrameTrait<'a, F, C>> - Instance<'a, F, C, M> +impl<'a, F: CurveCycleEquipped, C: Coprocessor> Instance<'a, F, C> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, diff --git a/src/public_parameters/mem_cache.rs b/src/public_parameters/mem_cache.rs index 3941392a0e..64d4899a3f 100644 --- a/src/public_parameters/mem_cache.rs +++ b/src/public_parameters/mem_cache.rs @@ -9,7 +9,7 @@ use once_cell::sync::Lazy; use tap::TapFallible; use tracing::{info, warn}; -use crate::proof::MultiFrameTrait; +use crate::proof::nova::C1LEM; use crate::{ coprocessor::Coprocessor, proof::nova::{PublicParams, E1, E2}, @@ -41,15 +41,15 @@ pub(crate) static PUBLIC_PARAM_MEM_CACHE: Lazy = impl PublicParamMemCache { fn get_from_disk_cache_or_update_with< + 'a, F: CurveCycleEquipped, C: Coprocessor + 'static, - M: MultiFrameTrait<'static, F, C>, - Fn: FnOnce(&Instance<'static, F, C, M>) -> Arc>, + Fn: FnOnce(&Instance<'static, F, C>) -> Arc>>, >( &'static self, - instance: &Instance<'static, F, C, M>, + instance: &Instance<'static, F, C>, default: Fn, - ) -> Result>, Error> + ) -> Result>>, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, @@ -63,7 +63,8 @@ impl PublicParamMemCache { match disk_cache.read_bytes(instance, &mut bytes) { Ok(()) => { info!("loading abomonated {}", instance.key()); - let (pp, rest) = unsafe { decode::>(&mut bytes).unwrap() }; + let (pp, rest) = + unsafe { decode::>>(&mut bytes).unwrap() }; assert!(rest.is_empty()); Ok(Arc::new(pp.clone())) // this clone is VERY expensive } @@ -103,13 +104,12 @@ impl PublicParamMemCache { pub(crate) fn get_from_mem_cache_or_update_with< F: CurveCycleEquipped, C: Coprocessor + 'static, - M: MultiFrameTrait<'static, F, C>, - Fn: FnOnce(&Instance<'static, F, C, M>) -> Arc>, + Fn: FnOnce(&Instance<'static, F, C>) -> Arc>>, >( &'static self, - instance: &Instance<'static, F, C, M>, + instance: &Instance<'static, F, C>, default: Fn, - ) -> Result>, Error> + ) -> Result>>, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, @@ -117,7 +117,7 @@ impl PublicParamMemCache { // re-grab the lock let mut mem_cache = self.mem_cache.lock().unwrap(); // retrieve the per-Coproc public param table - let entry = mem_cache.entry::>(); + let entry = mem_cache.entry::>>(); // deduce the map and populate it if needed let param_entry = entry.or_default(); match param_entry.entry((instance.rc, instance.abomonated)) { diff --git a/src/public_parameters/mod.rs b/src/public_parameters/mod.rs index 4d4bd54cab..900c868014 100644 --- a/src/public_parameters/mod.rs +++ b/src/public_parameters/mod.rs @@ -3,9 +3,8 @@ use abomonation::{decode, Abomonation}; use std::sync::Arc; use crate::coprocessor::Coprocessor; -use crate::proof::nova::{self, NovaCircuitShape, PublicParams}; +use crate::proof::nova::{self, NovaCircuitShape, PublicParams, C1LEM}; use crate::proof::nova::{CurveCycleEquipped, E1, E2}; -use crate::proof::MultiFrameTrait; pub mod disk_cache; mod error; @@ -19,18 +18,14 @@ use crate::public_parameters::error::Error; use self::disk_cache::DiskCache; use self::instance::Instance; -pub fn public_params< - F: CurveCycleEquipped, - C: Coprocessor + 'static, - M: MultiFrameTrait<'static, F, C>, ->( - instance: &Instance<'static, F, C, M>, -) -> Result>, Error> +pub fn public_params<'a, F: CurveCycleEquipped, C: Coprocessor + 'static>( + instance: &Instance<'static, F, C>, +) -> Result>>, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { - let f = |instance: &Instance<'static, F, C, M>| { + let f = |instance: &Instance<'static, F, C>| { Arc::new(nova::public_params(instance.rc, instance.lang())) }; mem_cache::PUBLIC_PARAM_MEM_CACHE.get_from_mem_cache_or_update_with(instance, f) @@ -42,20 +37,18 @@ where /// to the lifetime of the file. Thus, we cannot pass a reference out and must /// rely on a closure to capture the data and continue the computation in `bind`. pub fn with_public_params<'a, F, C, M, Fn, T>( - instance: &Instance<'a, F, C, M>, + instance: &Instance<'a, F, C>, bind: Fn, ) -> Result where F: CurveCycleEquipped, C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, - Fn: FnOnce(&PublicParams) -> T, + Fn: FnOnce(&PublicParams>) -> T, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { - let default = - |instance: &Instance<'a, F, C, M>| nova::public_params(instance.rc, instance.lang()); - let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); + let default = |instance: &Instance<'a, F, C>| nova::public_params(instance.rc, instance.lang()); + let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); let mut bytes = vec![]; let pp = disk_cache.read_bytes(instance, &mut bytes).and_then(|()| { @@ -79,19 +72,14 @@ where } } -pub fn supernova_circuit_params< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, ->( - instance: &Instance<'a, F, C, M>, +pub fn supernova_circuit_params<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( + instance: &Instance<'a, F, C>, ) -> Result, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { - let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); + let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); let mut bytes = vec![]; disk_cache.read_bytes(instance, &mut bytes).and_then(|()| { @@ -105,19 +93,14 @@ where }) } -pub fn supernova_aux_params< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C>, ->( - instance: &Instance<'a, F, C, M>, +pub fn supernova_aux_params<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( + instance: &Instance<'a, F, C>, ) -> Result, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { - let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); + let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); let mut bytes = vec![]; disk_cache.read_bytes(instance, &mut bytes).and_then(|()| { @@ -133,41 +116,35 @@ where } /// Attempts to extract abomonated public parameters. -use ::nova::supernova::NonUniformCircuit; -use ::nova::supernova::StepCircuit as SuperStepCircuit; -use supernova::C2; -pub fn supernova_public_params< - 'a, - F: CurveCycleEquipped, - C: Coprocessor + 'a, - M: MultiFrameTrait<'a, F, C> + SuperStepCircuit + NonUniformCircuit, E2, M, C2>, ->( - instance_primary: &Instance<'a, F, C, M>, -) -> Result, Error> +pub fn supernova_public_params<'a, F: CurveCycleEquipped, C: Coprocessor + 'a>( + instance_primary: &Instance<'a, F, C>, +) -> Result>, Error> where < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, < as Engine>::Scalar as ff::PrimeField>::Repr: Abomonation, { - let default = |instance: &Instance<'a, F, C, M>| { - supernova::public_params::<'a, F, C, M>(instance.rc, instance.lang()) + let default = |instance: &Instance<'a, F, C>| { + supernova::public_params::<'a, F, C, C1LEM<'a, F, C>>(instance.rc, instance.lang()) }; - let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); + let disk_cache = DiskCache::::new(public_params_dir()).unwrap(); let maybe_circuit_params_vec = instance_primary .circuit_param_instances() .iter() - .map(|instance| supernova_circuit_params::(instance)) + .map(|instance| supernova_circuit_params::(instance)) .collect::>, _>>(); - let maybe_aux_params = supernova_aux_params::(instance_primary); + let maybe_aux_params = supernova_aux_params::(instance_primary); let pp = if let (Ok(circuit_params_vec), Ok(aux_params)) = (maybe_circuit_params_vec, maybe_aux_params) { println!("generating public params"); - let pp = - SuperNovaPublicParams::::from_parts_unchecked(circuit_params_vec, aux_params); + let pp = SuperNovaPublicParams::>::from_parts_unchecked( + circuit_params_vec, + aux_params, + ); let (pk, vk) = CompressedSNARK::setup(&pp).unwrap(); supernova::PublicParams { pp, pk, vk } @@ -184,8 +161,10 @@ where disk_cache.write_abomonated(&instance, circuit_params)?; } - let pp = - SuperNovaPublicParams::::from_parts_unchecked(circuit_params_vec, aux_params); + let pp = SuperNovaPublicParams::>::from_parts_unchecked( + circuit_params_vec, + aux_params, + ); let (pk, vk) = CompressedSNARK::setup(&pp).unwrap(); supernova::PublicParams { pp, pk, vk } @@ -208,11 +187,10 @@ mod tests { std::env::set_var("LURK_PUBLIC_PARAMS", tmp_dir.path()); let lang: Arc>> = Arc::new(Lang::new()); - type OG = crate::proof::nova::C1LEM<'static, S1, Coproc>; let instance = Instance::new(10, lang, true, Kind::NovaPublicParams); // Without disk cache, writes to tmpfile - let _public_params = public_params::, OG>(&instance).unwrap(); + let _public_params = public_params::>(&instance).unwrap(); // With disk cache, reads from tmpfile - let _public_params = public_params::, OG>(&instance).unwrap(); + let _public_params = public_params::>(&instance).unwrap(); } }