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 545e6e2 commit ad86f9d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion common/src/gadgets/powers_of_two_multiples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ mod tests {
domain.divide_by_vanishing_poly(&c1);
domain.divide_by_vanishing_poly(&c2);

return (domain, gadget, cs);
(domain, gadget, cs)
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion common/src/gadgets/sw_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ mod tests {
domain.divide_by_vanishing_poly(&c1);
domain.divide_by_vanishing_poly(&c2);

return (domain, gadget, cs);
(domain, gadget, cs)
}

#[test]
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 @@ -286,7 +286,7 @@ mod tests {
domain.divide_by_vanishing_poly(&c1);
domain.divide_by_vanishing_poly(&c2);

return (domain, gadget, cs);
(domain, gadget, cs)
}

#[test]
Expand Down
8 changes: 5 additions & 3 deletions ring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ mod tests {
let keyset_size: usize = rng.gen_range(0..max_keyset_size);
let pks = random_vec::<P, _>(keyset_size, rng);
let k = rng.gen_range(0..keyset_size); // prover's secret index
let pk = pks[k].clone();
let pk = pks[k];

let (prover_key, verifier_key) = index::<_, CS, _>(&pcs_params, &piop_params, &pks);

Expand All @@ -115,7 +115,8 @@ mod tests {

#[cfg(feature = "intensive-benchmarking")]
for _ in 0.._repeat - 1 {
black_box(proofs.push(ring_prover.prove(secret)));
let proof = black_box(ring_prover.prove(secret));
proofs.push(proof);
}

let proof = ring_prover.prove(secret);
Expand All @@ -130,7 +131,8 @@ mod tests {

#[cfg(feature = "intensive-benchmarking")]
for _ in 0.._repeat - 1 {
black_box(ring_verifier.verify(proofs.pop().unwrap(), result.into_affine()));
let proof = proofs.pop().unwrap();
black_box(ring_verifier.verify(proof, result.into_affine()));
}
let res = ring_verifier.verify(proof, result.into_affine());
end_timer!(t_verify);
Expand Down
27 changes: 13 additions & 14 deletions ring/src/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,9 @@ impl<F: PrimeField, KzgCurve: Pairing<ScalarField = F>> RingBuilderKey<F, KzgCur

#[cfg(test)]
mod tests {
use ark_bls12_381::{Bls12_381, Fr, G1Affine};
use ark_ed_on_bls12_381_bandersnatch::EdwardsAffine;
use ark_ed_on_bls12_381_bandersnatch::{Fq, SWAffine};
use ark_std::{test_rng, UniformRand};
use ark_bls12_381::{Bls12_381, Fr as Bls12_381_Fr, G1Affine};
use ark_ed_on_bls12_381_bandersnatch::{EdwardsAffine, SWAffine};
use ark_std::test_rng;
use fflonk::pcs::kzg::urs::URS;
use fflonk::pcs::kzg::KZG;
use fflonk::pcs::PCS;
Expand All @@ -258,9 +257,9 @@ mod tests {

use super::*;

type TestRing<P> = Ring<Fr, Bls12_381, P>;
type TestRing<P> = Ring<Bls12_381_Fr, Bls12_381, P>;

fn _test_ring_mgmt<P: AffineRepr<BaseField = Fq>>() {
fn _test_ring_mgmt<P: AffineRepr<BaseField = Bls12_381_Fr>>() {
let rng = &mut test_rng();

let domain_size = 1 << 9;
Expand All @@ -270,9 +269,9 @@ mod tests {
let srs = |range: Range<usize>| Ok(ring_builder_key.lis_in_g1[range].to_vec());

// piop params
let h = SWAffine::rand(rng);
let seed = SWAffine::rand(rng);
let pad = SWAffine::rand(rng);
let h = P::rand(rng);
let seed = P::rand(rng);
let pad = P::rand(rng);
let domain = Domain::new(domain_size, true);
let piop_params = PiopParams::setup(domain, h, seed, pad);

Expand All @@ -281,7 +280,7 @@ mod tests {
assert_eq!(ring.cx, monimial_cx);
assert_eq!(ring.cy, monimial_cy);

let keys = random_vec::<SWAffine, _>(ring.max_keys, rng);
let keys = random_vec::<P, _>(ring.max_keys, rng);
ring.append(&keys, srs);
let (monimial_cx, monimial_cy) = get_monomial_commitment(&pcs_params, &piop_params, &keys);
assert_eq!(ring.cx, monimial_cx);
Expand All @@ -301,7 +300,7 @@ mod tests {
_test_ring_mgmt::<EdwardsAffine>();
}

fn _test_empty_rings<P: AffineRepr<BaseField = Fq>>() {
fn _test_empty_rings<P: AffineRepr<BaseField = Bls12_381_Fr>>() {
let rng = &mut test_rng();

let domain_size = 1 << 9;
Expand Down Expand Up @@ -332,10 +331,10 @@ mod tests {
_test_empty_rings::<EdwardsAffine>();
}

fn get_monomial_commitment(
fn get_monomial_commitment<P: AffineRepr<BaseField = Bls12_381_Fr>>(
pcs_params: &URS<Bls12_381>,
piop_params: &PiopParams<Fr, SWAffine>,
keys: &[SWAffine],
piop_params: &PiopParams<<P as AffineRepr>::BaseField, P>,
keys: &[P],
) -> (G1Affine, G1Affine) {
let (_, verifier_key) =
crate::piop::index::<_, KZG<Bls12_381>, _>(pcs_params, piop_params, keys);
Expand Down

0 comments on commit ad86f9d

Please sign in to comment.