From 37c916fc9021ba6193da085311f7ac46cbec12b0 Mon Sep 17 00:00:00 2001 From: Eduard S Date: Mon, 27 May 2024 08:58:21 +0000 Subject: [PATCH] fix: clippy warnings and PCS API update --- halo2_backend/src/arithmetic.rs | 1 + halo2_backend/src/poly/ipa/multiopen.rs | 2 +- halo2_backend/src/poly/query.rs | 2 +- halo2_frontend/src/circuit.rs | 2 +- halo2_frontend/src/plonk/circuit/constraint_system.rs | 1 + halo2_proofs/benches/plonk.rs | 1 + halo2_proofs/examples/circuit-layout.rs | 1 + halo2_proofs/tests/compress_selectors.rs | 3 +++ halo2_proofs/tests/plonk_api.rs | 1 + p3_frontend/tests/common/mod.rs | 7 +++---- 10 files changed, 14 insertions(+), 7 deletions(-) diff --git a/halo2_backend/src/arithmetic.rs b/halo2_backend/src/arithmetic.rs index f580f72fd1..ebdcae1e58 100644 --- a/halo2_backend/src/arithmetic.rs +++ b/halo2_backend/src/arithmetic.rs @@ -14,6 +14,7 @@ pub use halo2curves::{CurveAffine, CurveExt}; /// This represents an element of a group with basic operations that can be /// performed. This allows an FFT implementation (for example) to operate /// generically over either a field or elliptic curve group. +#[allow(dead_code)] pub(crate) trait FftGroup: Copy + Send + Sync + 'static + GroupOpsOwned + ScalarMulOwned { diff --git a/halo2_backend/src/poly/ipa/multiopen.rs b/halo2_backend/src/poly/ipa/multiopen.rs index 1df7f41daa..d4e1a33ba1 100644 --- a/halo2_backend/src/poly/ipa/multiopen.rs +++ b/halo2_backend/src/poly/ipa/multiopen.rs @@ -131,7 +131,7 @@ where let mut point_index_set = BTreeSet::new(); for (commitment, point_idx_set) in commitment_set_map.iter() { if query.get_commitment() == *commitment { - point_index_set = point_idx_set.clone(); + point_index_set.clone_from(point_idx_set); } } assert!(!point_index_set.is_empty()); diff --git a/halo2_backend/src/poly/query.rs b/halo2_backend/src/poly/query.rs index bc7a20c240..30be4fbec7 100644 --- a/halo2_backend/src/poly/query.rs +++ b/halo2_backend/src/poly/query.rs @@ -132,7 +132,7 @@ pub enum CommitmentReference<'r, C: CurveAffine, M: MSM> { impl<'r, C: CurveAffine, M: MSM> Copy for CommitmentReference<'r, C, M> {} impl<'r, C: CurveAffine, M: MSM> PartialEq for CommitmentReference<'r, C, M> { - #![allow(clippy::vtable_address_comparisons)] + #![allow(ambiguous_wide_pointer_comparisons)] fn eq(&self, other: &Self) -> bool { match (self, other) { (&CommitmentReference::Commitment(a), &CommitmentReference::Commitment(b)) => { diff --git a/halo2_frontend/src/circuit.rs b/halo2_frontend/src/circuit.rs index d50e64d99c..5c6a75c731 100644 --- a/halo2_frontend/src/circuit.rs +++ b/halo2_frontend/src/circuit.rs @@ -394,7 +394,7 @@ fn batch_invert_assigned(assigned: Vec>>) -> Vec`. fn poly_invert( poly: &[Assigned], - inv_denoms: impl Iterator + ExactSizeIterator, + inv_denoms: impl ExactSizeIterator, ) -> Vec { assert_eq!(inv_denoms.len(), poly.len()); poly.iter() diff --git a/halo2_frontend/src/plonk/circuit/constraint_system.rs b/halo2_frontend/src/plonk/circuit/constraint_system.rs index 8794f38578..7a393a6ac0 100644 --- a/halo2_frontend/src/plonk/circuit/constraint_system.rs +++ b/halo2_frontend/src/plonk/circuit/constraint_system.rs @@ -15,6 +15,7 @@ use std::fmt::Debug; /// Represents an index into a vector where each entry corresponds to a distinct /// point that polynomials are queried at. #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub(crate) struct PointIndex(pub usize); /// A "virtual cell" is a PLONK cell that has been queried at a particular relative offset diff --git a/halo2_proofs/benches/plonk.rs b/halo2_proofs/benches/plonk.rs index 7551fde229..ac531f1c53 100644 --- a/halo2_proofs/benches/plonk.rs +++ b/halo2_proofs/benches/plonk.rs @@ -28,6 +28,7 @@ use criterion::{BenchmarkId, Criterion}; fn criterion_benchmark(c: &mut Criterion) { /// This represents an advice column at a certain row in the ConstraintSystem #[derive(Copy, Clone, Debug)] + #[allow(dead_code)] pub struct Variable(Column, usize); #[derive(Clone)] diff --git a/halo2_proofs/examples/circuit-layout.rs b/halo2_proofs/examples/circuit-layout.rs index 3d18a74786..3127faa1a9 100644 --- a/halo2_proofs/examples/circuit-layout.rs +++ b/halo2_proofs/examples/circuit-layout.rs @@ -10,6 +10,7 @@ use std::marker::PhantomData; /// This represents an advice column at a certain row in the ConstraintSystem #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] pub struct Variable(Column, usize); #[derive(Clone)] diff --git a/halo2_proofs/tests/compress_selectors.rs b/halo2_proofs/tests/compress_selectors.rs index 9f8cdefc01..ec87354fc2 100644 --- a/halo2_proofs/tests/compress_selectors.rs +++ b/halo2_proofs/tests/compress_selectors.rs @@ -45,6 +45,7 @@ struct MyCircuitConfig { s_add: Selector, s_mul: Selector, + #[allow(dead_code)] s_cubed: Selector, PI: Column, @@ -82,6 +83,7 @@ trait MyCircuitComposer { row: usize, ) -> Result<(), Error>; + #[allow(dead_code)] fn cube(&self, layouter: &mut impl Layouter, f: FM) -> Result<(Cell, Cell), Error> where FM: FnMut() -> Value<(Assigned, Assigned)>; @@ -362,6 +364,7 @@ fn test_mycircuit( let pk = keygen_pk_custom(¶ms, vk.clone(), &circuit, pk_keygen_compress_selectors)?; // Proving + #[allow(clippy::useless_vec)] let instances = vec![vec![Fr::one(), Fr::from_u128(3)]]; let instances_slice: &[&[Fr]] = &(instances .iter() diff --git a/halo2_proofs/tests/plonk_api.rs b/halo2_proofs/tests/plonk_api.rs index b3679d3de8..e44484e514 100644 --- a/halo2_proofs/tests/plonk_api.rs +++ b/halo2_proofs/tests/plonk_api.rs @@ -31,6 +31,7 @@ fn plonk_api() { /// This represents an advice column at a certain row in the ConstraintSystem #[derive(Copy, Clone, Debug)] + #[allow(dead_code)] pub struct Variable(Column, usize); #[derive(Clone)] diff --git a/p3_frontend/tests/common/mod.rs b/p3_frontend/tests/common/mod.rs index 771bafe7b9..62062584a4 100644 --- a/p3_frontend/tests/common/mod.rs +++ b/p3_frontend/tests/common/mod.rs @@ -1,4 +1,3 @@ -use halo2_backend::poly::commitment::ParamsProver; use halo2_backend::poly::kzg::commitment::{KZGCommitmentScheme, ParamsKZG}; use halo2_backend::poly::kzg::multiopen::{ProverSHPLONK, VerifierSHPLONK}; use halo2_backend::poly::kzg::strategy::SingleStrategy; @@ -110,10 +109,10 @@ pub(crate) fn setup_prove_verify( println!("Verifying..."); let mut verifier_transcript = Blake2bRead::<_, G1Affine, Challenge255<_>>::init(proof.as_slice()); - let strategy = SingleStrategy::new(verifier_params); + let strategy = SingleStrategy::new(&verifier_params); - verify_proof_single::, VerifierSHPLONK<'_, Bn256>, _, _, _>( - ¶ms, + verify_proof_single::, VerifierSHPLONK, _, _, _>( + &verifier_params, &vk, strategy, &vec_slices,