mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-05 07:13:08 +00:00
PR feedback
This commit is contained in:
parent
d509f03b1b
commit
deea1c979b
@ -34,15 +34,19 @@ impl<const D: usize> ReducingGate<D> {
|
||||
pub fn wires_old_acc() -> Range<usize> {
|
||||
2 * D..3 * D
|
||||
}
|
||||
pub const START_COEFFS: usize = 3 * D;
|
||||
const START_COEFFS: usize = 3 * D;
|
||||
pub fn wires_coeffs(&self) -> Range<usize> {
|
||||
Self::START_COEFFS..Self::START_COEFFS + self.num_coeffs
|
||||
}
|
||||
pub fn start_accs(&self) -> usize {
|
||||
fn start_accs(&self) -> usize {
|
||||
Self::START_COEFFS + self.num_coeffs
|
||||
}
|
||||
pub fn wires_accs(&self, i: usize) -> Range<usize> {
|
||||
self.start_accs() + 4 * i..self.start_accs() + 4 * (i + 1)
|
||||
fn wires_accs(&self, i: usize) -> Range<usize> {
|
||||
if i == self.num_coeffs - 1 {
|
||||
// The last accumulator is the output.
|
||||
return Self::wires_output();
|
||||
}
|
||||
self.start_accs() + D * i..self.start_accs() + D * (i + 1)
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +74,6 @@ impl<F: Extendable<D>, const D: usize> Gate<F, D> for ReducingGate<D> {
|
||||
acc = accs[i];
|
||||
}
|
||||
|
||||
constraints.push(output - acc);
|
||||
constraints
|
||||
.into_iter()
|
||||
.flat_map(|alg| alg.to_basefield_array())
|
||||
@ -96,7 +99,6 @@ impl<F: Extendable<D>, const D: usize> Gate<F, D> for ReducingGate<D> {
|
||||
acc = accs[i];
|
||||
}
|
||||
|
||||
constraints.push(output - acc);
|
||||
constraints
|
||||
.into_iter()
|
||||
.flat_map(|alg| alg.to_basefield_array())
|
||||
@ -130,7 +132,6 @@ impl<F: Extendable<D>, const D: usize> Gate<F, D> for ReducingGate<D> {
|
||||
acc = accs[i];
|
||||
}
|
||||
|
||||
constraints.push(builder.sub_ext_algebra(output, acc));
|
||||
constraints
|
||||
.into_iter()
|
||||
.flat_map(|alg| alg.to_ext_target_array())
|
||||
@ -216,14 +217,8 @@ impl<F: Extendable<D>, const D: usize> SimpleGenerator<F> for ReducingGenerator<
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::extension_field::quartic::QuarticCrandallField;
|
||||
use crate::field::extension_field::FieldExtension;
|
||||
use crate::field::field::Field;
|
||||
use crate::gates::gate::Gate;
|
||||
use crate::gates::gate_testing::test_low_degree;
|
||||
use crate::gates::reducing::ReducingGate;
|
||||
use crate::proof::Hash;
|
||||
use crate::vars::EvaluationVars;
|
||||
|
||||
#[test]
|
||||
fn low_degree() {
|
||||
|
||||
@ -108,8 +108,6 @@ impl<const D: usize> ReducingFactorTarget<D> {
|
||||
self.count += terms.len() as u64;
|
||||
let zero = builder.zero();
|
||||
let zero_ext = builder.zero_extension();
|
||||
let mut gate;
|
||||
let mut gate_index;
|
||||
let mut acc = zero_ext;
|
||||
let mut reversed_terms = terms.to_vec();
|
||||
while reversed_terms.len() % max_coeffs_len != 0 {
|
||||
@ -117,8 +115,8 @@ impl<const D: usize> ReducingFactorTarget<D> {
|
||||
}
|
||||
reversed_terms.reverse();
|
||||
for chunk in reversed_terms.chunks_exact(max_coeffs_len) {
|
||||
gate = ReducingGate::new(max_coeffs_len);
|
||||
gate_index = builder.add_gate(gate.clone(), Vec::new());
|
||||
let gate = ReducingGate::new(max_coeffs_len);
|
||||
let gate_index = builder.add_gate(gate.clone(), Vec::new());
|
||||
|
||||
builder.route_extension(
|
||||
self.base,
|
||||
@ -227,7 +225,6 @@ mod tests {
|
||||
use crate::circuit_data::CircuitConfig;
|
||||
use crate::field::crandall_field::CrandallField;
|
||||
use crate::field::extension_field::quartic::QuarticCrandallField;
|
||||
use crate::field::extension_field::FieldExtension;
|
||||
use crate::verifier::verify;
|
||||
use crate::witness::PartialWitness;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user