Skip to content

Commit

Permalink
add warning about issue #80 on the DeciderEthCircuit, and small polis…
Browse files Browse the repository at this point in the history
…hing
  • Loading branch information
arnaucube committed Aug 5, 2024
1 parent 5235549 commit 55790a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions folding-schemes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ serde_json = "1.0.85"
serde = "1.0.203"
acvm = { git = "https://github.com/noir-lang/noir", rev="2b4853e", default-features = false }
arkworks_backend = { git = "https://github.com/dmpierre/arkworks_backend", branch="feat/sonobe-integration" }
log = "0.4"

# tmp import for espresso's sumcheck
espresso_subroutines = {git="https://github.com/EspressoSystems/hyperplonk", package="subroutines"}
Expand Down
2 changes: 1 addition & 1 deletion folding-schemes/src/folding/circuits/nonnative/affine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<C: CurveGroup> ToConstraintFieldGadget<C::ScalarField> for NonNativeAffineV

/// The out-circuit counterpart of `NonNativeAffineVar::to_constraint_field`
#[allow(clippy::type_complexity)]
pub fn nonnative_affine_to_field_elements<C: CurveGroup>(
pub(crate) fn nonnative_affine_to_field_elements<C: CurveGroup>(
p: C,
) -> (Vec<C::ScalarField>, Vec<C::ScalarField>) {
let affine = p.into_affine();
Expand Down
15 changes: 4 additions & 11 deletions folding-schemes/src/folding/hypernova/decider_eth_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ where
<C1 as Group>::ScalarField: Absorb,
<C1 as CurveGroup>::BaseField: PrimeField,
{
/// returns an instance of the DeciderEthCircuit from the given HyperNova struct
pub fn from_hypernova<FC: FCircuit<C1::ScalarField>>(
hn: HyperNova<C1, GC1, C2, GC2, FC, CS1, CS2, H>,
) -> Result<Self, Error> {
Expand Down Expand Up @@ -343,13 +344,6 @@ where
U_i1.v.clone(),
)?;

// TODO review if needed, in principle not, bcs in HN there is no cmE that needs to be 0
// 2. u_i.cmE==cm(0), u_i.u==1
// Here zero is the x & y coordinates of the zero point affine representation.
// let zero = NonNativeUintVar::new_constant(cs.clone(), C1::BaseField::zero())?;
// u_i.C.x.enforce_equal_unaligned(&zero)?;
// u_i.C.y.enforce_equal_unaligned(&zero)?;

// 3.a u_i.x[0] == H(i, z_0, z_i, U_i)
let (u_i_x, _) = U_i.clone().hash(
&sponge,
Expand All @@ -361,7 +355,7 @@ where
(u_i.x[0]).enforce_equal(&u_i_x)?;

#[cfg(feature = "light-test")]
println!("[WARNING]: Running with the 'light-test' feature, skipping the big part of the DeciderEthCircuit.\n Only for testing purposes.");
log::warn!("[WARNING]: Running with the 'light-test' feature, skipping the big part of the DeciderEthCircuit.\n Only for testing purposes.");

// The following two checks (and their respective allocations) are disabled for normal
// tests since they take several millions of constraints and would take several minutes
Expand Down Expand Up @@ -434,12 +428,11 @@ where

// Check 7 is temporary disabled due
// https://github.com/privacy-scaling-explorations/sonobe/issues/80
log::warn!("[WARNING]: issue #80 (https://github.com/privacy-scaling-explorations/sonobe/issues/80) is not resolved yet.");
//
// 7. check eval_W==p_W(c_W) and eval_E==p_E(c_E)
// 7. check eval_W==p_W(c_W)
// let incircuit_eval_W = evaluate_gadget::<CF1<C1>>(W_i1.W, incircuit_c_W)?;
// let incircuit_eval_E = evaluate_gadget::<CF1<C1>>(W_i1.E, incircuit_c_E)?;
// incircuit_eval_W.enforce_equal(&eval_W)?;
// incircuit_eval_E.enforce_equal(&eval_E)?;

// 8.a verify the NIMFS.V of the final fold, and check that the obtained rho_powers from the
// transcript match the one from the public input (so we avoid the onchain logic of the
Expand Down
4 changes: 3 additions & 1 deletion folding-schemes/src/folding/nova/decider_eth_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ where
<C1 as Group>::ScalarField: Absorb,
<C1 as CurveGroup>::BaseField: PrimeField,
{
/// returns an instance of the DeciderEthCircuit from the given Nova struct
pub fn from_nova<FC: FCircuit<C1::ScalarField>>(
nova: Nova<C1, GC1, C2, GC2, FC, CS1, CS2, H>,
) -> Result<Self, Error> {
Expand Down Expand Up @@ -403,7 +404,7 @@ where
(u_i.x[0]).enforce_equal(&u_i_x)?;

#[cfg(feature = "light-test")]
println!("[WARNING]: Running with the 'light-test' feature, skipping the big part of the DeciderEthCircuit.\n Only for testing purposes.");
log::warn!("[WARNING]: Running with the 'light-test' feature, skipping the big part of the DeciderEthCircuit.\n Only for testing purposes.");

// The following two checks (and their respective allocations) are disabled for normal
// tests since they take several millions of constraints and would take several minutes
Expand Down Expand Up @@ -486,6 +487,7 @@ where

// Check 7 is temporary disabled due
// https://github.com/privacy-scaling-explorations/sonobe/issues/80
log::warn!("[WARNING]: issue #80 (https://github.com/privacy-scaling-explorations/sonobe/issues/80) is not resolved yet.");
//
// 7. check eval_W==p_W(c_W) and eval_E==p_E(c_E)
// let incircuit_eval_W = evaluate_gadget::<CF1<C1>>(W_i1.W, incircuit_c_W)?;
Expand Down
2 changes: 1 addition & 1 deletion folding-schemes/src/utils/gadgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<F: PrimeField> MatrixGadget<FpVar<F>> for SparseMatrixVar<F, F, FpVar<F>> {
}

/// Interprets the given vector v as the evaluations of a dense multilinear extension of n_vars,
/// and evaluates it at the given point. This method mimics the behaviour of
/// and evaluates it at the given point. This method mimics the behavior of
/// `utils/mle.rs#dense_vec_to_dense_mle` + `DenseMultilinearExtension::evaluate` but in R1CS
/// constraints, since dense multilinear extensions are not supported in ark_r1cs_std.
pub fn eval_mle<F: PrimeField>(
Expand Down

0 comments on commit 55790a5

Please sign in to comment.