diff --git a/crates/ivc/src/compilers/cyclefold/circuits.rs b/crates/ivc/src/compilers/cyclefold/circuits.rs index 7593b72ec..de6703917 100644 --- a/crates/ivc/src/compilers/cyclefold/circuits.rs +++ b/crates/ivc/src/compilers/cyclefold/circuits.rs @@ -4,6 +4,7 @@ use ark_ff::PrimeField; use ark_r1cs_std::{ GR1CSVar, alloc::AllocVar, + eq::EqGadget, fields::{FieldVar, fp::FpVar}, }; use ark_relations::gr1cs::{ConstraintSynthesizer, ConstraintSystemRef, SynthesisError}; @@ -99,6 +100,9 @@ where let cf_U = AllocVar::new_witness(cs.clone(), || Ok(cf_U))?; let cf_proofs = Vec::new_witness(cs.clone(), || Ok(cf_proofs))?; + // 0. Check initial state consistency + initial_state.conditional_enforce_equal(¤t_state, &is_basecase)?; + // 1. Fold primary instances. // 1.a. Derive the public input to the primary (augmented) circuit in // the `i-1`-th step, which is `u.x = H(i, z_0, z_i, U, cf_U)`. diff --git a/crates/primitives/src/circuits/mod.rs b/crates/primitives/src/circuits/mod.rs index a466876f6..008d1f7c7 100644 --- a/crates/primitives/src/circuits/mod.rs +++ b/crates/primitives/src/circuits/mod.rs @@ -1,7 +1,7 @@ //! This module defines circuits and helpers used by Sonobe. use ark_ff::{Field, PrimeField}; -use ark_r1cs_std::{GR1CSVar, alloc::AllocVar, fields::fp::FpVar}; +use ark_r1cs_std::{GR1CSVar, alloc::AllocVar, eq::EqGadget, fields::fp::FpVar}; use ark_relations::gr1cs::{ ConstraintSynthesizer, ConstraintSystem, ConstraintSystemRef, SynthesisError, SynthesisMode, }; @@ -74,7 +74,8 @@ pub trait FCircuit { /// implement the required traits for the corresponding variable type. type StateVar: GR1CSVar + AllocVar - + AbsorbableVar; + + AbsorbableVar + + EqGadget; /// [`FCircuit::ExternalInputs`] is the type of external inputs provided to /// each step of the circuit. type ExternalInputs;