Repository navigation
docs(clob): Phase 0 protocol spec, legacy archive point, and CI restore (#877-#879, #530) - #1097
Merged
IbrahimIjai merged 4 commits intoOct 20, 2026
Conversation
Pin the pre-reset main commit (5436392) as the archive point for the GMX-style implementation and link the archive branch from the docs. Refs SO4-Markets#877
Add docs/protocol.md covering the spot CLOB trading model: markets and parameters, units and price, rounding rules, order locking and time in force, price-time matching, maker/taker execution price, equal-price and zero-remainder handling, fill settlement legs, and cancellation/expiry. Declares v1 non-goals such as leverage, perpetuals, liquidations, and synthetic positions. Refs SO4-Markets#878
Extend docs/protocol.md with the invariant set (asset conservation, solvency, lock consistency, no crossed book, price-time priority, sequence uniqueness, bounded work, residue bounds, expiry, self-trade), each mapped to a planned test category. Define the per-transaction work budget and the bounded-stop behavior, which releases the taker remainder instead of resting it so the book is never crossed. Add worked examples for partial consumption, rounding residue, split fills, and self-trade stops, plus the open decisions for review. Refs SO4-Markets#879
Restore .github/workflows/ci.yml from the pre-reset main commit (5436392). The reset removed it, so main had no CI. The restored workflow runs on pull_request and push to main, compiles test code with clippy --all-targets, runs cargo test, and builds the deployable WASM. This workflow calls make targets (test-wasm, build-wasm, test) and a Cargo workspace. Neither exists on main after the reset, so the workflow cannot pass until the workspace is restored. Branch protection and the failure-proof runs described in the issue are repository-side steps that are not part of this commit. Refs SO4-Markets#530
|
@iyanujohn612 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! 🚀 |
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
Phase 0 documentation and CI work for the SO4 CLOB rewrite, on top of the current
origin/main(4a215a4).docs/protocol.md. It defines v1 trading semantics: markets and parameters, units, price and rounding, order locking, time in force, price-time matching, maker-price execution, equal-price and zero-remainder handling, fill settlement, and cancellation and expiry. It declares v1 non-goals (leverage, perpetuals, liquidations, synthetic positions, market orders, fees). It also defines invariants I1 to I12, each mapped to a planned test category; the bounded-matching work budget with a bounded-stop rule that never rests a crossing remainder; worked examples; and open decisions for review.gmx-synthetic-order-book-dex#877: legacy archive point. Addsdocs/legacy-archive.md, which pins the pre-resetmaincommit5436392dcfdfdeb3a8f4d7724a73031d6aeee8c3as the archive point forgmx-synthetic-order-book-dex.main#530: CI. Restores.github/workflows/ci.ymlfrom the pre-reset commit. The workflow runs onpull_requestandpushtomain, compiles test code withclippy --all-targets, runscargo test, and builds the deployable WASM.Rounding rule
Every fill uses one quote amount for both legs, so no value is created or destroyed. Bid locks are
Up(remaining notional), and each fill's buyer debit is the difference of consecutive locks. The seller is creditedDown(fill notional). The residue (under one quote atom per fill) goes to the protocol dust account. The non-negativity of the residue is proven in section 7.2 of the spec.Reviewer notes
280f268) removed the Cargo workspace,Makefile,mx/, and the other workflows thatci.ymldepends on. The commit is separate (ci: restore hardened core CI workflow) so it can be dropped. Once merged, it would turn everymainrun red until the workspace is restored.gmx-synthetic-order-book-dexmust exist upstream before [CLOB-001] Archive the current GMX-style implementation ongmx-synthetic-order-book-dex#877 can close. This PR does not create it; the snapshot SHA is documented indocs/legacy-archive.md.main#530). Making lint, test, and wasm-size checks required is a repository setting and is not part of this PR.main#530). The issue asks for CI runs that fail on an over-long contract name and on a broken test call site. These need a working workspace and cannot be shown in this PR.main.docs/protocol.mdis self-contained and uses the same price formula,quote = base_atoms * tick * tick_size / 10^8.Closes #590
Closes #1027
Closes #1026
Closes #1028