Skip to content

Commit

Permalink
Provide caller range constraitns for solving.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed Feb 10, 2025
1 parent 7d09c9d commit c3c9dfe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions executor/src/witgen/data_structures/caller_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use itertools::Itertools;
use powdr_number::FieldElement;

use crate::witgen::{
global_constraints::RangeConstraintSet,
machines::LookupCell,
processor::{Arguments, OuterQuery},
EvalError, EvalResult, EvalValue,
AlgebraicVariable, EvalError, EvalResult, EvalValue,
};

/// A representation of the caller's data.
Expand All @@ -15,6 +16,7 @@ pub struct CallerData<'a, 'b, T> {
data: Vec<T>,
/// The affine expressions of the caller.
arguments: &'b Arguments<'a, T>,
range_constraints: &'b dyn RangeConstraintSet<AlgebraicVariable<'a>, T>,
}

impl<'a, 'b, T: FieldElement> From<&'b OuterQuery<'a, '_, T>> for CallerData<'a, 'b, T> {
Expand All @@ -28,6 +30,7 @@ impl<'a, 'b, T: FieldElement> From<&'b OuterQuery<'a, '_, T>> for CallerData<'a,
Self {
data,
arguments: &outer_query.arguments,
range_constraints: outer_query.range_constraints,
}
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ impl<'a, 'b, T: FieldElement> From<CallerData<'a, 'b, T>> for EvalResult<'a, T>
for (l, v) in data.arguments.iter().zip_eq(data.data.iter()) {
if !l.is_constant() {
let evaluated = l.clone() - (*v).into();
match evaluated.solve() {
match evaluated.solve_with_range_constraints(data.range_constraints) {
Ok(constraints) => {
result.combine(constraints);
}
Expand Down

0 comments on commit c3c9dfe

Please sign in to comment.