From 4947663826ee0c20c674f51eeed91a5a32776655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Masip?= Date: Fri, 18 Oct 2024 08:08:36 +0000 Subject: [PATCH] Minor changes --- pil2-components/lib/std/rs/src/debugger.rs | 8 ++++---- pil2-components/lib/std/rs/src/std_prod.rs | 14 ++++++++------ pil2-components/lib/std/rs/src/std_sum.rs | 16 ++++------------ 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/pil2-components/lib/std/rs/src/debugger.rs b/pil2-components/lib/std/rs/src/debugger.rs index b183a83c..698f2de1 100644 --- a/pil2-components/lib/std/rs/src/debugger.rs +++ b/pil2-components/lib/std/rs/src/debugger.rs @@ -49,10 +49,10 @@ pub fn check_bus_values( let assume_expr: Vec<_> = metadata.iter().filter(|(_, _, _, is_prove, _)| !is_prove).collect(); if num_errors_assume > 0 { - println!("\t ⁃ There are {} unmatching values thrown as 'assume' in some of:", num_errors_assume); + println!("\t ⁃ There are {} unmatching values thrown as 'assume' in:", num_errors_assume); for expr in assume_expr { println!( - "\t (Air Group, Air, Opid Name, Expression) = ({}, {}, {}, {:?})", + "\t (Air Group, Air, Argument, Expression) = ({}, {}, {}, {:?})", expr.0, expr.1, expr.2, expr.4 ); } @@ -107,10 +107,10 @@ pub fn check_bus_values( let prove_expr: Vec<_> = metadata.iter().filter(|(_, _, _, is_prove, _)| *is_prove).collect(); if num_errors_prove > 0 { - println!("\t ⁃ There are {} unmatching values thrown as 'prove' in some of:", num_errors_assume); + println!("\t ⁃ There are {} unmatching values thrown as 'prove' in:", num_errors_assume); for expr in prove_expr { println!( - "\t (Air Group, Air, Opid Name, Expression) = ({}, {}, {}, {:?})", + "\t (Air Group, Air, Argument, Expression) = ({}, {}, {}, {:?})", expr.0, expr.1, expr.2, expr.4 ); } diff --git a/pil2-components/lib/std/rs/src/std_prod.rs b/pil2-components/lib/std/rs/src/std_prod.rs index d78fac02..5130c11b 100644 --- a/pil2-components/lib/std/rs/src/std_prod.rs +++ b/pil2-components/lib/std/rs/src/std_prod.rs @@ -73,8 +73,10 @@ impl StdProd { num_rows: usize, debug_hints_data: Vec, ) { - let air_group = pctx.pilout.get_air_group(air_instance.airgroup_id); - let air = pctx.pilout.get_air(air_instance.airgroup_id, air_instance.air_id); + let airgroup_id = air_instance.airgroup_id; + let air_id = air_instance.air_id; + let air_group = pctx.pilout.get_air_group(airgroup_id); + let air = pctx.pilout.get_air(airgroup_id, air_id); let air_group_name = air_group.name().unwrap_or("Unknown air group").to_string(); let air_name = air.name().unwrap_or("Unknown air").to_string(); @@ -201,13 +203,13 @@ impl StdProd { }; if sel { - self.update_bus_vals(num_rows, opid, expressions.get(j), j, proves); + self.update_bus_vals(opid, expressions.get(j), j, proves); } } } } - fn update_bus_vals(&self, num_rows: usize, opid: u64, val: Vec>, row: usize, is_num: bool) { + fn update_bus_vals(&self, opid: u64, val: Vec>, row: usize, is_num: bool) { let debug_data = self.debug_data.as_ref().expect("Debug data missing"); let mut bus_values = debug_data.bus_values.lock().expect("Bus values missing"); @@ -216,8 +218,8 @@ impl StdProd { let bus_val = bus_opid.entry(val).or_insert_with(|| BusValue { num_proves: F::zero(), num_assumes: F::zero(), - row_proves: Vec::with_capacity(num_rows), - row_assumes: Vec::with_capacity(num_rows), + row_proves: Vec::new(), + row_assumes: Vec::new(), }); if is_num { diff --git a/pil2-components/lib/std/rs/src/std_sum.rs b/pil2-components/lib/std/rs/src/std_sum.rs index 1e001563..63612e83 100644 --- a/pil2-components/lib/std/rs/src/std_sum.rs +++ b/pil2-components/lib/std/rs/src/std_sum.rs @@ -231,21 +231,13 @@ impl StdSum { _ => panic!("sumid must be a field element"), }; - self.update_bus_vals(num_rows, sumid, expressions.get(j), j, proves, mul); + self.update_bus_vals(sumid, expressions.get(j), j, proves, mul); } } } } - fn update_bus_vals( - &self, - num_rows: usize, - sumid: u64, - val: Vec>, - row: usize, - proves: bool, - times: F, - ) { + fn update_bus_vals(&self, sumid: u64, val: Vec>, row: usize, proves: bool, times: F) { let debug_data = self.debug_data.as_ref().expect("Debug data missing"); let mut bus_values = debug_data.bus_values.lock().expect("Bus values missing"); @@ -254,8 +246,8 @@ impl StdSum { let bus_val = bus_sumid.entry(val.clone()).or_insert_with(|| BusValue { num_proves: F::zero(), num_assumes: F::zero(), - row_proves: Vec::with_capacity(num_rows), - row_assumes: Vec::with_capacity(num_rows), + row_proves: Vec::new(), + row_assumes: Vec::new(), }); if proves {