mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-09 01:03:08 +00:00
Clippy
This commit is contained in:
parent
ff949f40bc
commit
c0cfff1480
@ -248,7 +248,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Insert
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -286,7 +286,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Assert
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ impl<F: RichField + Extendable<D>, const D: usize, const B: usize> MultiOpsGate<
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -319,7 +319,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Compar
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Consta
|
||||
self.num_consts
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Expone
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -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};
|
||||
|
||||
@ -223,7 +223,7 @@ impl<F: RichField + Extendable<D> + GMiMC<WIDTH>, const D: usize, const WIDTH: u
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D>
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D>
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for NoopGa
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Poseid
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ impl<F: RichField + Extendable<D> + Poseidon, const D: usize> MultiOpsGate<F, D>
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Public
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Reduci
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Reduci
|
||||
1
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ impl<F: RichField + Extendable<D>, const D: usize> MultiOpsGate<F, D> for Switch
|
||||
self.num_copies
|
||||
}
|
||||
|
||||
fn dependencies_ith_op(&self, gate_index: usize, i: usize) -> Vec<Target> {
|
||||
fn dependencies_ith_op(&self, _gate_index: usize, _i: usize) -> Vec<Target> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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<F: RichField + Extendable<D>, 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<F, (usize, usize)>,
|
||||
|
||||
/// 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<usize, (usize, usize)>,
|
||||
|
||||
/// `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<Option<(SwitchGate<F, D>, 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<F: RichField + Extendable<D>, const D: usize> BatchedGates<F, D> {
|
||||
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<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
// /// 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
|
||||
|
||||
@ -71,13 +71,13 @@ fn assert_permutation_2x2<F: RichField + Extendable<D>, 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<F: RichField + Extendable<D>, const D: usize>(
|
||||
builder: &mut CircuitBuilder<F, D>,
|
||||
_builder: &mut CircuitBuilder<F, D>,
|
||||
a1: Vec<Target>,
|
||||
a2: Vec<Target>,
|
||||
) -> (Target, Vec<Target>, Vec<Target>) {
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user