Skip to content

Commit

Permalink
refactor: Tidying up changes after #677
Browse files Browse the repository at this point in the history
That PR was on auto-merge.
  • Loading branch information
huitseeker committed Sep 20, 2023
1 parent c91cc59 commit e6a955a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
40 changes: 15 additions & 25 deletions src/circuit/circuit_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,19 @@ impl<'a, F: LurkField, C: Coprocessor<F>> CircuitFrame<'a, F, C> {

impl<'a, F: LurkField, C: Coprocessor<F>> MultiFrame<'a, F, C> {
pub fn blank(folding_config: Arc<FoldingConfig<F, C>>, meta: Meta<F>) -> 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,
}
}

Expand Down Expand Up @@ -141,9 +133,7 @@ impl<'a, F: LurkField, C: Coprocessor<F>> 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);
}

Expand Down Expand Up @@ -471,6 +461,7 @@ impl<
type AllocatedIO<F> = (AllocatedPtr<F>, AllocatedPtr<F>, AllocatedContPtr<F>);

impl<F: LurkField, C: Coprocessor<F>> CircuitFrame<'_, F, C> {
#[tracing::instrument(skip_all, name = "CircuitFrame::synthesize", level="debug")]
pub(crate) fn synthesize<CS: ConstraintSystem<F>>(
&self,
cs: &mut CS,
Expand All @@ -483,7 +474,6 @@ impl<F: LurkField, C: Coprocessor<F>> CircuitFrame<'_, F, C> {
cont_circuit_witness: Option<ContCircuitWitness<F>>,
) -> Result<AllocatedIO<F>, 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
Expand Down
2 changes: 1 addition & 1 deletion src/circuit/gadgets/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ impl<F: LurkField> AllocatedContPtr<F> {
store.poseidon_constants().c8(),
)?;

let cont = AllocatedContPtr {
let cont = AllocatedContPtr {
tag: cont_tag.clone(),
hash,
};
Expand Down
2 changes: 1 addition & 1 deletion src/proof/nova.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl<'a, F: LurkField, C: Coprocessor<F>> StepCircuit<F> 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());
Expand Down
4 changes: 1 addition & 3 deletions src/proof/supernova.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ where
{
pp: SuperNovaPublicParams<F>,
// SuperNova does not yet have a `CompressedSNARK`.
// see https://github.com/lurk-lab/arecibo/issues/27
// pk: ProverKey<G1<F>, G2<F>, C1<'a, F, C>, C2<F>, SS1<F>, SS2<F>>,
// vk: VerifierKey<G1<F>, G2<F>, C1<'a, F, C>, C2<F>, SS1<F>, SS2<F>>,
_p: PhantomData<C>,
Expand Down Expand Up @@ -97,9 +98,6 @@ where
<<G1<F> as Group>::Scalar as PrimeField>::Repr: Abomonation,
<<G2<F> as Group>::Scalar as PrimeField>::Repr: Abomonation,
<F as PrimeField>::Repr: Abomonation,
C: Coprocessor<F>,
F: CurveCycleEquipped + LurkField,
<<<F as CurveCycleEquipped>::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")]
Expand Down

0 comments on commit e6a955a

Please sign in to comment.