Skip to content

Commit

Permalink
chore: remove all #[allow(unused)] in co-circom
Browse files Browse the repository at this point in the history
  • Loading branch information
rw0x0 authored and dkales committed Nov 19, 2024
1 parent 9f67c9a commit 51609c9
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 36 deletions.
2 changes: 1 addition & 1 deletion co-circom/co-circom/examples/groth16/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rm all proof files
rm proof.0.json proof.1.json proof.2.json
rm -rf proof.0.json proof.1.json proof.2.json
# delete all shared files
find . -name "*.shared" -type f -delete
2 changes: 1 addition & 1 deletion co-circom/co-circom/examples/plonk/cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rm all proof files
rm proof.0.json proof.1.json proof.2.json
rm -rf proof.0.json proof.1.json proof.2.json
# delete all shared files
find . -name "*.shared" -type f -delete
1 change: 0 additions & 1 deletion co-circom/co-groth16/src/groth16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ where
c_domain.ifft_in_place(&mut ab);
ifft_span.exit();
let dist_pows_span = tracing::debug_span!("c: dist pows").entered();
#[allow(unused_mut)]
ab.par_iter_mut()
.zip_eq(c_roots.par_iter())
.with_min_len(512)
Expand Down
3 changes: 1 addition & 2 deletions co-circom/co-groth16/src/mpc/plain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ impl<P: Pairing> CircomGroth16Prover<P> for PlainGroth16Driver {
coeffs: &mut [Self::ArithmeticShare],
roots: &[P::ScalarField],
) {
#[allow(unused_mut)]
for (mut c, pow) in coeffs.iter_mut().zip(roots) {
for (c, pow) in coeffs.iter_mut().zip(roots) {
*c *= pow;
}
}
Expand Down
3 changes: 1 addition & 2 deletions co-circom/co-plonk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,10 @@ mod plonk_utils {
poly: &mut Vec<T::ArithmeticShare>,
coeff_rev: &[T::ArithmeticShare],
) {
#[allow(unused_mut)]
poly.par_iter_mut()
.zip(coeff_rev.par_iter().rev())
.with_min_len(512)
.for_each(|(mut p, c)| {
.for_each(|(p, c)| {
*p = T::sub(*p, *c);
});
// Extend
Expand Down
3 changes: 1 addition & 2 deletions co-circom/co-plonk/src/mpc/plain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ impl<P: Pairing> CircomPlonkProver<P> for PlainPlonkDriver {
}

fn neg_vec_in_place(&mut self, a: &mut [Self::ArithmeticShare]) {
#[allow(unused_mut)]
for mut a in a.iter_mut() {
for a in a.iter_mut() {
*a = -*a;
}
}
Expand Down
3 changes: 1 addition & 2 deletions co-circom/co-plonk/src/mpc/rep3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ impl<P: Pairing, N: Rep3Network> CircomPlonkProver<P> for Rep3PlonkDriver<N> {
}

fn neg_vec_in_place(&mut self, vec: &mut [Self::ArithmeticShare]) {
#[allow(unused_mut)]
for mut a in vec.iter_mut() {
for a in vec.iter_mut() {
*a = arithmetic::neg(*a);
}
}
Expand Down
3 changes: 1 addition & 2 deletions co-circom/co-plonk/src/round1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ impl<P: Pairing> std::fmt::Display for Round1Proof<P> {
impl<P: Pairing, T: CircomPlonkProver<P>> Round1Challenges<P, T> {
pub(super) fn random(driver: &mut T) -> PlonkProofResult<Self> {
let mut b = core::array::from_fn(|_| T::ArithmeticShare::default());
#[allow(unused_mut)]
for mut x in b.iter_mut() {
for x in b.iter_mut() {
*x = driver.rand()?;
}
Ok(Self { b })
Expand Down
35 changes: 12 additions & 23 deletions co-circom/co-plonk/src/round5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ where
let inv_beta = beta.inverse().expect("Highly unlikely to be zero");
let inv_beta_neg = -inv_beta;

#[allow(unused_mut)]
for mut el in inout.iter_mut().take(n) {
for el in inout.iter_mut().take(n) {
*el = T::mul_with_public(*el, inv_beta_neg);
}
for i in n..inout.len() {
Expand All @@ -101,8 +100,7 @@ where
inout.resize(add_poly.len(), P::ScalarField::zero());
}

#[allow(unused_mut)]
for (mut inout, add) in inout.iter_mut().zip(add_poly.iter()) {
for (inout, add) in inout.iter_mut().zip(add_poly.iter()) {
*inout += *add;
}
}
Expand All @@ -116,8 +114,7 @@ where
inout.resize(add_poly.len(), P::ScalarField::zero());
}

#[allow(unused_mut)]
for (mut inout, add) in inout.iter_mut().zip(add_poly.iter()) {
for (inout, add) in inout.iter_mut().zip(add_poly.iter()) {
*inout += *add * factor;
}
}
Expand Down Expand Up @@ -160,8 +157,8 @@ where
let e24 = e2 + e4;

let mut poly_r = zkey.qm_poly.coeffs.clone();
#[allow(unused_mut)]
for mut coeff in poly_r.iter_mut() {

for coeff in poly_r.iter_mut() {
*coeff *= coef_ab;
}
Self::add_factor_poly(&mut poly_r.coeffs, &zkey.ql_poly.coeffs, proof.eval_a);
Expand All @@ -178,41 +175,33 @@ where

let mut poly_r_shared = vec![T::ArithmeticShare::default(); len];

#[allow(unused_mut)]
for (mut inout, add) in poly_r_shared
for (inout, add) in poly_r_shared
.iter_mut()
.zip(polys.z.poly.clone().into_iter())
{
*inout = T::mul_with_public(add, e24);
}

#[allow(unused_mut)]
for (mut inout, add) in poly_r_shared.iter_mut().zip(poly_r.iter()) {
for (inout, add) in poly_r_shared.iter_mut().zip(poly_r.iter()) {
*inout = T::add_with_public(party_id, *inout, *add);
}

let mut tmp_poly = vec![T::ArithmeticShare::default(); len];
let xin2 = xin.square();
#[allow(unused_mut)]
for (mut inout, add) in tmp_poly.iter_mut().zip(polys.t3.clone().into_iter()) {
for (inout, add) in tmp_poly.iter_mut().zip(polys.t3.clone().into_iter()) {
*inout = T::mul_with_public(add, xin2);
}
#[allow(unused_mut)]
for (mut inout, add) in tmp_poly.iter_mut().zip(polys.t2.clone().into_iter()) {
for (inout, add) in tmp_poly.iter_mut().zip(polys.t2.clone().into_iter()) {
let tmp = T::mul_with_public(add, xin);
*inout = T::add(*inout, tmp);
}
#[allow(unused_mut)]
for (mut inout, add) in tmp_poly.iter_mut().zip(polys.t1.clone().into_iter()) {
for (inout, add) in tmp_poly.iter_mut().zip(polys.t1.clone().into_iter()) {
*inout = T::add(*inout, add);
}
#[allow(unused_mut)]
for mut inout in tmp_poly.iter_mut() {
for inout in tmp_poly.iter_mut() {
*inout = T::mul_with_public(*inout, zh);
}

#[allow(unused_mut)]
for (mut inout, sub) in poly_r_shared.iter_mut().zip(tmp_poly.iter()) {
for (inout, sub) in poly_r_shared.iter_mut().zip(tmp_poly.iter()) {
*inout = T::sub(*inout, *sub);
}

Expand Down

0 comments on commit 51609c9

Please sign in to comment.