Skip to content

Commit 5075011

Browse files
authored
Provide caller range constraints for solving. (#2466)
1 parent 7d09c9d commit 5075011

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

executor/src/witgen/data_structures/caller_data.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ use itertools::Itertools;
22
use powdr_number::FieldElement;
33

44
use crate::witgen::{
5+
global_constraints::RangeConstraintSet,
56
machines::LookupCell,
67
processor::{Arguments, OuterQuery},
7-
EvalError, EvalResult, EvalValue,
8+
AlgebraicVariable, EvalError, EvalResult, EvalValue,
89
};
910

1011
/// A representation of the caller's data.
@@ -15,6 +16,8 @@ pub struct CallerData<'a, 'b, T> {
1516
data: Vec<T>,
1617
/// The affine expressions of the caller.
1718
arguments: &'b Arguments<'a, T>,
19+
/// Range constraints coming from the caller.
20+
range_constraints: &'b dyn RangeConstraintSet<AlgebraicVariable<'a>, T>,
1821
}
1922

2023
impl<'a, 'b, T: FieldElement> From<&'b OuterQuery<'a, '_, T>> for CallerData<'a, 'b, T> {
@@ -28,6 +31,7 @@ impl<'a, 'b, T: FieldElement> From<&'b OuterQuery<'a, '_, T>> for CallerData<'a,
2831
Self {
2932
data,
3033
arguments: &outer_query.arguments,
34+
range_constraints: outer_query.range_constraints,
3135
}
3236
}
3337
}
@@ -55,7 +59,7 @@ impl<'a, 'b, T: FieldElement> From<CallerData<'a, 'b, T>> for EvalResult<'a, T>
5559
for (l, v) in data.arguments.iter().zip_eq(data.data.iter()) {
5660
if !l.is_constant() {
5761
let evaluated = l.clone() - (*v).into();
58-
match evaluated.solve() {
62+
match evaluated.solve_with_range_constraints(data.range_constraints) {
5963
Ok(constraints) => {
6064
result.combine(constraints);
6165
}

0 commit comments

Comments
 (0)