Skip to content

Commit 17626b9

Browse files
Golovanov399jonathanpwang
authored andcommitted
[fix] Remove an air we never use (#50)
**Finding Link:** https://cantina.xyz/code/c486d600-bed0-4fc6-aed1-de759fd29fa2/findings/72 ## Description of Fix There was `AssertLtWhenTransitionAir` that was supposed to check, in `AssertLtSubAir`, that every pair of consecutive rows represents two numbers in increasing order. In reality, we specifically set the `count` column value to something nonzero whenever we want to perform the checks of type `x < y`: this also allows us to do this not on all transitions but only on the ones we want. Therefore, the unused code is gone.
1 parent 8b223ef commit 17626b9

File tree

1 file changed

+0
-42
lines changed
  • crates/circuits/primitives/src/assert_less_than

1 file changed

+0
-42
lines changed

crates/circuits/primitives/src/assert_less_than/mod.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ impl AssertLtSubAir {
9898
}
9999
}
100100

101-
pub fn when_transition(self) -> AssertLtWhenTransitionAir {
102-
AssertLtWhenTransitionAir(self)
103-
}
104-
105101
pub fn range_max_bits(&self) -> usize {
106102
self.bus.range_max_bits
107103
}
@@ -186,44 +182,6 @@ impl<AB: InteractionBuilder> SubAir<AB> for AssertLtSubAir {
186182
}
187183
}
188184

189-
/// The same subair as [AssertLtSubAir] except that non-range check
190-
/// constraints are not imposed on the last row.
191-
/// Intended use case is for asserting less than between entries in
192-
/// adjacent rows.
193-
#[derive(Clone, Copy, Debug)]
194-
pub struct AssertLtWhenTransitionAir(pub AssertLtSubAir);
195-
196-
impl<AB: InteractionBuilder> SubAir<AB> for AssertLtWhenTransitionAir {
197-
type AirContext<'a>
198-
= (AssertLessThanIo<AB::Expr>, &'a [AB::Var])
199-
where
200-
AB::Expr: 'a,
201-
AB::Var: 'a,
202-
AB: 'a;
203-
204-
/// Imposes the non-interaction constraints on all except the last row. This is
205-
/// intended for use when the comparators `x, y` are on adjacent rows.
206-
///
207-
/// This function does also enable the interaction constraints _on every row_.
208-
/// The `eval_interactions` performs range checks on `lower_decomp` on every row, even
209-
/// though in this AIR the lower_decomp is not used on the last row.
210-
/// This simply means the trace generation must fill in the last row with numbers in
211-
/// range (e.g., with zeros)
212-
fn eval<'a>(
213-
&'a self,
214-
builder: &'a mut AB,
215-
(io, lower_decomp): (AssertLessThanIo<AB::Expr>, &'a [AB::Var]),
216-
) where
217-
AB::Var: 'a,
218-
AB::Expr: 'a,
219-
{
220-
self.0
221-
.eval_range_checks(builder, lower_decomp, io.count.clone());
222-
self.0
223-
.eval_without_range_checks(&mut builder.when_transition(), io, lower_decomp);
224-
}
225-
}
226-
227185
impl<F: Field> TraceSubRowGenerator<F> for AssertLtSubAir {
228186
/// (range_checker, x, y)
229187
// x, y are u32 because memory records are storing u32 and there would be needless conversions. It also prevents a F: PrimeField32 trait bound.

0 commit comments

Comments
 (0)