Skip to content

Ask cargo fix and cargo clippy --fixfor help #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion circ_blocks/examples/zxc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use libspartan::{
use merlin::Transcript;
use serde::{Deserialize, Serialize};
use std::time::*;
use std::time::*;

// How many reserved variables (EXCLUDING V) are in front of the actual input / output?
// %BN, %RET, %TS, %AS, %SP, %BP
Expand Down
5 changes: 1 addition & 4 deletions ff/ff_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ impl ReprEndianness {
match self {
ReprEndianness::Big => {
let buf = modulus.to_bytes_be();
iter::repeat(0)
.take(bytes - buf.len())
.chain(buf.into_iter())
.collect()
iter::repeat(0).take(bytes - buf.len()).chain(buf).collect()
}
ReprEndianness::Little => {
let mut buf = modulus.to_bytes_le();
Expand Down
24 changes: 12 additions & 12 deletions spartan_parallel/src/custom_dense_mlpoly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn rev_bits(q: usize, max_num_proofs: usize) -> usize {
(0..max_num_proofs.log_2())
.rev()
.map(|i| q / (i.pow2()) % 2 * (max_num_proofs / i.pow2() / 2))
.fold(0, |a, b| a + b)
.sum::<usize>()
}

impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
Expand Down Expand Up @@ -112,7 +112,7 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
}

pub fn len(&self) -> usize {
return self.num_instances * self.max_num_proofs * self.max_num_inputs;
self.num_instances * self.max_num_proofs * self.max_num_inputs
}

// Given (p, q_rev, x_rev) return Z[p][q_rev][x_rev]
Expand All @@ -122,9 +122,9 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
&& w < self.Z[p][q_rev].len()
&& x_rev < self.Z[p][q_rev][w].len()
{
return self.Z[p][q_rev][w][x_rev];
self.Z[p][q_rev][w][x_rev]
} else {
return S::field_zero();
S::field_zero()
}
}

Expand All @@ -138,31 +138,31 @@ impl<S: SpartanExtensionField> DensePolynomialPqx<S> {
match mode {
MODE_P => {
if p + self.num_instances / 2 < self.Z.len() {
return self.Z[p + self.num_instances / 2][q_rev][w][x_rev];
self.Z[p + self.num_instances / 2][q_rev][w][x_rev]
} else {
return S::field_zero();
S::field_zero()
}
}
MODE_Q => {
return if self.num_proofs[p] == 1 {
if self.num_proofs[p] == 1 {
S::field_zero()
} else {
self.Z[p][q_rev + self.num_proofs[p] / 2][w][x_rev]
};
}
}
MODE_W => {
if w + self.num_witness_secs / 2 < self.Z[p][q_rev].len() {
return self.Z[p][q_rev][w + self.num_witness_secs / 2][x_rev];
self.Z[p][q_rev][w + self.num_witness_secs / 2][x_rev]
} else {
return S::field_zero();
S::field_zero()
}
}
MODE_X => {
return if self.num_inputs[p] == 1 {
if self.num_inputs[p] == 1 {
S::field_zero()
} else {
self.Z[p][q_rev][w][x_rev + self.num_inputs[p] / 2]
};
}
}
_ => {
panic!(
Expand Down
2 changes: 0 additions & 2 deletions spartan_parallel/src/dense_mlpoly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ use crate::scalar::SpartanExtensionField;
use super::errors::ProofVerifyError;
use super::math::Math;
use super::random::RandomTape;
use super::transcript::ProofTranscript;
use core::ops::Index;
use merlin::Transcript;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

#[cfg(feature = "multicore")]
use rayon::prelude::*;
Expand Down
12 changes: 5 additions & 7 deletions spartan_parallel/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<S: SpartanExtensionField> Instance<S> {
Vec<(usize, usize, [u8; 32])>,
) {
let int_to_scalar = |i: isize| {
let abs_scalar = S::from(i.abs() as u64);
let abs_scalar = S::from(i.unsigned_abs() as u64);
if i < 0 {
abs_scalar.negate().to_bytes()
} else {
Expand Down Expand Up @@ -1043,7 +1043,7 @@ impl<S: SpartanExtensionField> Instance<S> {
println!("Total Cons Exec Size: {}", total_cons_exec_size);
}

let pairwise_check_inst = Instance::new(
Instance::new(
3,
pairwise_check_max_num_cons,
pairwise_check_num_cons,
Expand All @@ -1052,8 +1052,7 @@ impl<S: SpartanExtensionField> Instance<S> {
&B_list,
&C_list,
)
.unwrap();
pairwise_check_inst
.unwrap()
};
(
pairwise_check_num_vars,
Expand Down Expand Up @@ -1294,7 +1293,7 @@ impl<S: SpartanExtensionField> Instance<S> {
println!("Total Cons Exec Size: {}", total_cons_exec_size);
}

let perm_root_inst = Instance::new(
Instance::new(
1,
perm_root_num_cons,
vec![perm_root_num_cons],
Expand All @@ -1303,8 +1302,7 @@ impl<S: SpartanExtensionField> Instance<S> {
&B_list,
&C_list,
)
.unwrap();
perm_root_inst
.unwrap()
};
(
perm_root_num_cons,
Expand Down
Loading