You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stack-encrypt: one inverted-range rule for between on the typed chain and the binding #1320
A between query whose low bound is above its high bound is refused with TermError::InvertedRange. If it were not, the user would silently get no rows. Today the rule is written twice. The typed ORE and OPE Supports impls compare the two plaintexts with >. The binding has its own comparator over the two value frames, which reads each integer's sign and 128-bit word so that one comparison covers every width.
Add a generic range function (over PartialOrd) to the crate-private op::prepare module, and have both paths call it. The binding keeps only the code that unpacks two integer bounds of the same kind from their frames. The comparison and the refusal live in the shared function. Equal bounds stay allowed on both paths.
Acceptance criteria
op::prepare has a range function that refuses lo > hi and accepts lo == hi.
The typed Between impls on ORE and OPE call it from Supports::prepare.
The binding's range check calls it after unpacking the bounds; the comparison and refusal code in the binding is gone.
Interface tests on the range function cover inverted, equal and ordered bounds.
The table test from the first ticket passes unchanged, including its widths up to 128 bits.
Single-path tests that pin only an inverted-range refusal the table now covers are removed.
cargo-mutants --in-diff leaves no surviving mutant in the changed code.
The Stack Encrypt API plan, merged in pull request #1365, replaces this rule. An inverted range such as between(65, 18) is let through. It derives both bounds and matches nothing, as commit 8b5fc57b6 decided. The engine cannot know which bound the caller meant. So the InvertedRange error that #1279 asked for is dropped. #1317 still records how each path behaves today.
Activity
coderdan commentedon Nov 8, 2026
The Stack Encrypt API plan, merged in pull request #1365, replaces this rule. An inverted range such as
between(65, 18)is let through. It derives both bounds and matches nothing, as commit8b5fc57b6decided. The engine cannot know which bound the caller meant. So theInvertedRangeerror that #1279 asked for is dropped. #1317 still records how each path behaves today.