Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hecmas committed Oct 18, 2024
1 parent 23439c6 commit 4947663
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
8 changes: 4 additions & 4 deletions pil2-components/lib/std/rs/src/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ pub fn check_bus_values<F: PrimeField>(

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
);
}
Expand Down Expand Up @@ -107,10 +107,10 @@ pub fn check_bus_values<F: PrimeField>(

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
);
}
Expand Down
14 changes: 8 additions & 6 deletions pil2-components/lib/std/rs/src/std_prod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ impl<F: PrimeField> StdProd<F> {
num_rows: usize,
debug_hints_data: Vec<u64>,
) {
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();

Expand Down Expand Up @@ -201,13 +203,13 @@ impl<F: PrimeField> StdProd<F> {
};

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<HintFieldOutput<F>>, row: usize, is_num: bool) {
fn update_bus_vals(&self, opid: u64, val: Vec<HintFieldOutput<F>>, 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");

Expand All @@ -216,8 +218,8 @@ impl<F: PrimeField> StdProd<F> {
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 {
Expand Down
16 changes: 4 additions & 12 deletions pil2-components/lib/std/rs/src/std_sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,13 @@ impl<F: Copy + Debug + PrimeField> StdSum<F> {
_ => 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<HintFieldOutput<F>>,
row: usize,
proves: bool,
times: F,
) {
fn update_bus_vals(&self, sumid: u64, val: Vec<HintFieldOutput<F>>, 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");

Expand All @@ -254,8 +246,8 @@ impl<F: Copy + Debug + PrimeField> StdSum<F> {
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 {
Expand Down

0 comments on commit 4947663

Please sign in to comment.