Repository navigation
test(kani): NONE-shorting proofs + real-Inventory feasibility finding - #1697
Merged
Merged
Conversation
Two new proofs, both VERIFICATION SUCCESSFUL locally (kani 0.67 / CBMC): - proof_none_shorting_split_exact: the NONE over-reduction split (consume available, short the remainder) is exact for ALL amounts in range — no units created or lost at the zero crossing. - proof_none_conservation_across_zero: balance + totalReduced = totalAdded survives reductions that take the balance negative (the #1686 class, where the identity held on one code path and not the other). These complement the 396-behavior NONECorrect replay (model-reachable states) with all-values-in-range coverage at the arithmetic level. Spike finding, documented in the module: proofs over the REAL Inventory are not tractable today. A stutter harness driving the actual Inventory::reduce (single position, two symbolic i64s, unwind(3)) did not verify within a 40-minute solo CBMC budget; the solver log shows path explosion in (1) the currency interner (size_of_val_raw::<ArcInner<str>> from global interning) and (2) imbl::Vector's RRB-tree allocation machinery. Until Kani can stub the interner and bound imbl's fast path, implementation-level verification of the booking engine belongs to the behavior-replay + proptest layers; Kani proofs intentionally stay at the Decimal-arithmetic level, where CBMC verifies for all values in range within seconds. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs main branch (2026-07-02)
What do these numbers mean?
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds two new Kani proof harnesses in rustledger-core to strengthen formal coverage of NONE booking “shorting across zero” arithmetic (motivated by #1686 / NONECorrect.tla), and documents why full Inventory-level Kani verification is currently infeasible due to solver/path explosion.
Changes:
- Add
proof_none_shorting_split_exactandproof_none_conservation_across_zeroKani proofs (Decimal/i64-bounded) plus related documentation inkani_proofs.rs. - Remove workspace-level wasm32 rustflags configuration (
.cargo/config.toml) previously used to set--cfg getrandom_backend="wasm_js".
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/rustledger-core/src/kani_proofs.rs |
Adds two NONE-booking arithmetic proofs and documents the “real Inventory proofs not tractable” spike finding. |
.cargo/config.toml |
Deleted; previously set wasm32 rustflags for getrandom backend selection (may impact WASM CI/builds). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Merged
robcohen
added a commit
that referenced
this pull request
Jul 2, 2026
Patch release. User-facing fixes since v0.19.0: - NONE booking: over-reduction now shorts past zero from ANY balance (consumes available units, appends the remainder as a negative position), fixing the inconsistency where shorting from a positive balance was rejected while shorting from zero was allowed (#1686, via #1688). - try_reduce: the read-only preview is now reduce-on-a-clone — equivalent to the mutating path by construction. Previously it diverged under STRICT (FIFO fallback instead of AmbiguousMatch), NONE (error instead of short), and {*} merge (wrong dispatch) (#1690). No WIT change (rustledger:ledger stays 3.2.0); embedders are unaffected. Also carries the formal-verification hardening arc (#1683-#1697): behavior replay across 11 corpora, dual-direction trace validation, exact-rational AVERAGE model, coverage lint, weekly escalated replay, pad-directive spec, and Kani proofs for the new NONE semantics. Workspace 0.19.0 -> 0.19.1; packages/mcp-server bumped to match. Co-authored-by: Claude Opus 4.8 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final FV backlog item — the Kani expansion spike. Two deliverables:
Two new proofs, both
VERIFICATION: SUCCESSFULlocallyproof_none_shorting_split_exact— the NONE over-reduction split (consume available, short the remainder) is exact for all amounts in range; no units created or lost at the zero crossing.proof_none_conservation_across_zero—balance + totalReduced = totalAddedsurvives reductions crossing zero (the NONE booking: reduce refuses to short from a positive balance but allows it from zero #1686 class, where the identity held on one code path and not the other).These complement the 396-behavior NONECorrect replay (model-reachable states) with all-values-in-range arithmetic coverage.
The spike answer: real-
Inventoryproofs are not tractable todayA stutter harness driving the actual
Inventory::reduce(single position, two symbolic i64s,unwind(3)) did not verify within a 40-minute solo CBMC budget. The solver log names the blockers concretely: (1) the currency interner —size_of_val_raw::<ArcInner<str>>path explosion from global interning; (2)imbl::Vector's RRB-tree allocation machinery. Finding + rationale documented in the module so it isn't re-derived: until Kani can stub the interner and bound imbl's fast path, implementation-level verification belongs to the behavior-replay + proptest layers, and Kani proofs stay at the Decimal-arithmetic level (seconds per harness).(Side note from the spike: local kani needs rustup + the MSRV relax — kani.yml already encodes both; CI was and is fine.)
This PR triggers kani.yml (proofs-file change), so the full suite incl. the two new harnesses verifies in CI.
🤖 Generated with Claude Code