Skip to content

Commit

Permalink
fix clippy lints after updating to v1.82.0
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaucube committed Nov 25, 2024
1 parent 121b2eb commit b089e99
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 5 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ use std::{fs, io};
mod settings;

fn create_or_open_then_write<T: AsRef<[u8]>>(path: &Path, content: &T) -> Result<(), io::Error> {
let mut file = fs::OpenOptions::new().create(true).write(true).open(path)?;
let mut file = fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(path)?;
file.write_all(content.as_ref())
}

Expand Down
24 changes: 10 additions & 14 deletions folding-schemes/src/folding/nova/zk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,21 @@ where
/// Compute a zero-knowledge proof of a Nova IVC proof
/// It implements the prover of appendix D.4.in https://eprint.iacr.org/2023/573.pdf
/// For further details on why folding is hiding, see lemma 9
pub fn new<
GC1: CurveVar<C1, CF2<C1>> + ToConstraintFieldGadget<CF2<C1>>,
GC2: CurveVar<C2, CF2<C2>>,
FC: FCircuit<C1::ScalarField>,
CS1: CommitmentScheme<C1, true>,
CS2: CommitmentScheme<C2, true>,
>(
pub fn new<GC1, GC2, FC, CS1, CS2>(
nova: &Nova<C1, GC1, C2, GC2, FC, CS1, CS2, true>,
mut rng: impl RngCore,
) -> Result<RandomizedIVCProof<C1, C2>, Error>
where
GC1: CurveVar<C1, CF2<C1>> + ToConstraintFieldGadget<CF2<C1>>,
GC2: CurveVar<C2, CF2<C2>> + ToConstraintFieldGadget<<C2 as CurveGroup>::BaseField>,
FC: FCircuit<C1::ScalarField>,
CS1: CommitmentScheme<C1, true>,
CS2: CommitmentScheme<C2, true>,
<C1 as Group>::ScalarField: Absorb,
<C2 as Group>::ScalarField: Absorb,
<C2 as Group>::ScalarField: PrimeField,
<C2 as CurveGroup>::BaseField: PrimeField,
<C2 as CurveGroup>::BaseField: Absorb,
GC2: ToConstraintFieldGadget<<C2 as CurveGroup>::BaseField>,
C1: CurveGroup<BaseField = C2::ScalarField, ScalarField = C2::BaseField>,
{
let mut transcript = PoseidonSponge::<C1::ScalarField>::new(&nova.poseidon_config);
Expand Down Expand Up @@ -138,11 +136,7 @@ where
/// Verify a zero-knowledge proof of a Nova IVC proof
/// It implements the verifier of appendix D.4. in https://eprint.iacr.org/2023/573.pdf
#[allow(clippy::too_many_arguments)]
pub fn verify<
CS1: CommitmentScheme<C1, true>,
GC2: CurveVar<C2, CF2<C2>>,
CS2: CommitmentScheme<C2, true>,
>(
pub fn verify<CS1, GC2, CS2>(
r1cs: &R1CS<C1::ScalarField>,
cf_r1cs: &R1CS<C2::ScalarField>,
pp_hash: C1::ScalarField,
Expand All @@ -153,11 +147,13 @@ where
proof: &RandomizedIVCProof<C1, C2>,
) -> Result<(), Error>
where
CS1: CommitmentScheme<C1, true>,
GC2: CurveVar<C2, CF2<C2>>,
CS2: CommitmentScheme<C2, true> + ToConstraintFieldGadget<<C2 as CurveGroup>::BaseField>,
<C1 as Group>::ScalarField: Absorb,
<C2 as Group>::ScalarField: Absorb,
<C2 as CurveGroup>::BaseField: PrimeField,
<C2 as CurveGroup>::BaseField: Absorb,
GC2: ToConstraintFieldGadget<<C2 as CurveGroup>::BaseField>,
C1: CurveGroup<BaseField = C2::ScalarField, ScalarField = C2::BaseField>,
{
// Handles case where i=0
Expand Down
1 change: 1 addition & 0 deletions folding-schemes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(clippy::doc_lazy_continuation)]

use ark_ec::{pairing::Pairing, CurveGroup};
use ark_ff::PrimeField;
Expand Down
2 changes: 1 addition & 1 deletion frontends/src/circom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystemRef, SynthesisE
use ark_std::fmt::Debug;
use folding_schemes::{frontend::FCircuit, utils::PathOrBin, Error};
use num_bigint::BigInt;
use std::fmt;
use std::rc::Rc;
use std::{fmt, usize};

pub mod utils;
use utils::CircomWrapper;
Expand Down

0 comments on commit b089e99

Please sign in to comment.