feat(clearinghouse): modular perps as CLOB consumer#133
Open
JaeLeex wants to merge 8 commits into
Open
Conversation
Add the standalone CLOB primitive ahead of perps wiring so spot and derivatives can share deterministic market, order, matching, and fill state without embedding book logic in consumers. Co-authored-by: Cursor <cursoragent@cursor.com>
Canonicalize asset pairs in market_id, expose programmatic place_order, prune terminal account_orders entries, and document the no-STP policy. Co-authored-by: Cursor <cursoragent@cursor.com>
Add nunchi-memclob for validator-local order gossip, ClobOperation::CommitFill for on-chain fill settlement, and a SettlementBridge that drains memclob fills into the mempool for proposer inclusion on coins-chain. Co-authored-by: Cursor <cursoragent@cursor.com>
Introduce nunchi-clearinghouse to route matched CLOB fills into perpetuals, refactor perps to settle positions via apply_fill_settlement, and wire both modules into coins-chain with an end-to-end integration test. Co-authored-by: Cursor <cursoragent@cursor.com>
Restore main CI workflow, box large memclob/clearinghouse message variants, allow perps clippy exceptions, and submit mempool replacement before consensus. Co-authored-by: Cursor <cursoragent@cursor.com>
Reconcile with main's CLOB actor/extension, bridge module, coins-chain path move, and mempool API while keeping clearinghouse + perpetuals wiring. All 298 workspace tests pass locally after updating integration tests for off-chain CLOB semantics and CommitAndSettleFill settlement flow. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Add perpetuals genesis roundtrip/apply tests and a clearinghouse settlement batch builder test. Extend coins-chain test network with CLOB actor sync helpers for future live mailbox integration. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 16, 2026
Add RPC and transaction codec roundtrip tests plus memclob rejection coverage. Gate mock-execution-only close_position tests so perpetuals compiles standalone. Co-authored-by: Cursor <cursoragent@cursor.com>
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
nunchi-clearinghouse— routes matched CLOB fills to perpetuals viaRegisterPerpsMarket+SettleFill/CommitAndSettleFillnunchi-perpetualsto open/close positions throughapply_fill_settlement(CLOB fill path); gates directOpenPosition/ClosePositionbehindmock-executionexamples/coins-chain(TX_CLOB=4,TX_CLEARINGHOUSE=5) with cross-validator integration testSupersedes #79 and #80 with the modular architecture from the Jul 10 standup:
Test plan
cargo test -p nunchi-clearinghousecargo test -p nunchi-perpetuals --features mock-executioncargo test -p nunchi-coins-chain --test coins perps_clob_clearinghouseMade with Cursor