From 54a80f1c9eb65904568b5ace6ead9a7cfb5fba8e Mon Sep 17 00:00:00 2001 From: Alon Haramati Date: Tue, 16 Jul 2024 15:15:34 +0300 Subject: [PATCH] Get range check inputs one by one. --- .../src/components/range_check_unit/component.rs | 12 +++++------- .../src/components/range_check_unit/mod.rs | 12 ++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/stwo_cairo_prover/src/components/range_check_unit/component.rs b/stwo_cairo_prover/src/components/range_check_unit/component.rs index 704a634f..1e4d8f9a 100644 --- a/stwo_cairo_prover/src/components/range_check_unit/component.rs +++ b/stwo_cairo_prover/src/components/range_check_unit/component.rs @@ -117,15 +117,13 @@ impl ComponentGen for RangeCheckUnitTraceGenerator {} impl ComponentTraceGenerator for RangeCheckUnitTraceGenerator { type Component = RangeCheckUnitComponent; - type Inputs = Vec; + type Inputs = BaseField; fn add_inputs(&mut self, inputs: &Self::Inputs) { - for input in inputs { - let input = input.0 as usize; - // TODO: replace the debug_assert! with an error return. - debug_assert!(input < self.max_value, "Input out of range"); - self.multiplicities[input] += 1; - } + let input = inputs.0 as usize; + // TODO: replace the debug_assert! with an error return. + debug_assert!(input < self.max_value, "Input out of range"); + self.multiplicities[input] += 1; } fn write_trace( diff --git a/stwo_cairo_prover/src/components/range_check_unit/mod.rs b/stwo_cairo_prover/src/components/range_check_unit/mod.rs index 3658ee41..15ec140e 100644 --- a/stwo_cairo_prover/src/components/range_check_unit/mod.rs +++ b/stwo_cairo_prover/src/components/range_check_unit/mod.rs @@ -6,7 +6,6 @@ mod tests { use std::collections::BTreeMap; use component::{RangeCheckUnitComponent, RangeCheckUnitTraceGenerator, RC_COMPONENT_ID, RC_Z}; - use itertools::Itertools; use stwo_prover::core::air::{Air, AirProver, Component, ComponentProver}; use stwo_prover::core::backend::CpuBackend; use stwo_prover::core::channel::{Blake2sChannel, Channel}; @@ -28,7 +27,7 @@ mod tests { pub fn register_test_rc(registry: &mut ComponentGenerationRegistry) { registry.register(RC_COMPONENT_ID, RangeCheckUnitTraceGenerator::new(8)); - let inputs = vec![ + vec![ vec![BaseField::from_u32_unchecked(0); 3], vec![BaseField::from_u32_unchecked(1); 1], vec![BaseField::from_u32_unchecked(2); 2], @@ -40,10 +39,11 @@ mod tests { ] .into_iter() .flatten() - .collect_vec(); - registry - .get_generator_mut::(RC_COMPONENT_ID) - .add_inputs(&inputs); + .for_each(|input| { + registry + .get_generator_mut::(RC_COMPONENT_ID) + .add_inputs(&input); + }); } struct TestAirGenerator {