diff --git a/insertion/src/insertion_gate.rs b/insertion/src/insertion_gate.rs index cb5fdc22..33859e70 100644 --- a/insertion/src/insertion_gate.rs +++ b/insertion/src/insertion_gate.rs @@ -248,7 +248,7 @@ impl, const D: usize> MultiOpsGate for Insert 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gadgets/arithmetic.rs b/plonky2/src/gadgets/arithmetic.rs index 0d844af9..c00220c3 100644 --- a/plonky2/src/gadgets/arithmetic.rs +++ b/plonky2/src/gadgets/arithmetic.rs @@ -4,7 +4,6 @@ use plonky2_field::extension_field::Extendable; use plonky2_field::field_types::PrimeField; use crate::gates::arithmetic_base::ArithmeticGate; -use crate::gates::batchable::GateRef; use crate::gates::exponentiation::ExponentiationGate; use crate::hash::hash_types::RichField; use crate::iop::target::{BoolTarget, Target}; diff --git a/plonky2/src/gadgets/arithmetic_extension.rs b/plonky2/src/gadgets/arithmetic_extension.rs index 1ccbb6bd..e1a17988 100644 --- a/plonky2/src/gadgets/arithmetic_extension.rs +++ b/plonky2/src/gadgets/arithmetic_extension.rs @@ -4,7 +4,6 @@ use plonky2_field::field_types::{Field, PrimeField}; use plonky2_util::bits_u64; use crate::gates::arithmetic_extension::ArithmeticExtensionGate; -use crate::gates::batchable::GateRef; use crate::gates::multiplication_extension::MulExtensionGate; use crate::hash::hash_types::RichField; use crate::iop::ext_target::{ExtensionAlgebraTarget, ExtensionTarget}; diff --git a/plonky2/src/gadgets/interpolation.rs b/plonky2/src/gadgets/interpolation.rs index 92b17098..2d2c2273 100644 --- a/plonky2/src/gadgets/interpolation.rs +++ b/plonky2/src/gadgets/interpolation.rs @@ -3,7 +3,6 @@ use std::ops::Range; use plonky2_field::extension_field::Extendable; use crate::gates::batchable::BatchableGate; -use crate::gates::gate::Gate; use crate::hash::hash_types::RichField; use crate::iop::ext_target::ExtensionTarget; use crate::iop::target::Target; diff --git a/plonky2/src/gates/assert_le.rs b/plonky2/src/gates/assert_le.rs index 759faf51..6d7ad508 100644 --- a/plonky2/src/gates/assert_le.rs +++ b/plonky2/src/gates/assert_le.rs @@ -286,7 +286,7 @@ impl, const D: usize> MultiOpsGate for Assert 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/base_sum.rs b/plonky2/src/gates/base_sum.rs index 87db3c61..c1cf6a49 100644 --- a/plonky2/src/gates/base_sum.rs +++ b/plonky2/src/gates/base_sum.rs @@ -143,7 +143,7 @@ impl, const D: usize, const B: usize> MultiOpsGate< 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/batchable.rs b/plonky2/src/gates/batchable.rs index 6bae6a88..d40fd73c 100644 --- a/plonky2/src/gates/batchable.rs +++ b/plonky2/src/gates/batchable.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use std::fmt::{Debug, Error, Formatter}; use std::hash::{Hash, Hasher}; -use std::marker::PhantomData; use std::sync::Arc; use plonky2_field::extension_field::Extendable; diff --git a/plonky2/src/gates/comparison.rs b/plonky2/src/gates/comparison.rs index f0ab000f..7d3dd70f 100644 --- a/plonky2/src/gates/comparison.rs +++ b/plonky2/src/gates/comparison.rs @@ -319,7 +319,7 @@ impl, const D: usize> MultiOpsGate for Compar 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/constant.rs b/plonky2/src/gates/constant.rs index f59f3604..e813d573 100644 --- a/plonky2/src/gates/constant.rs +++ b/plonky2/src/gates/constant.rs @@ -108,7 +108,7 @@ impl, const D: usize> MultiOpsGate for Consta self.num_consts } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { vec![] } } diff --git a/plonky2/src/gates/exponentiation.rs b/plonky2/src/gates/exponentiation.rs index 6d72e21b..9803181a 100644 --- a/plonky2/src/gates/exponentiation.rs +++ b/plonky2/src/gates/exponentiation.rs @@ -5,7 +5,7 @@ use plonky2_field::field_types::Field; use plonky2_field::ops::Square; use plonky2_field::packed_field::PackedField; -use crate::gates::batchable::{BatchableGate, MultiOpsGate}; +use crate::gates::batchable::MultiOpsGate; use crate::gates::gate::Gate; use crate::gates::packed_util::PackedEvaluableBase; use crate::gates::util::StridedConstraintConsumer; @@ -196,7 +196,7 @@ impl, const D: usize> MultiOpsGate for Expone 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/gate.rs b/plonky2/src/gates/gate.rs index db73f6ce..34684194 100644 --- a/plonky2/src/gates/gate.rs +++ b/plonky2/src/gates/gate.rs @@ -1,6 +1,4 @@ -use std::fmt::{Debug, Error, Formatter}; -use std::hash::{Hash, Hasher}; -use std::sync::Arc; +use std::fmt::Debug; use plonky2_field::batch_util::batch_multiply_inplace; use plonky2_field::extension_field::{Extendable, FieldExtension}; diff --git a/plonky2/src/gates/gmimc.rs b/plonky2/src/gates/gmimc.rs index a27f4b71..47a82e62 100644 --- a/plonky2/src/gates/gmimc.rs +++ b/plonky2/src/gates/gmimc.rs @@ -223,7 +223,7 @@ impl + GMiMC, const D: usize, const WIDTH: u 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/interpolation.rs b/plonky2/src/gates/interpolation.rs index c1ac866c..325624b4 100644 --- a/plonky2/src/gates/interpolation.rs +++ b/plonky2/src/gates/interpolation.rs @@ -210,7 +210,7 @@ impl, const D: usize> MultiOpsGate 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/low_degree_interpolation.rs b/plonky2/src/gates/low_degree_interpolation.rs index 5f707fdb..5c640775 100644 --- a/plonky2/src/gates/low_degree_interpolation.rs +++ b/plonky2/src/gates/low_degree_interpolation.rs @@ -302,7 +302,7 @@ impl, const D: usize> MultiOpsGate 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/noop.rs b/plonky2/src/gates/noop.rs index 56942308..5de05991 100644 --- a/plonky2/src/gates/noop.rs +++ b/plonky2/src/gates/noop.rs @@ -63,7 +63,7 @@ impl, const D: usize> MultiOpsGate for NoopGa 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/poseidon.rs b/plonky2/src/gates/poseidon.rs index f2e3ebbf..4a2ffee7 100644 --- a/plonky2/src/gates/poseidon.rs +++ b/plonky2/src/gates/poseidon.rs @@ -412,7 +412,7 @@ impl, const D: usize> MultiOpsGate for Poseid 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/poseidon_mds.rs b/plonky2/src/gates/poseidon_mds.rs index 8b1fe9c4..ad899599 100644 --- a/plonky2/src/gates/poseidon_mds.rs +++ b/plonky2/src/gates/poseidon_mds.rs @@ -204,7 +204,7 @@ impl + Poseidon, const D: usize> MultiOpsGate 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/public_input.rs b/plonky2/src/gates/public_input.rs index d8fd0355..85145e31 100644 --- a/plonky2/src/gates/public_input.rs +++ b/plonky2/src/gates/public_input.rs @@ -94,7 +94,7 @@ impl, const D: usize> MultiOpsGate for Public 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/reducing.rs b/plonky2/src/gates/reducing.rs index ed75bfb5..cf07d3a7 100644 --- a/plonky2/src/gates/reducing.rs +++ b/plonky2/src/gates/reducing.rs @@ -172,7 +172,7 @@ impl, const D: usize> MultiOpsGate for Reduci 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/reducing_extension.rs b/plonky2/src/gates/reducing_extension.rs index de8b15b6..65eec526 100644 --- a/plonky2/src/gates/reducing_extension.rs +++ b/plonky2/src/gates/reducing_extension.rs @@ -172,7 +172,7 @@ impl, const D: usize> MultiOpsGate for Reduci 1 } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { unreachable!() } } diff --git a/plonky2/src/gates/switch.rs b/plonky2/src/gates/switch.rs index f782947a..e9048edd 100644 --- a/plonky2/src/gates/switch.rs +++ b/plonky2/src/gates/switch.rs @@ -195,7 +195,7 @@ impl, const D: usize> MultiOpsGate for Switch self.num_copies } - fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec { + fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec { todo!() } } diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index bfe5ee3a..80a951c7 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -17,17 +17,12 @@ use crate::gadgets::arithmetic_extension::ExtensionArithmeticOperation; use crate::gadgets::arithmetic_u32::U32Target; use crate::gates::arithmetic_base::ArithmeticGate; use crate::gates::arithmetic_extension::ArithmeticExtensionGate; -use crate::gates::arithmetic_u32::U32ArithmeticGate; use crate::gates::batchable::{BatchableGate, CurrentSlot, GateRef}; use crate::gates::constant::ConstantGate; use crate::gates::gate::{Gate, GateInstance, PrefixedGate}; use crate::gates::gate_tree::Tree; -use crate::gates::multiplication_extension::MulExtensionGate; use crate::gates::noop::NoopGate; use crate::gates::public_input::PublicInputGate; -use crate::gates::random_access::RandomAccessGate; -use crate::gates::subtraction_u32::U32SubtractionGate; -use crate::gates::switch::SwitchGate; use crate::hash::hash_types::{HashOutTarget, MerkleCapTarget, RichField}; use crate::iop::ext_target::ExtensionTarget; use crate::iop::generator::{ @@ -809,50 +804,6 @@ impl, const D: usize> CircuitBuilder { } } -/// Various gate types can contain multiple copies in a single Gate. This helper struct lets a -/// CircuitBuilder track such gates that are currently being "filled up." -pub struct BatchedGates, const D: usize> { - /// A map `(c0, c1) -> (g, i)` from constants `(c0,c1)` to an available arithmetic gate using - /// these constants with gate index `g` and already using `i` arithmetic operations. - pub(crate) free_arithmetic: HashMap<(F, F), (usize, usize)>, - pub(crate) free_base_arithmetic: HashMap<(F, F), (usize, usize)>, - - pub(crate) free_mul: HashMap, - - /// A map `b -> (g, i)` from `b` bits to an available random access gate of that size with gate - /// index `g` and already using `i` random accesses. - pub(crate) free_random_access: HashMap, - - /// `current_switch_gates[chunk_size - 1]` contains None if we have no switch gates with the value - /// chunk_size, and contains `(g, i, c)`, if the gate `g`, at index `i`, already contains `c` copies - /// of switches - pub(crate) current_switch_gates: Vec, usize, usize)>>, - - /// The `U32ArithmeticGate` currently being filled (so new u32 arithmetic operations will be added to this gate before creating a new one) - pub(crate) current_u32_arithmetic_gate: Option<(usize, usize)>, - - /// The `U32SubtractionGate` currently being filled (so new u32 subtraction operations will be added to this gate before creating a new one) - pub(crate) current_u32_subtraction_gate: Option<(usize, usize)>, - - /// An available `ConstantGate` instance, if any. - pub(crate) free_constant: Option<(usize, usize)>, -} - -impl, const D: usize> BatchedGates { - pub fn new() -> Self { - Self { - free_arithmetic: HashMap::new(), - free_base_arithmetic: HashMap::new(), - free_mul: HashMap::new(), - free_random_access: HashMap::new(), - current_switch_gates: Vec::new(), - current_u32_arithmetic_gate: None, - current_u32_subtraction_gate: None, - free_constant: None, - } - } -} - impl, const D: usize> CircuitBuilder { // /// Finds the last available arithmetic gate with the given constants or add one if there aren't any. // /// Returns `(g,i)` such that there is an arithmetic gate with the given constants at index diff --git a/waksman/src/permutation.rs b/waksman/src/permutation.rs index 877038dd..b0e725d2 100644 --- a/waksman/src/permutation.rs +++ b/waksman/src/permutation.rs @@ -71,13 +71,13 @@ fn assert_permutation_2x2, const D: usize>( /// Given two input wire chunks, add a new switch to the circuit (by adding one copy to a switch /// gate). Returns the wire for the switch boolean, and the two output wire chunks. fn create_switch, const D: usize>( - builder: &mut CircuitBuilder, + _builder: &mut CircuitBuilder, a1: Vec, a2: Vec, ) -> (Target, Vec, Vec) { assert_eq!(a1.len(), a2.len(), "Chunk size must be the same"); - let chunk_size = a1.len(); + let _chunk_size = a1.len(); todo!() // let (gate, gate_index, next_copy) = builder.find_switch_gate(chunk_size);