Repository navigation
test: add model-level CLOB invariant and differential test harness - #1082
Merged
abayomicornelius merged 2 commits intoOct 18, 2026
Merged
abayomicornelius merged 2 commits into
abayomicornelius merged 2 commits into
Conversation
|
@harystyleseze Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
3 tasks
toluwalasedaniel459-cmyk
added a commit
to toluwalasedaniel459-cmyk/contracts
that referenced
this pull request
Oct 19, 2026
Pre-existing test code that never compiled or that current stable clippy (what CI installs) rejects; no production behaviour changes: - order_handler tests from SO4-Markets#1086 (rollback_atomicity, settlement_invariants): add the missing settlement_invariants/rollback_harness dev-dependencies, drop an extra `initialize` argument, fix a u32/u64 comparison and a use-after-move, remove unused imports, rustfmt - tests/clob_model.rs (SO4-Markets#1082): type alias for a complex return type, needless borrows, `div_ceil` - oracle: turn an assertion on a constant into a compile-time check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
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.
Summary
Adds a self-contained, model-level test harness for the Phase 8 CLOB test issues. The repository does not contain a CLOB contract yet (no order book, matching, or settlement code exists in the workspace), so nothing here is wired to a real contract. The tests run against two small in-memory engines defined in the test file itself:
Reference: a deliberately simple engine (flat list, linear scans, price-time priority).Book: a storage-shaped engine (sorted price levels, FIFO queues, cached level totals, bounded-work matching with a continuation).The differential tests are therefore model-versus-model, not contract-versus-reference. The
BookViewtrait is the seam where a real contract adapter can be plugged in later. This PR refers to the issues but does not claim to close them: the real-contract parts of each issue remain open. #1044 (the standalone reference engine issue) is not closed or claimed by this PR.Changes
tests/clob_model.rs(new), registered intests/Cargo.toml:notional = price * qty, taker fee rounds up, maker fee rounds down, price-improvement refund,MAX_PRICE,MAX_QTY, fee rate cap, sequence and level-quantity limits.assert_not_crossedhelper that prints best bid/ask and implicated orders, checked after placement, matching, cancellation, and resource-bound (bounded fill budget) matching over random action sequences; post-only equal-price behavior. Expiry cleanup and batch operations are not modelled.Issues
Resolves #1041
Resolves #1045
Resolves #1046
Resolves #1047