From e6a955a2480d4f5d413cccbf6c71f12990ba18c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Garillot?= Date: Wed, 20 Sep 2023 03:19:09 -0400 Subject: [PATCH] refactor: Tidying up changes after #677 That PR was on auto-merge. --- src/circuit/circuit_frame.rs | 40 +++++++++++++--------------------- src/circuit/gadgets/pointer.rs | 2 +- src/proof/nova.rs | 2 +- src/proof/supernova.rs | 4 +--- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/circuit/circuit_frame.rs b/src/circuit/circuit_frame.rs index cc7022c3e8..434f35a559 100644 --- a/src/circuit/circuit_frame.rs +++ b/src/circuit/circuit_frame.rs @@ -93,27 +93,19 @@ impl<'a, F: LurkField, C: Coprocessor> CircuitFrame<'a, F, C> { impl<'a, F: LurkField, C: Coprocessor> MultiFrame<'a, F, C> { pub fn blank(folding_config: Arc>, meta: Meta) -> Self { - match meta { - Meta::Lurk => Self { - store: None, - input: None, - output: None, - frames: None, - cached_witness: None, - count: folding_config.reduction_count(), - folding_config, - meta, - }, - Meta::Coprocessor(_z_ptr) => Self { - store: None, - input: None, - output: None, - frames: None, - cached_witness: None, - count: 1, - folding_config, - meta, - }, + let count = match meta { + Meta::Lurk => folding_config.reduction_count(), + Meta::Coprocessor(_zptr) => 1 + }; + Self { + store: None, + input: None, + output: None, + frames: None, + cached_witness: None, + count, + folding_config, + meta, } } @@ -141,9 +133,7 @@ impl<'a, F: LurkField, C: Coprocessor> MultiFrame<'a, F, C> { for x in chunk { let circuit_frame = CircuitFrame::from_frame(x, store); - if meta.is_none() { - meta = Some(x.meta); - } + meta.get_or_insert(x.meta); inner_frames.push(circuit_frame); } @@ -471,6 +461,7 @@ impl< type AllocatedIO = (AllocatedPtr, AllocatedPtr, AllocatedContPtr); impl> CircuitFrame<'_, F, C> { + #[tracing::instrument(skip_all, name = "CircuitFrame::synthesize", level="debug")] pub(crate) fn synthesize>( &self, cs: &mut CS, @@ -483,7 +474,6 @@ impl> CircuitFrame<'_, F, C> { cont_circuit_witness: Option>, ) -> Result, SynthesisError> { let (input_expr, input_env, input_cont) = inputs; - debug!("synthesizing frame"); let reduce = |store| { let cons_circuit_witness = if let Some(ccw) = cons_circuit_witness { ccw diff --git a/src/circuit/gadgets/pointer.rs b/src/circuit/gadgets/pointer.rs index 1a3243476a..d8af659845 100644 --- a/src/circuit/gadgets/pointer.rs +++ b/src/circuit/gadgets/pointer.rs @@ -760,7 +760,7 @@ impl AllocatedContPtr { store.poseidon_constants().c8(), )?; - let cont = AllocatedContPtr { + let cont = AllocatedContPtr { tag: cont_tag.clone(), hash, }; diff --git a/src/proof/nova.rs b/src/proof/nova.rs index 58cb6afbf1..2d1dce55dc 100644 --- a/src/proof/nova.rs +++ b/src/proof/nova.rs @@ -391,7 +391,7 @@ impl<'a, F: LurkField, C: Coprocessor> StepCircuit for MultiFrame<'a, F, C .folding_config .lang() .get_coprocessor_from_zptr(&z_ptr) - .expect("coprocessor missing"); + .expect("coprocessor not found for a frame that requires one"); match self.frames.as_ref() { Some(frames) => { assert_eq!(1, frames.len()); diff --git a/src/proof/supernova.rs b/src/proof/supernova.rs index 619ce8eb59..b0cb61d6d6 100644 --- a/src/proof/supernova.rs +++ b/src/proof/supernova.rs @@ -46,6 +46,7 @@ where { pp: SuperNovaPublicParams, // SuperNova does not yet have a `CompressedSNARK`. + // see https://github.com/lurk-lab/arecibo/issues/27 // pk: ProverKey, G2, C1<'a, F, C>, C2, SS1, SS2>, // vk: VerifierKey, G2, C1<'a, F, C>, C2, SS1, SS2>, _p: PhantomData, @@ -97,9 +98,6 @@ where < as Group>::Scalar as PrimeField>::Repr: Abomonation, < as Group>::Scalar as PrimeField>::Repr: Abomonation, ::Repr: Abomonation, - C: Coprocessor, - F: CurveCycleEquipped + LurkField, - <<::G2 as Group>::Scalar as PrimeField>::Repr: Abomonation, { /// Proves the computation recursively, generating a recursive SNARK proof. #[tracing::instrument(skip_all, name = "Proof::prove_recursively")]