Skip to content

docs(clob): Phase 0 protocol spec, legacy archive point, and CI restore (#877-#879, #530) - #1097

Merged
IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
iyanujohn612:feat/clob-foundations-protocol-and-ci
Oct 20, 2026
Merged

IbrahimIjai merged 4 commits into
SO4-Markets:mainfrom
iyanujohn612:feat/clob-foundations-protocol-and-ci

Conversation

@iyanujohn612

@iyanujohn612 iyanujohn612 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 0 documentation and CI work for the SO4 CLOB rewrite, on top of the current origin/main (4a215a4).

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 credited Down(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

Closes #590
Closes #1027
Closes #1026
Closes #1028

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
@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants