Fix all clippy lints

This commit is contained in:
wborgeaud 2021-11-30 17:12:13 +01:00
parent 549ce0d8e9
commit 2c06309cf7
30 changed files with 92 additions and 113 deletions

View File

@ -1,5 +1,7 @@
//! Generates random constants using ChaCha20, seeded with zero.
#![allow(clippy::needless_range_loop)]
use plonky2::field::field_types::PrimeField;
use plonky2::field::goldilocks_field::GoldilocksField;
use rand::{Rng, SeedableRng};

View File

@ -35,6 +35,7 @@ impl<const D: usize> ExtensionTarget<D> {
let arr = self.to_target_array();
let k = (F::order() - 1u32) / (D as u64);
let z0 = F::Extension::W.exp_biguint(&(k * count as u64));
#[allow(clippy::needless_collect)]
let zs = z0
.powers()
.take(D)

View File

@ -38,12 +38,12 @@ fn fft_dispatch<F: Field>(
zero_factor: Option<usize>,
root_table: Option<&FftRootTable<F>>,
) -> Vec<F> {
let computed_root_table = if let Some(_) = root_table {
let computed_root_table = if root_table.is_some() {
None
} else {
Some(fft_root_table(input.len()))
};
let used_root_table = root_table.or(computed_root_table.as_ref()).unwrap();
let used_root_table = root_table.or_else(|| computed_root_table.as_ref()).unwrap();
fft_classic(input, zero_factor.unwrap_or(0), used_root_table)
}
@ -122,8 +122,8 @@ fn fft_classic_simd<P: PackedField>(
// Set omega to root_table[lg_half_m][0..half_m] but repeated.
let mut omega_vec = P::zero().to_vec();
for j in 0..omega_vec.len() {
omega_vec[j] = root_table[lg_half_m][j % half_m];
for (j, omega) in omega_vec.iter_mut().enumerate() {
*omega = root_table[lg_half_m][j % half_m];
}
let omega = P::from_slice(&omega_vec[..]);
@ -201,9 +201,9 @@ pub(crate) fn fft_classic<F: Field>(input: &[F], r: usize, root_table: &FftRootT
if lg_n <= lg_packed_width {
// Need the slice to be at least the width of two packed vectors for the vectorized version
// to work. Do this tiny problem in scalar.
fft_classic_simd::<Singleton<F>>(&mut values[..], r, lg_n, &root_table);
fft_classic_simd::<Singleton<F>>(&mut values[..], r, lg_n, root_table);
} else {
fft_classic_simd::<<F as Packable>::PackedType>(&mut values[..], r, lg_n, &root_table);
fft_classic_simd::<<F as Packable>::PackedType>(&mut values[..], r, lg_n, root_table);
}
values
}
@ -267,7 +267,7 @@ mod tests {
let values = subgroup
.into_iter()
.map(|x| evaluate_at_naive(&coefficients, x))
.map(|x| evaluate_at_naive(coefficients, x))
.collect();
PolynomialValues::new(values)
}
@ -276,8 +276,8 @@ mod tests {
let mut sum = F::ZERO;
let mut point_power = F::ONE;
for &c in &coefficients.coeffs {
sum = sum + c * point_power;
point_power = point_power * point;
sum += c * point_power;
point_power *= point;
}
sum
}

View File

@ -1,3 +1,4 @@
#![allow(clippy::eq_op)]
use crate::field::extension_field::Extendable;
use crate::field::extension_field::Frobenius;
use crate::field::field_types::Field;

View File

@ -335,7 +335,7 @@ pub trait Field:
}
fn kth_root_u64(&self, k: u64) -> Self {
let p = Self::order().clone();
let p = Self::order();
let p_minus_1 = &p - 1u32;
debug_assert!(
Self::is_monomial_permutation_u64(k),
@ -422,6 +422,7 @@ pub trait PrimeField: Field {
unsafe { self.sub_canonical_u64(1) }
}
/// # Safety
/// Equivalent to *self + Self::from_canonical_u64(rhs), but may be cheaper. The caller must
/// ensure that 0 <= rhs < Self::ORDER. The function may return incorrect results if this
/// precondition is not met. It is marked unsafe for this reason.
@ -431,6 +432,7 @@ pub trait PrimeField: Field {
*self + Self::from_canonical_u64(rhs)
}
/// # Safety
/// Equivalent to *self - Self::from_canonical_u64(rhs), but may be cheaper. The caller must
/// ensure that 0 <= rhs < Self::ORDER. The function may return incorrect results if this
/// precondition is not met. It is marked unsafe for this reason.

View File

@ -24,7 +24,7 @@ where
ExpectedOp: Fn(u64) -> u64,
{
let inputs = test_inputs(F::ORDER);
let expected: Vec<_> = inputs.iter().map(|x| expected_op(x.clone())).collect();
let expected: Vec<_> = inputs.iter().map(|&x| expected_op(x)).collect();
let output: Vec<_> = inputs
.iter()
.cloned()

View File

@ -216,7 +216,7 @@ impl<F: RichField> PolynomialBatchCommitment<F> {
lde_final_poly,
lde_final_values,
challenger,
&common_data,
common_data,
timing,
);

View File

@ -407,7 +407,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
arity_bits,
evals,
betas[i],
&common_data
common_data
)
);

View File

@ -142,9 +142,9 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
let mut combined_limbs = vec![];
let mut carry = self.zero_u32();
for i in 0..total_limbs {
to_add[i].push(carry);
let (new_result, new_carry) = self.add_many_u32(&to_add[i].clone());
for summands in &mut to_add {
summands.push(carry);
let (new_result, new_carry) = self.add_many_u32(summands);
combined_limbs.push(new_result);
carry = new_carry;
}
@ -172,9 +172,9 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
_phantom: PhantomData,
});
let div_b = self.mul_biguint(&div, &b);
let div_b = self.mul_biguint(&div, b);
let div_b_plus_rem = self.add_biguint(&div_b, &rem);
self.connect_biguint(&a, &div_b_plus_rem);
self.connect_biguint(a, &div_b_plus_rem);
let cmp_rem_b = self.cmp_biguint(&rem, b);
self.assert_one(cmp_rem_b.target);

View File

@ -378,7 +378,7 @@ mod tests {
let pw = PartialWitness::new();
let mut builder = CircuitBuilder::<F, D>::new(config);
let lst: Vec<F> = (0..size * 2).map(|n| F::from_canonical_usize(n)).collect();
let lst: Vec<F> = (0..size * 2).map(F::from_canonical_usize).collect();
let a: Vec<Vec<Target>> = lst[..]
.chunks(2)
.map(|pair| vec![builder.constant(pair[0]), builder.constant(pair[1])])

View File

@ -224,7 +224,7 @@ mod tests {
izip!(is_write_vals, address_vals, timestamp_vals, value_vals)
.zip(combined_vals_u64)
.collect::<Vec<_>>();
input_ops_and_keys.sort_by_key(|(_, val)| val.clone());
input_ops_and_keys.sort_by_key(|(_, val)| *val);
let input_ops_sorted: Vec<_> = input_ops_and_keys.iter().map(|(x, _)| x).collect();
let output_ops =

View File

@ -261,17 +261,11 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
fn dependencies(&self) -> Vec<Target> {
let local_target = |input| Target::wire(self.gate_index, input);
let mut deps = Vec::with_capacity(3);
deps.push(local_target(
U32ArithmeticGate::<F, D>::wire_ith_multiplicand_0(self.i),
));
deps.push(local_target(
U32ArithmeticGate::<F, D>::wire_ith_multiplicand_1(self.i),
));
deps.push(local_target(U32ArithmeticGate::<F, D>::wire_ith_addend(
self.i,
)));
deps
vec![
local_target(U32ArithmeticGate::<F, D>::wire_ith_multiplicand_0(self.i)),
local_target(U32ArithmeticGate::<F, D>::wire_ith_multiplicand_1(self.i)),
local_target(U32ArithmeticGate::<F, D>::wire_ith_addend(self.i)),
]
}
fn run_once(&self, witness: &PartitionWitness<F>, out_buffer: &mut GeneratedValues<F>) {
@ -307,23 +301,19 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
let num_limbs = U32ArithmeticGate::<F, D>::num_limbs();
let limb_base = 1 << U32ArithmeticGate::<F, D>::limb_bits();
let output_limbs_u64: Vec<_> = unfold((), move |_| {
let output_limbs_u64 = unfold((), move |_| {
let ret = output_u64 % limb_base;
output_u64 /= limb_base;
Some(ret)
})
.take(num_limbs)
.collect();
let output_limbs_f: Vec<_> = output_limbs_u64
.into_iter()
.map(F::from_canonical_u64)
.collect();
.take(num_limbs);
let output_limbs_f = output_limbs_u64.map(F::from_canonical_u64);
for j in 0..num_limbs {
for (j, output_limb) in output_limbs_f.enumerate() {
let wire = local_wire(U32ArithmeticGate::<F, D>::wire_ith_output_jth_limb(
self.i, j,
));
out_buffer.set_wire(wire, output_limbs_f[j]);
out_buffer.set_wire(wire, output_limb);
}
}
}

View File

@ -340,10 +340,10 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
fn dependencies(&self) -> Vec<Target> {
let local_target = |input| Target::wire(self.gate_index, input);
let mut deps = Vec::new();
deps.push(local_target(self.gate.wire_first_input()));
deps.push(local_target(self.gate.wire_second_input()));
deps
vec![
local_target(self.gate.wire_first_input()),
local_target(self.gate.wire_second_input()),
]
}
fn run_once(&self, witness: &PartitionWitness<F>, out_buffer: &mut GeneratedValues<F>) {
@ -555,7 +555,7 @@ mod tests {
};
let mut rng = rand::thread_rng();
let max: u64 = 1 << num_bits - 1;
let max: u64 = 1 << (num_bits - 1);
let first_input_u64 = rng.gen_range(0..max);
let second_input_u64 = {
let mut val = rng.gen_range(0..max);

View File

@ -151,10 +151,8 @@ impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ComparisonGate
.collect();
// Range-check the bits.
for i in 0..most_significant_diff_bits.len() {
constraints.push(
most_significant_diff_bits[i] * (F::Extension::ONE - most_significant_diff_bits[i]),
);
for &bit in &most_significant_diff_bits {
constraints.push(bit * (F::Extension::ONE - bit));
}
let bits_combined = reduce_with_powers(&most_significant_diff_bits, F::Extension::TWO);
@ -232,9 +230,8 @@ impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ComparisonGate
.collect();
// Range-check the bits.
for i in 0..most_significant_diff_bits.len() {
constraints
.push(most_significant_diff_bits[i] * (F::ONE - most_significant_diff_bits[i]));
for &bit in &most_significant_diff_bits {
constraints.push(bit * (F::ONE - bit));
}
let bits_combined = reduce_with_powers(&most_significant_diff_bits, F::TWO);
@ -324,8 +321,7 @@ impl<F: RichField + Extendable<D>, const D: usize> Gate<F, D> for ComparisonGate
.collect();
// Range-check the bits.
for i in 0..most_significant_diff_bits.len() {
let this_bit = most_significant_diff_bits[i];
for &this_bit in &most_significant_diff_bits {
let inverse = builder.sub_extension(one, this_bit);
constraints.push(builder.mul_extension(this_bit, inverse));
}
@ -388,10 +384,10 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
fn dependencies(&self) -> Vec<Target> {
let local_target = |input| Target::wire(self.gate_index, input);
let mut deps = Vec::new();
deps.push(local_target(self.gate.wire_first_input()));
deps.push(local_target(self.gate.wire_second_input()));
deps
vec![
local_target(self.gate.wire_first_input()),
local_target(self.gate.wire_second_input()),
]
}
fn run_once(&self, witness: &PartitionWitness<F>, out_buffer: &mut GeneratedValues<F>) {
@ -638,7 +634,7 @@ mod tests {
};
let mut rng = rand::thread_rng();
let max: u64 = 1 << num_bits - 1;
let max: u64 = 1 << (num_bits - 1);
let first_input_u64 = rng.gen_range(0..max);
let second_input_u64 = {
let mut val = rng.gen_range(0..max);

View File

@ -335,9 +335,8 @@ mod tests {
.map(|b| F::from_canonical_u64(*b))
.collect();
let mut v = Vec::new();
v.push(base);
v.extend(power_bits_f.clone());
let mut v = vec![base];
v.extend(power_bits_f);
let mut intermediate_values = Vec::new();
let mut current_intermediate_value = F::ONE;

View File

@ -251,8 +251,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F> for Insert
let local_targets = |inputs: Range<usize>| inputs.map(local_target);
let mut deps = Vec::new();
deps.push(local_target(self.gate.wires_insertion_index()));
let mut deps = vec![local_target(self.gate.wires_insertion_index())];
deps.extend(local_targets(self.gate.wires_element_to_insert()));
for i in 0..self.gate.vec_size {
deps.extend(local_targets(self.gate.wires_original_list_item(i)));
@ -291,7 +290,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F> for Insert
vec_size
);
let mut new_vec = orig_vec.clone();
let mut new_vec = orig_vec;
new_vec.insert(insertion_index, to_insert);
let mut equality_dummy_vals = Vec::new();
@ -372,14 +371,13 @@ mod tests {
fn get_wires(orig_vec: Vec<FF>, insertion_index: usize, element_to_insert: FF) -> Vec<FF> {
let vec_size = orig_vec.len();
let mut v = Vec::new();
v.push(F::from_canonical_usize(insertion_index));
let mut v = vec![F::from_canonical_usize(insertion_index)];
v.extend(element_to_insert.0);
for j in 0..vec_size {
v.extend(orig_vec[j].0);
}
let mut new_vec = orig_vec.clone();
let mut new_vec = orig_vec;
new_vec.insert(insertion_index, element_to_insert);
let mut equality_dummy_vals = Vec::new();
for i in 0..=vec_size {

View File

@ -72,7 +72,7 @@ impl<F: RichField + Extendable<D>, const D: usize> HighDegreeInterpolationGate<F
g.powers()
.take(size)
.map(move |x| {
let subgroup_element = builder.constant(x.into());
let subgroup_element = builder.constant(x);
builder.scalar_mul_ext(subgroup_element, shift)
})
.collect()

View File

@ -157,7 +157,7 @@ where
// Partial rounds.
<F as Poseidon<WIDTH>>::partial_first_constant_layer(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&state);
for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) {
let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)];
constraints.push(state[0] - sbox_in);
@ -243,7 +243,7 @@ where
// Partial rounds.
<F as Poseidon<WIDTH>>::partial_first_constant_layer(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&state);
for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) {
let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)];
constraints.push(state[0] - sbox_in);
@ -345,7 +345,7 @@ where
}
} else {
<F as Poseidon<WIDTH>>::partial_first_constant_layer_recursive(builder, &mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init_recursive(builder, &mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init_recursive(builder, &state);
for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) {
let sbox_in = vars.local_wires[Self::wire_partial_sbox(r)];
constraints.push(builder.sub_extension(state[0], sbox_in));
@ -489,7 +489,7 @@ where
}
<F as Poseidon<WIDTH>>::partial_first_constant_layer(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&mut state);
state = <F as Poseidon<WIDTH>>::mds_partial_layer_init(&state);
for r in 0..(poseidon::N_PARTIAL_ROUNDS - 1) {
out_buffer.set_wire(
local_wire(PoseidonGate::<F, D, WIDTH>::wire_partial_sbox(r)),

View File

@ -263,8 +263,7 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
fn dependencies(&self) -> Vec<Target> {
let local_target = |input| Target::wire(self.gate_index, input);
let mut deps = Vec::new();
deps.push(local_target(self.gate.wire_access_index(self.copy)));
let mut deps = vec![local_target(self.gate.wire_access_index(self.copy))];
for i in 0..self.gate.vec_size() {
deps.push(local_target(self.gate.wire_list_item(i, self.copy)));
}

View File

@ -244,17 +244,11 @@ impl<F: RichField + Extendable<D>, const D: usize> SimpleGenerator<F>
fn dependencies(&self) -> Vec<Target> {
let local_target = |input| Target::wire(self.gate_index, input);
let mut deps = Vec::with_capacity(3);
deps.push(local_target(U32SubtractionGate::<F, D>::wire_ith_input_x(
self.i,
)));
deps.push(local_target(U32SubtractionGate::<F, D>::wire_ith_input_y(
self.i,
)));
deps.push(local_target(
U32SubtractionGate::<F, D>::wire_ith_input_borrow(self.i),
));
deps
vec![
local_target(U32SubtractionGate::<F, D>::wire_ith_input_x(self.i)),
local_target(U32SubtractionGate::<F, D>::wire_ith_input_y(self.i)),
local_target(U32SubtractionGate::<F, D>::wire_ith_input_borrow(self.i)),
]
}
fn run_once(&self, witness: &PartitionWitness<F>, out_buffer: &mut GeneratedValues<F>) {

View File

@ -1,3 +1,5 @@
#![allow(clippy::assertions_on_constants)]
use std::arch::aarch64::*;
use static_assertions::const_assert;
@ -171,9 +173,7 @@ unsafe fn multiply(x: u64, y: u64) -> u64 {
let xy_hi_lo_mul_epsilon = mul_epsilon(xy_hi);
// add_with_wraparound is safe, as xy_hi_lo_mul_epsilon <= 0xfffffffe00000001 <= ORDER.
let res1 = add_with_wraparound(res0, xy_hi_lo_mul_epsilon);
res1
add_with_wraparound(res0, xy_hi_lo_mul_epsilon)
}
// ==================================== STANDALONE CONST LAYER =====================================
@ -266,9 +266,7 @@ unsafe fn mds_reduce(
// Multiply by EPSILON and accumulate.
let res_unadj = vmlal_laneq_u32::<0>(res_lo, res_hi_hi, mds_consts0);
let res_adj = vcgtq_u64(res_lo, res_unadj);
let res = vsraq_n_u64::<32>(res_unadj, res_adj);
res
vsraq_n_u64::<32>(res_unadj, res_adj)
}
#[inline(always)]
@ -968,8 +966,7 @@ unsafe fn partial_round(
#[inline(always)]
unsafe fn full_round(state: [u64; 12], round_constants: &[u64; WIDTH]) -> [u64; 12] {
let state = sbox_layer_full(state);
let state = mds_const_layers_full(state, round_constants);
state
mds_const_layers_full(state, round_constants)
}
#[inline]

View File

@ -110,9 +110,7 @@ pub fn hash_n_to_m<F: RichField>(mut inputs: Vec<F>, num_outputs: usize, pad: bo
// Absorb all input chunks.
for input_chunk in inputs.chunks(SPONGE_RATE) {
for i in 0..input_chunk.len() {
state[i] = input_chunk[i];
}
state[..input_chunk.len()].copy_from_slice(input_chunk);
state = permute(state);
}

View File

@ -41,6 +41,7 @@ impl Target {
/// A `Target` which has already been constrained such that it can only be 0 or 1.
#[derive(Copy, Clone, Debug)]
#[allow(clippy::manual_non_exhaustive)]
pub struct BoolTarget {
pub target: Target,
/// This private field is here to force all instantiations to go through `new_unsafe`.

View File

@ -1,5 +1,10 @@
#![allow(incomplete_features)]
#![allow(const_evaluatable_unchecked)]
#![allow(clippy::new_without_default)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::len_without_is_empty)]
#![allow(clippy::module_inception)]
#![allow(clippy::needless_range_loop)]
#![feature(asm)]
#![feature(asm_sym)]
#![feature(destructuring_assignment)]

View File

@ -634,7 +634,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
// Precompute FFT roots.
let max_fft_points =
1 << degree_bits + max(self.config.rate_bits, log2_ceil(quotient_degree_factor));
1 << (degree_bits + max(self.config.rate_bits, log2_ceil(quotient_degree_factor)));
let fft_root_table = fft_root_table(max_fft_points);
let constants_sigmas_vecs = [constant_vecs, sigma_vecs.clone()].concat();
@ -669,7 +669,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
let watch_rep_index = forest.parents[watch_index];
generator_indices_by_watches
.entry(watch_rep_index)
.or_insert(vec![])
.or_insert_with(Vec::new)
.push(i);
}
}

View File

@ -138,11 +138,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CompressedProof<F, D> {
plonk_zs_partial_products_cap,
quotient_polys_cap,
openings,
opening_proof: opening_proof.decompress(
&challenges,
fri_inferred_elements,
common_data,
),
opening_proof: opening_proof.decompress(challenges, fri_inferred_elements, common_data),
}
}
}

View File

@ -527,7 +527,7 @@ mod tests {
&inner_vd.constants_sigmas_cap,
);
builder.add_recursive_verifier(pt, &inner_config, &inner_data, &inner_cd);
builder.add_recursive_verifier(pt, inner_config, &inner_data, &inner_cd);
if print_gate_counts {
builder.print_gate_counts(0);
@ -563,12 +563,12 @@ mod tests {
) -> Result<()> {
let proof_bytes = proof.to_bytes()?;
info!("Proof length: {} bytes", proof_bytes.len());
let proof_from_bytes = ProofWithPublicInputs::from_bytes(proof_bytes, &cd)?;
let proof_from_bytes = ProofWithPublicInputs::from_bytes(proof_bytes, cd)?;
assert_eq!(proof, &proof_from_bytes);
let now = std::time::Instant::now();
let compressed_proof = proof.clone().compress(&cd)?;
let decompressed_compressed_proof = compressed_proof.clone().decompress(&cd)?;
let compressed_proof = proof.clone().compress(cd)?;
let decompressed_compressed_proof = compressed_proof.clone().decompress(cd)?;
info!("{:.4}s to compress proof", now.elapsed().as_secs_f64());
assert_eq!(proof, &decompressed_compressed_proof);
@ -578,7 +578,7 @@ mod tests {
compressed_proof_bytes.len()
);
let compressed_proof_from_bytes =
CompressedProofWithPublicInputs::from_bytes(compressed_proof_bytes, &cd)?;
CompressedProofWithPublicInputs::from_bytes(compressed_proof_bytes, cd)?;
assert_eq!(compressed_proof, compressed_proof_from_bytes);
Ok(())

View File

@ -441,7 +441,7 @@ mod tests {
assert_eq!(coset_evals, naive_coset_evals);
let ifft_coeffs = PolynomialValues::new(coset_evals).coset_ifft(shift);
assert_eq!(poly, ifft_coeffs.into());
assert_eq!(poly, ifft_coeffs);
}
#[test]

View File

@ -13,7 +13,7 @@ pub(crate) fn quotient_chunk_products<F: Field>(
max_degree: usize,
) -> Vec<F> {
debug_assert!(max_degree > 1);
assert!(quotient_values.len() > 0);
assert!(!quotient_values.is_empty());
let chunk_size = max_degree;
quotient_values
.chunks(chunk_size)
@ -24,7 +24,7 @@ pub(crate) fn quotient_chunk_products<F: Field>(
/// Compute partial products of the original vector `v` such that all products consist of `max_degree`
/// or less elements. This is done until we've computed the product `P` of all elements in the vector.
pub(crate) fn partial_products_and_z_gx<F: Field>(z_x: F, quotient_chunk_products: &[F]) -> Vec<F> {
assert!(quotient_chunk_products.len() > 0);
assert!(!quotient_chunk_products.is_empty());
let mut res = Vec::new();
let mut acc = z_x;
for &quotient_chunk_product in quotient_chunk_products {

View File

@ -92,7 +92,7 @@ impl TimingTree {
fn duration(&self) -> Duration {
self.exit_time
.unwrap_or(Instant::now())
.unwrap_or_else(Instant::now)
.duration_since(self.enter_time)
}