Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed Nov 8, 2024
1 parent a4462e8 commit 545e6e2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions common/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn vanishes_on_row<F: FftField>(
) -> DensePolynomial<F> {
assert!(i < domain.size());
let w = domain.group_gen();
let wi = w.pow(&[i as u64]);
let wi = w.pow([i as u64]);
let wi = DensePolynomial::from_coefficients_slice(&[wi]);
let x = DensePolynomial::from_coefficients_slice(&[F::zero(), F::one()]);
&x - &wi
Expand All @@ -163,7 +163,7 @@ fn vanishes_on_row<F: FftField>(
fn vanishes_on_last_3_rows<F: FftField>(domain: GeneralEvaluationDomain<F>) -> DensePolynomial<F> {
let w = domain.group_gen();
let n3 = (domain.size() - ZK_ROWS) as u64;
let w3 = w.pow(&[n3]);
let w3 = w.pow([n3]);
let w2 = w3 * w;
let w1 = w2 * w;
assert_eq!(w1, domain.group_gen_inv());
Expand Down
2 changes: 1 addition & 1 deletion common/src/gadgets/booleanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct Booleanity<F: FftField> {
bits: BitColumn<F>,
}

impl<'a, F: FftField> Booleanity<F> {
impl<F: FftField> Booleanity<F> {
pub fn init(bits: BitColumn<F>) -> Self {
Self { bits }
}
Expand Down
8 changes: 6 additions & 2 deletions common/src/gadgets/cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ where
fn init(bitmask: F, points: (F, F), not_last: F, acc: (F, F)) -> Self;
}

type BaseFieldOf<P> = <P as AffineRepr>::BaseField;

pub struct CondAddGen<P>
where
P: AffineRepr,
Expand All @@ -70,3 +68,9 @@ pub struct CondAddValuesGen<P: AffineRepr> {
pub not_last: BaseFieldOf<P>,
pub acc: (BaseFieldOf<P>, BaseFieldOf<P>),
}

pub type BaseFieldOf<P> = <P as AffineRepr>::BaseField;

pub type CondAddFor<P> = <P as AffineCondAdd>::CondAddT;

pub type CondAddValuesFor<P> = <CondAddFor<P> as CondAdd<BaseFieldOf<P>, P>>::Values;
4 changes: 2 additions & 2 deletions common/src/gadgets/sw_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
}

fn get_result(&self) -> Affine<C> {
self.result.clone()
self.result
}
}

Expand Down Expand Up @@ -253,7 +253,7 @@ pub fn find_complement_point<C: SWCurveConfig>() -> Affine<C> {
{
return p;
}
x = x + C::BaseField::one();
x += C::BaseField::one();
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/gadgets/te_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ where
}

fn get_result(&self) -> Affine<C> {
self.result.clone()
self.result
}
}

Expand Down
2 changes: 1 addition & 1 deletion ring/src/piop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pub fn index<F: PrimeField, CS: PCS<F>, P: AffineRepr<BaseField = F>>(
) -> (ProverKey<F, CS, P>, VerifierKey<F, CS>) {
let pcs_ck = pcs_params.ck();
let pcs_raw_vk = pcs_params.raw_vk();
let fixed_columns = piop_params.fixed_columns(&keys);
let fixed_columns = piop_params.fixed_columns(keys);
let fixed_columns_committed = fixed_columns.commit::<CS>(&pcs_ck);
let verifier_key = VerifierKey {
pcs_raw_vk: pcs_raw_vk.clone(),
Expand Down
2 changes: 1 addition & 1 deletion ring/src/piop/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<F: PrimeField, P: AffineRepr<BaseField = F>> PiopParams<F, P> {
pub fn fixed_columns(&self, keys: &[P]) -> FixedColumns<F, P> {
let ring_selector = self.keyset_part_selector();
let ring_selector = self.domain.public_column(ring_selector);
let points = self.points_column(&keys);
let points = self.points_column(keys);
FixedColumns {
points,
ring_selector,
Expand Down
6 changes: 3 additions & 3 deletions ring/src/piop/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl<F: PrimeField, P: AffineRepr<BaseField = F>, CondAddT: CondAdd<F, P>>
points,
ring_selector,
} = fixed_columns;
let bits = Self::bits_column(&params, prover_index_in_keys, secret);
let bits = Self::bits_column(params, prover_index_in_keys, secret);
let inner_prod = InnerProd::init(ring_selector.clone(), bits.col.clone(), &domain);
let cond_add = CondAddT::init(bits.clone(), points.clone(), params.seed, &domain);
let booleanity = Booleanity::init(bits.clone());
Expand Down Expand Up @@ -150,7 +150,7 @@ where
}

fn constraints(&self) -> Vec<Evaluations<F>> {
vec![
[
self.inner_prod.constraints(),
self.cond_add.constraints(),
self.booleanity.constraints(),
Expand All @@ -162,7 +162,7 @@ where
}

fn constraints_lin(&self, zeta: &F) -> Vec<DensePolynomial<F>> {
vec![
[
self.inner_prod.constraints_linearized(zeta),
self.cond_add.constraints_linearized(zeta),
self.booleanity.constraints_linearized(zeta),
Expand Down
2 changes: 1 addition & 1 deletion ring/src/piop/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<F: PrimeField, C: Commitment<F>, CondAddValuesT: CondAddValues<F>> Verifier
}

fn evaluate_constraints_main(&self) -> Vec<F> {
vec![
[
self.inner_prod.evaluate_constraints_main(),
self.cond_add.evaluate_constraints_main(),
self.booleanity.evaluate_constraints_main(),
Expand Down
24 changes: 12 additions & 12 deletions ring/src/ring_verifier.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ark_ec::AffineRepr;
use ark_ec::CurveGroup;
use ark_ff::PrimeField;
use common::gadgets::cond_add::CondAddValuesFor;
use common::gadgets::cond_add::{AffineCondAdd, CondAdd};
use fflonk::pcs::{RawVerifierKey, PCS};

Expand Down Expand Up @@ -59,18 +60,17 @@ where
self.piop_params.domain.hiding,
);

let piop: PiopVerifier<F, <CS as PCS<F>>::C, <P::CondAddT as CondAdd<F, P>>::Values> =
PiopVerifier::init(
domain_eval,
self.fixed_columns_committed.clone(),
proof.column_commitments.clone(),
proof.columns_at_zeta.clone(),
(*seed.x().unwrap(), *seed.y().unwrap()),
(
*seed_plus_result.x().unwrap(),
*seed_plus_result.y().unwrap(),
),
);
let piop: PiopVerifier<F, <CS as PCS<F>>::C, CondAddValuesFor<P>> = PiopVerifier::init(
domain_eval,
self.fixed_columns_committed.clone(),
proof.column_commitments.clone(),
proof.columns_at_zeta.clone(),
(*seed.x().unwrap(), *seed.y().unwrap()),
(
*seed_plus_result.x().unwrap(),
*seed_plus_result.y().unwrap(),
),
);

self.plonk_verifier
.verify(piop, proof, challenges, &mut rng)
Expand Down

0 comments on commit 545e6e2

Please sign in to comment.