ordstate 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. ordstate-1.0.0/Cargo.toml +31 -0
  2. ordstate-1.0.0/PKG-INFO +70 -0
  3. ordstate-1.0.0/README.md +46 -0
  4. ordstate-1.0.0/ordstate-core/Cargo.toml +30 -0
  5. ordstate-1.0.0/ordstate-core/README.md +481 -0
  6. ordstate-1.0.0/ordstate-core/benches/apply_bench.rs +563 -0
  7. ordstate-1.0.0/ordstate-core/src/client/inputs.rs +461 -0
  8. ordstate-1.0.0/ordstate-core/src/client/mod.rs +10 -0
  9. ordstate-1.0.0/ordstate-core/src/client/outputs.rs +364 -0
  10. ordstate-1.0.0/ordstate-core/src/client/reconcile.rs +101 -0
  11. ordstate-1.0.0/ordstate-core/src/client/registry.rs +4113 -0
  12. ordstate-1.0.0/ordstate-core/src/error/mod.rs +287 -0
  13. ordstate-1.0.0/ordstate-core/src/lib.rs +29 -0
  14. ordstate-1.0.0/ordstate-core/src/prelude.rs +28 -0
  15. ordstate-1.0.0/ordstate-core/src/replay/codec.rs +2081 -0
  16. ordstate-1.0.0/ordstate-core/src/replay/mod.rs +7 -0
  17. ordstate-1.0.0/ordstate-core/src/replay/sha256.rs +225 -0
  18. ordstate-1.0.0/ordstate-core/src/state/invariants.rs +521 -0
  19. ordstate-1.0.0/ordstate-core/src/state/ledger.rs +1244 -0
  20. ordstate-1.0.0/ordstate-core/src/state/mod.rs +5 -0
  21. ordstate-1.0.0/ordstate-core/src/state/order.rs +593 -0
  22. ordstate-1.0.0/ordstate-core/src/storage/alias_index.rs +493 -0
  23. ordstate-1.0.0/ordstate-core/src/storage/mod.rs +6 -0
  24. ordstate-1.0.0/ordstate-core/src/storage/slab.rs +281 -0
  25. ordstate-1.0.0/ordstate-core/src/storage/table.rs +364 -0
  26. ordstate-1.0.0/ordstate-core/src/types/config.rs +99 -0
  27. ordstate-1.0.0/ordstate-core/src/types/enums.rs +886 -0
  28. ordstate-1.0.0/ordstate-core/src/types/fixed.rs +722 -0
  29. ordstate-1.0.0/ordstate-core/src/types/ids.rs +453 -0
  30. ordstate-1.0.0/ordstate-core/src/types/mod.rs +10 -0
  31. ordstate-1.0.0/ordstate-core/src/types/modifiers.rs +253 -0
  32. ordstate-1.0.0/ordstate-core/src/types/outcomes.rs +131 -0
  33. ordstate-1.0.0/ordstate-core/src/types/output_buf.rs +131 -0
  34. ordstate-1.0.0/ordstate-core/src/types/time.rs +68 -0
  35. ordstate-1.0.0/ordstate-core/src/venue/inputs.rs +332 -0
  36. ordstate-1.0.0/ordstate-core/src/venue/mod.rs +9 -0
  37. ordstate-1.0.0/ordstate-core/src/venue/outputs.rs +205 -0
  38. ordstate-1.0.0/ordstate-core/src/venue/registry.rs +2704 -0
  39. ordstate-1.0.0/ordstate-core/tests/broker_trace_sim.rs +1401 -0
  40. ordstate-1.0.0/ordstate-core/tests/client_integration.rs +1283 -0
  41. ordstate-1.0.0/ordstate-core/tests/combo_walkthrough.rs +229 -0
  42. ordstate-1.0.0/ordstate-core/tests/common/ref_client.rs +516 -0
  43. ordstate-1.0.0/ordstate-core/tests/common/ref_venue.rs +401 -0
  44. ordstate-1.0.0/ordstate-core/tests/exhaustive_bfs.rs +624 -0
  45. ordstate-1.0.0/ordstate-core/tests/fix44_fixtures_sanity.rs +39 -0
  46. ordstate-1.0.0/ordstate-core/tests/fixtures/fix44_appendix_d.rs +398 -0
  47. ordstate-1.0.0/ordstate-core/tests/loopback.rs +661 -0
  48. ordstate-1.0.0/ordstate-core/tests/reference_models.rs +1302 -0
  49. ordstate-1.0.0/ordstate-core/tests/replay.rs +227 -0
  50. ordstate-1.0.0/ordstate-core/tests/trace_replay.rs +313 -0
  51. ordstate-1.0.0/ordstate-core/tests/transition_tables.rs +2152 -0
  52. ordstate-1.0.0/ordstate-core/tests/v02_order_types.rs +2247 -0
  53. ordstate-1.0.0/ordstate-core/tests/venue_integration.rs +816 -0
  54. ordstate-1.0.0/ordstate-py/Cargo.lock +219 -0
  55. ordstate-1.0.0/ordstate-py/Cargo.toml +18 -0
  56. ordstate-1.0.0/ordstate-py/README.md +46 -0
  57. ordstate-1.0.0/ordstate-py/src/lib.rs +1751 -0
  58. ordstate-1.0.0/ordstate-py/tests/test_ordstate.py +183 -0
  59. ordstate-1.0.0/pyproject.toml +36 -0
  60. ordstate-1.0.0/python/ordstate/__init__.py +21 -0
  61. ordstate-1.0.0/python/ordstate/_ordstate.pyi +270 -0
  62. ordstate-1.0.0/python/ordstate/py.typed +0 -0
@@ -0,0 +1,31 @@
1
+ [workspace]
2
+ resolver = "3"
3
+ members = [
4
+ "ordstate-core",
5
+ "ordstate-ffi",
6
+ "examples",
7
+ ]
8
+ exclude = [
9
+ "fuzz",
10
+ "ordstate-py",
11
+ ]
12
+
13
+ [workspace.package]
14
+ version = "1.0.0"
15
+ edition = "2024"
16
+ rust-version = "1.90"
17
+ license = "MIT"
18
+ authors = ["Joaquin Bejar"]
19
+ repository = "https://github.com/joaquinbejar/ordstate"
20
+ keywords = ["trading", "fix", "order", "state-machine", "ffi"]
21
+ categories = ["finance", "data-structures"]
22
+
23
+ [workspace.dependencies]
24
+ thiserror = "2"
25
+ proptest = "1"
26
+ criterion = { version = "0.5", default-features = false }
27
+
28
+ [profile.release]
29
+ panic = "unwind"
30
+ lto = "thin"
31
+ codegen-units = 1
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.4
2
+ Name: ordstate
3
+ Version: 1.0.0
4
+ Classifier: Development Status :: 5 - Production/Stable
5
+ Classifier: Intended Audience :: Financial and Insurance Industry
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python :: Implementation :: CPython
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Office/Business :: Financial :: Investment
16
+ Summary: Deterministic, fixed-point order state machine for Python (backed by ordstate-core)
17
+ Keywords: trading,fix,order,state-machine,oms,finance
18
+ Author: Joaquin Bejar
19
+ License: MIT
20
+ Requires-Python: >=3.9
21
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
22
+ Project-URL: Repository, https://github.com/joaquinbejar/ordstate
23
+
24
+ # `ordstate` (Python)
25
+
26
+ Python bindings for [`ordstate-core`](https://crates.io/crates/ordstate-core) built with PyO3 and `maturin` (`abi3`, Python 3.9+).
27
+
28
+ ## Features
29
+
30
+ - **Exact fixed-point math**: `Price` and `Qty` never convert through IEEE-754 floats.
31
+ - **Venue & Client perspectives**: `VenueRegistry` (authoritative) and `ClientRegistry` (convergent).
32
+ - **Deterministic replay**: every non-error transition caches its canonical binary replay record (`last_record()`), replayable via `replay_record()`.
33
+ - **Full typing**: PEP 561 `py.typed` marker and `_ordstate.pyi` stubs.
34
+
35
+ ## Local Build & Test
36
+
37
+ ```bash
38
+ cd ordstate-py
39
+ uv run --with maturin --with pytest maturin develop --release
40
+ uv run --with pytest pytest -v
41
+ ```
42
+
43
+ ## Quickstart
44
+
45
+ ```python
46
+ from ordstate import Price, Qty, RegistryConfig, VenueRegistry
47
+
48
+ reg = VenueRegistry(RegistryConfig(max_orders=64))
49
+ res = reg.client_new_order(
50
+ cl_ord_id="ORD-1",
51
+ report_exec_id="R-0",
52
+ instrument_id="AAPL",
53
+ side="buy",
54
+ ord_type="limit",
55
+ tif="gtc",
56
+ qty=Qty.from_str("100"),
57
+ limit_px=Price.from_str("101.25"),
58
+ ts=1_000,
59
+ )
60
+ key = res["outputs"][0]["order_key"]
61
+ reg.engine_accept_new(key, "E-1", "V-1", ts=2_000)
62
+ reg.engine_fill(key, "F-1", Qty.from_str("40"), Price.from_str("101.20"), ts=3_000)
63
+
64
+ view = reg.get_order(key)
65
+ assert view.ord_status == "partially_filled"
66
+ assert view.cum_executed == Qty.from_str("40")
67
+ assert view.leaves_qty == Qty.from_str("60")
68
+ assert view.avg_px == Price.from_str("101.20")
69
+ ```
70
+
@@ -0,0 +1,46 @@
1
+ # `ordstate` (Python)
2
+
3
+ Python bindings for [`ordstate-core`](https://crates.io/crates/ordstate-core) built with PyO3 and `maturin` (`abi3`, Python 3.9+).
4
+
5
+ ## Features
6
+
7
+ - **Exact fixed-point math**: `Price` and `Qty` never convert through IEEE-754 floats.
8
+ - **Venue & Client perspectives**: `VenueRegistry` (authoritative) and `ClientRegistry` (convergent).
9
+ - **Deterministic replay**: every non-error transition caches its canonical binary replay record (`last_record()`), replayable via `replay_record()`.
10
+ - **Full typing**: PEP 561 `py.typed` marker and `_ordstate.pyi` stubs.
11
+
12
+ ## Local Build & Test
13
+
14
+ ```bash
15
+ cd ordstate-py
16
+ uv run --with maturin --with pytest maturin develop --release
17
+ uv run --with pytest pytest -v
18
+ ```
19
+
20
+ ## Quickstart
21
+
22
+ ```python
23
+ from ordstate import Price, Qty, RegistryConfig, VenueRegistry
24
+
25
+ reg = VenueRegistry(RegistryConfig(max_orders=64))
26
+ res = reg.client_new_order(
27
+ cl_ord_id="ORD-1",
28
+ report_exec_id="R-0",
29
+ instrument_id="AAPL",
30
+ side="buy",
31
+ ord_type="limit",
32
+ tif="gtc",
33
+ qty=Qty.from_str("100"),
34
+ limit_px=Price.from_str("101.25"),
35
+ ts=1_000,
36
+ )
37
+ key = res["outputs"][0]["order_key"]
38
+ reg.engine_accept_new(key, "E-1", "V-1", ts=2_000)
39
+ reg.engine_fill(key, "F-1", Qty.from_str("40"), Price.from_str("101.20"), ts=3_000)
40
+
41
+ view = reg.get_order(key)
42
+ assert view.ord_status == "partially_filled"
43
+ assert view.cum_executed == Qty.from_str("40")
44
+ assert view.leaves_qty == Qty.from_str("60")
45
+ assert view.avg_px == Price.from_str("101.20")
46
+ ```
@@ -0,0 +1,30 @@
1
+ [package]
2
+ name = "ordstate-core"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ rust-version.workspace = true
6
+ license.workspace = true
7
+ authors.workspace = true
8
+ repository.workspace = true
9
+ readme = "README.md"
10
+ documentation = "https://docs.rs/ordstate-core"
11
+ keywords.workspace = true
12
+ categories.workspace = true
13
+ description = "Pure Rust deterministic order state machine core"
14
+
15
+ [features]
16
+ default = ["venue", "client"]
17
+ venue = []
18
+ client = []
19
+ strict-invariants = []
20
+
21
+ [dependencies]
22
+ thiserror.workspace = true
23
+
24
+ [dev-dependencies]
25
+ proptest.workspace = true
26
+ criterion.workspace = true
27
+
28
+ [[bench]]
29
+ name = "apply_bench"
30
+ harness = false
@@ -0,0 +1,481 @@
1
+ [![License](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)
2
+ [![Crates.io](https://img.shields.io/crates/v/ordstate-core.svg)](https://crates.io/crates/ordstate-core)
3
+ [![Downloads](https://img.shields.io/crates/d/ordstate-core.svg)](https://crates.io/crates/ordstate-core)
4
+ [![Stars](https://img.shields.io/github/stars/joaquinbejar/ordstate.svg)](https://github.com/joaquinbejar/ordstate/stargazers)
5
+ [![Issues](https://img.shields.io/github/issues/joaquinbejar/ordstate.svg)](https://github.com/joaquinbejar/ordstate/issues)
6
+ [![PRs](https://img.shields.io/github/issues-pr/joaquinbejar/ordstate.svg)](https://github.com/joaquinbejar/ordstate/pulls)
7
+
8
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/joaquinbejar/ordstate/ci.yml)](https://github.com/joaquinbejar/ordstate/actions)
9
+ [![Documentation](https://img.shields.io/docsrs/ordstate-core)](https://docs.rs/ordstate-core)
10
+
11
+ # ordstate
12
+
13
+ A deterministic, zero-allocation, embeddable order state machine written in Rust with first-class C11, C++20, Go (`cgo`), and Java 22 (Panama FFM) bindings. `ordstate` models both the **authoritative venue** perspective and the **convergent client** perspective under FIX 4.4 lifecycle semantics without performing I/O, reading wall clocks, or allocating on the hot path.
14
+
15
+ ## Key Features
16
+
17
+ - **Dual-Perspective Order State Machines**:
18
+ - **`VenueRegistry`** (authoritative): 18 typed inputs covering two-phase new-order staging, fills, trade busts and corrections, pending cancel/replace chains with deferred tri-state `FieldUpdate` resolution, trailing-stop restatements (`EngineRestate`), cancel/replace rejections, expirations, stops, and quiesced snapshot export/import.
19
+ - **`ClientRegistry`** (convergent): 20 typed inputs handling local submission, out-of-order execution reports, cancel/replace races, unsolicited restatements (including trigger visibility), broker snapshots, observation-boundary watermarks, freshness barriers, and explicit reconciliation triggers.
20
+ - **Orthogonal Product State**: Models acknowledgement (`AckState`), non-fill closure (`ClosureState`), pending cancel/replace slots, cumulative execution ledgers, and retired `ClOrdId` / `VenueOrderId` alias chains as independent axes—eliminating ad-hoc boolean flags and invalid state combinations.
21
+ - **Zero-Allocation Hot Path**: All slabs, open-addressing hash tables, alias indices, execution ledgers, and seen-report caches are pre-allocated once at registry creation (`try_new`). Every `apply(...)` call executes with **0 heap allocations** (verified across all 38 inputs by an automated allocation-counting test suite).
22
+ - **Exact Fixed-Point Financial Arithmetic**: Pure integer fixed-point quantities (`Qty`, `NonZeroQty`, `i64` with explicit scale `0..=12`), prices (`Price`), and `i128` accumulated notional (`RawNotional`) with checked arithmetic—zero floating-point rounding and zero silent saturation.
23
+ - **Pure & Deterministic Core**: `ordstate-core` enforces `#![forbid(unsafe_code)]` and `#![deny(missing_docs)]`, performs no I/O, holds no global mutable state, reads no wall clocks, and ships a canonical input-log replay codec (`REPLAY_SCHEMA_VERSION = 3`) with a deterministic SHA-256 `config_digest`.
24
+ - **Polyglot Native ABI (`v0.2`)**: `ordstate-ffi` exports 65 `extern "C"` symbols with an auto-generated C11 header (`ordstate.h`), a zero-overhead C++20 RAII wrapper (`ordstate.hpp`), Go `cgo` integration, and Java 22 Panama Foreign Function & Memory (FFM) support.
25
+ - **Machine-Checked Specifications**: Exhaustive transition tables (`docs/transitions.md`, 701 generated transitions), C11 `_Static_assert` layout canaries across all 60 concrete ABI structs (plus 2 opaque handles), Miri verification, AddressSanitizer/UBSan test suites, and 5 `cargo-fuzz` targets.
26
+
27
+ ## Design Goals
28
+
29
+ 1. **Deterministic & Reproducible**: Identical input streams and `RegistryConfig` values always produce byte-for-byte identical state transitions, outputs, and replay records across platforms and languages.
30
+ 2. **Zero Allocation & Bounded Memory**: Fixed upper bounds on orders, aliases, ledger entries, and seen-report fingerprints are validated upfront so latency stays predictable under burst load and adversarial churn.
31
+ 3. **Explicit Uncertainty Over Silent Corruption**: When a client observes stale snapshots, numeric overflows, ambiguous trade corrections, or out-of-order reports without provable observation boundaries, `ordstate` surfaces explicit `Outcome::Uncertain` / `RequestReconcile` signals rather than guessing.
32
+ 4. **Protocol-Faithful FIX 4.4 Semantics**: Implements FIX 4.4 Appendix D race-condition matrices (including pending-cancel/replace vs. fill races, `OrigClOrdID` alias chaining, and `ExecId` deduplication) with every intentional deviation documented in [docs/fix-deviations.md](docs/fix-deviations.md).
33
+ 5. **Minimal Dependency Footprint**: `ordstate-core` depends only on `thiserror` at runtime (no `serde`, no `tokio`, no `tracing`, no `rust_decimal`), keeping compile times fast and the trusted computing base tiny.
34
+
35
+ ## Use Cases
36
+
37
+ - **Matching Engines & Exchange Gateways**: Embed `VenueRegistry` directly inside a matching engine or sequencer to own authoritative order state, validate cancel/replace chains, and emit canonical `ExecutionReport` / `OrderCancelReject` outputs.
38
+ - **Order Management Systems (OMS) & Execution Gateways**: Embed `ClientRegistry` to track broker-acknowledged state, reconcile out-of-order WebSocket/FIX feeds, and detect divergence via observation-boundary watermarks.
39
+ - **Multi-Language Trading Infrastructure**: Share one verified Rust state machine across Rust, C11, C++20, Go, and Java 22 services via a single static/shared library and flat C ABI.
40
+ - **Deterministic Simulation & Replay**: Record canonical binary input logs and replay historical sessions offline to reproduce incidents or verify strategy behavior identically.
41
+
42
+ ### Scope & Non-Goals (v1)
43
+
44
+ `ordstate` is deliberately focused on deterministic order lifecycle state and accounting. It does **not** include:
45
+
46
+ - Matching engines, price-level L2/L3 order books, or market data ingestion.
47
+ - Pre-trade risk engines, buying-power checks, or instrument tick/lot registries (handled by the host at the two-phase venue admission seam).
48
+ - Order routing, FIX session/network framing, broker adapters, persistence/WAL storage, position keeping, P&L, or fees.
49
+ - Contingent order orchestration (OCO, OTO, brackets — layered above `ordstate-core`) or native per-leg multi-leg transitions.
50
+ - Async runtimes, threads, internal locks, wall clocks, or global mutable state.
51
+
52
+ ## Supported Orders
53
+
54
+ An order in v0.2 combines **7 order types × 7 times in force** with orthogonal execution modifiers (`POST_ONLY`, `ALL_OR_NONE`, iceberg `display_qty`, `min_qty`) and trailing/pegged `PriceSpec` terms, on either side (`Buy` / `Sell`), for either a single instrument or a package combo (vertical spreads, iron condors, combo bags modeled as one order with signed or zero net price).
55
+
56
+ ![Supported Orders in ordstate](docs/images/order-types-and-states-1.png)
57
+
58
+ ### Order Types (`OrdType`)
59
+
60
+ | Order Type | `limit_px` | `stop_px` | `price_spec` | Behavior |
61
+ |------------|------------|-----------|--------------|----------|
62
+ | `Market` | Must be absent | Must be absent | `None` | Executes at market without a limit price. |
63
+ | `Limit` | Required | Must be absent | `None` | Rests or executes at `limit_px` or better. |
64
+ | `Stop` | Must be absent | Required | `None` | Fills are refused until the venue engine triggers the stop (`EngineTriggerStop`). |
65
+ | `StopLimit` | Required | Required | `None` | Same trigger guard; `stop_px` cannot be replaced after the stop has triggered. |
66
+ | `TrailingStop` | Must be absent | Engine-owned | `Trail` (no `limit_offset`) | Engine updates `stop_px` via `EngineRestate` (monotonic `restate_rev`) and locks it at `EngineTriggerStop`. |
67
+ | `TrailingStopLimit` | Absent until trigger | Engine-owned | `Trail` (with `limit_offset`) | Engine supplies `activated_limit_px` at `EngineTriggerStop`, emitting `Restated(TriggerActivated)` for client convergence. |
68
+ | `Pegged` | Optional (cap/floor) | Must be absent | `Peg` (`Primary`/`Market`/`Midpoint`/`Last` + optional offset) | Effective peg price is computed by the matching engine; `limit_px` acts as an optional price cap/floor. |
69
+
70
+ ### Time in Force (`TimeInForce`)
71
+
72
+ | Time in Force | `expire_at` | Who Ends the Order |
73
+ |---------------|-------------|--------------------|
74
+ | `Day` | Required (caller-supplied) | Timer (`VenueTimer`), then the venue engine confirms expiry (`EngineExpire`). |
75
+ | `Gtc` | Optional | Cancel or fill. |
76
+ | `Gtd` | Required | Timer (`VenueTimer`), then the venue engine confirms expiry (`EngineExpire`). |
77
+ | `Ioc` | Optional | The matching engine: must cancel any unfilled remainder immediately. |
78
+ | `Fok` | Optional | All-or-nothing: the library refuses to cancel or expire a partially filled `Fok` order. |
79
+ | `AtTheOpen` (`OPG`) | Optional (effective expiry only) | Opening auction cross / venue expiry. |
80
+ | `AtTheClose` (`CLO`) | Optional (effective expiry only) | Closing auction cross / venue expiry. |
81
+
82
+ ### Execution Modifiers
83
+
84
+ - `ExecInstFlags::POST_ONLY` (bit 0): Permitted on `Limit` and `Pegged` with `Day`/`Gtc`/`Gtd`; validated and echoed for matching-engine enforcement.
85
+ - `ExecInstFlags::ALL_OR_NONE` (bit 1): Incompatible with `Ioc`, `Fok`, and `display_qty`; enforces the same partial-closure guard as `Fok` on `VenueRegistry` (while allowing multi-print atomic fills) and emits `AllOrNonePartialClosure` on `ClientRegistry`.
86
+ - `display_qty` (`MaxFloor`, `<= order_qty`) and `min_qty` (`MinQty`, `<= order_qty`): Validated, stored, replaceable via tri-state `FieldUpdate::{Keep, Set, Clear}`, and echoed on event terms.
87
+
88
+ Also fixed in v1: order quantity is strictly positive (`NonZeroQty`), and at most **one** cancel request and **one** replace request may be in flight per order at a time.
89
+
90
+ ## Domain Model & Fixed-Point Arithmetic
91
+
92
+ ### Identifiers
93
+
94
+ | Type | Representation | Semantics & Scope |
95
+ |------|----------------|-------------------|
96
+ | `OrderKey` | `u64` packed (`slot_index: u32` + `generation: u32`, `0` invalid) | Stable internal handle for one logical order. Slot retires permanently if `generation == u32::MAX` on purge. |
97
+ | `ExtId` | Inline `[u8; 64]` + `len: u8` (`len <= 64`) | Opaque fixed-capacity external identifier; never truncated. |
98
+ | `ClOrdId` | Newtype over `ExtId` | Client order/request ID (FIX tag 11 / 41), unique within one registry's namespace. |
99
+ | `VenueOrderId` | Newtype over `ExtId` | Venue-assigned order ID (FIX tag 37), lineage-tracked across non-atomic swaps. |
100
+ | `ExecId` | Newtype over `ExtId` | Execution/report ID (FIX tag 17 / 19), compared by exact byte equality (never hash-only). |
101
+ | `InstrumentId` | Newtype over `ExtId` | Opaque instrument or package combo identifier stored per order. |
102
+ | `ObsBoundary` | `{ epoch: u64, seq: NonZeroU64 }` | Causal observation watermark; comparable iff `a.epoch == b.epoch`. |
103
+ | `Timestamp` | `u64` (UTC nanoseconds) | Caller-supplied timestamp; `ordstate` never reads a clock or orders inputs by timestamp. |
104
+ | `UserData` | `u64` | Opaque caller metadata per order (`0` default). |
105
+
106
+ ### Exact Fixed-Point Scales
107
+
108
+ All prices and quantities use signed 64-bit integer mantissas (`i64`) with explicit base-10 scale `0..=12` (`MAX_SCALE = 12`), and accumulated notional uses `i128` (`RawNotional`, scale up to `24`):
109
+
110
+ 1. **Command term scales (`term_price_scale`, `term_qty_scale`)**: Supplied at order admission and immutable for the order's lifetime; local commands always validate against them.
111
+ 2. **Accepted broker term scales (`accepted_price_scale`, `accepted_qty_scale`)**: Equal to `term_*_scale` on `VenueRegistry`; on `ClientRegistry`, ordered broker facts (`OnRestated`, `OnReplaced`, `OnOrderSnapshot`) may widen them losslessly using all-or-nothing checked arithmetic.
112
+ 3. **Accounting scales (`acct_price_scale`, `acct_qty_scale`)**: Govern `cum_executed`, `cum_accounted`, `cum_adjustments`, `cum_reported`, `reported_leaves`, ledger entries, and `notional`.
113
+ 4. **Average price (`avg_px()`)**: Computed on demand from `notional / cum_executed` using integer symmetric half-even rounding (never stored pre-rounded). Any checked arithmetic overflow on the client preserves prior terms and surfaces `needs_reconciliation = true` + `Anomaly::NumericOverflow`.
114
+
115
+ ## State Model & `OrdStatus` Projection
116
+
117
+ `ordstate` does **not** store a single mutable status enum. Instead, every order stores an **orthogonal product state** and derives the FIX 4.4 `OrdStatus` (tag 39) via a total, deterministic projection:
118
+
119
+ | Component | Stored Fields | Meaning |
120
+ |-----------|---------------|---------|
121
+ | `ack` | `AckState { Unacknowledged, Acknowledged }` | Whether the venue has acknowledged the order. |
122
+ | `closure` | `ClosureState { Open, Rejected, Canceled, Expired }`, `closure_source` | Non-fill closure state and provenance (`VenueFact` vs. `LocalInference`). |
123
+ | `terms` | `instrument_id`, `side`, `ord_type`, `tif`, scales, `order_qty`, `limit_px`, `stop_px`, `expire_at`, `deadline_rev`, `is_triggered` | Active order parameters and timer revision. |
124
+ | `accounting` | `cum_executed`, `cum_adjustments`, `cum_accounted`, `notional`, `cum_reported`, `reported_leaves`, `reported_avg_px` | Exact execution sum, downstream-accounted total, and causally ordered venue-reported view. |
125
+ | `pending_cancel` | `Option<PendingCancel { req_cl_ord_id }>` | At most one in-flight cancel request. |
126
+ | `pending_replace` | `Option<PendingReplace { req_cl_ord_id, new_* }>` | At most one in-flight replace request. |
127
+ | `watermarks` | `needs_reconciliation`, `history_incomplete`, `unbounded_anchor`, `cutover`, independent execution/lifecycle/terms/snapshot watermarks | Reconciliation flags, freshness latch, and causal ordering watermarks. |
128
+ | `aliases` | `active_cl_ord_id`, `active_venue_order_id`, bounded retired alias chain, `user_data` | Scoped identity lineage across cancel/replace chains. |
129
+
130
+ ### Total 9-Value `OrdStatus` Projection (First Match Wins)
131
+
132
+ | Precedence | Product-State Condition | `OrdStatus` (FIX Tag 39) |
133
+ |------------|-------------------------|--------------------------|
134
+ | 1 | `closure == Rejected` | `Rejected` (`'8'`) |
135
+ | 2 | `closure == Canceled` | `Canceled` (`'4'`) |
136
+ | 3 | `closure == Expired` | `Expired` (`'C'`) |
137
+ | 4 | `closure == Open && pending_cancel.is_some()` | `PendingCancel` (`'6'`) |
138
+ | 5 | `closure == Open && pending_replace.is_some()` | `PendingReplace` (`'E'`) |
139
+ | 6 | `closure == Open && effective_leaves == 0 && effective_cum > 0` | `Filled` (`'2'`) |
140
+ | 7 | `closure == Open && effective_cum > 0` | `PartiallyFilled` (`'1'`) |
141
+ | 8 | `closure == Open && ack == Acknowledged` | `New` (`'0'`) |
142
+ | 9 | `closure == Open && ack == Unacknowledged` | `PendingNew` (`'A'`) |
143
+
144
+ Transition dispatch operates strictly on the underlying product state, never on projected `OrdStatus`. See [docs/fix-deviations.md](docs/fix-deviations.md) for the FIX 4.4 Appendix D precedence rules as mapped in `ordstate` and intentional refinements.
145
+
146
+ ### Perspective Invariants
147
+
148
+ | Invariant | Venue (`VenueRegistry` — Authority) | Client (`ClientRegistry` — Convergent Mirror) |
149
+ |-----------|-------------------------------------|-----------------------------------------------|
150
+ | `cum_executed + leaves == order_qty` (when `Open`) | **Enforced** (`Err` on violation, including `EngineCorrect`) | **Observed** (`reported_leaves` stored as reported) |
151
+ | `cum_executed <= order_qty` | **Enforced** (`Overfill` error on fill or correction) | **Observed** (applies + `Anomaly::Overfill`; `order_qty` untouched) |
152
+ | `cum_executed` monotonicity | Monotonic except `EngineBust` / `EngineCorrect` | Monotonic except ledger-verified `OnTradeCancel` / `OnTradeCorrect` |
153
+ | Terminal absorption | `Rejected` / `Canceled` / `Expired` reject fills and commands; `Filled` accepts busts/corrections only | `VenueFact` closures keep status while absorbing late fills; `LocalInference` closures are reversed by valid venue facts |
154
+ | `ExecId` uniqueness | Strictly unique within seen-report horizon | Unique within seen-report table; guarded by freshness barrier when `history_incomplete` |
155
+ | Alias bijection & pinning | Active + pending aliases pinned; every live index entry points to its owning order | Same |
156
+
157
+ ## State Transitions
158
+
159
+ ### Venue Perspective (The Authority)
160
+
161
+ Admission on the venue is **two-phase**: remote client requests (`ClientNewOrder`, `ClientCancelRequest`, `ClientReplaceRequest`) stage orders or pending slots, and external engine decisions (`EngineAccept*`, `EngineReject*`, `EngineFill`, `EngineBust`, `EngineCorrect`, `EngineExpire`) commit or reject them.
162
+
163
+ ![Venue Order State Transitions](docs/images/order-types-and-states-2.png)
164
+
165
+ Key reading notes:
166
+ - **Working** groups `New` (`cum == 0`) and `PartiallyFilled` (`0 < cum < order_qty`).
167
+ - A `ClientNewOrder` that fails structural validation emits an immediate `EmitExecReport(Rejected)` and allocates no order slot.
168
+ - `EngineAcceptCancel` handles both requested (`Some(req_cl_ord_id)`) and unsolicited (`None`) cancels.
169
+ - Fills require an acknowledged order (and a triggered stop for `Stop`/`StopLimit`). A full fill while a cancel or replace is in flight clears the pending slot and emits `EmitCancelReject(TooLateToCancel)`.
170
+ - `EngineTriggerStop` and `VenueTimer` do not change `OrdStatus`: the first arms the stop, and the second emits `Notification::ExpiryDue` for the host engine to confirm via `EngineExpire`.
171
+ - Terminal orders (`Filled`, `Rejected`, `Canceled`, `Expired`) remain queryable and eligible for post-trade busts/corrections until explicitly removed with `VenuePurge`.
172
+
173
+ ### Client Perspective (The Convergent Mirror)
174
+
175
+ `ClientRegistry` uses the same nine `OrdStatus` values and product-state projection, but follows whatever the venue reports in arbitrary arrival order:
176
+
177
+ | Situation | Client Behavior |
178
+ |-----------|-----------------|
179
+ | Fill arrives before acknowledgement | Applied immediately; order becomes `Acknowledged` (`PendingNew` → `PartiallyFilled` or `Filled`). |
180
+ | Local send failure or immediate `OrderNotFound` | Closed as `Rejected` (`ClosureSource::LocalInference`); a later valid venue fact reopens it. |
181
+ | Fill arrives after venue closed the order | Quantity is booked, status stays `Canceled` or `Expired`, emits `Anomaly::LateFillAfterClose`. |
182
+ | Local expiry timer fires (`ClientTimer`) | Never sets `Expired` unilaterally; emits `Effect::QueryOrder` so the host queries the venue. |
183
+ | Reported cumulative qty exceeds `order_qty` | Applied, emits `Anomaly::Overfill`. |
184
+ | Venue reports status outside the 9 core states (`DoneForDay`, `Suspended`, `Stopped`, `Calculated`) | Quantities still apply, emits `Anomaly::UnsupportedStatus`. |
185
+ | Authoritative snapshot arrives (`OnOrderSnapshot`) | Order converges to the snapshot subject to observation-boundary watermark and rollback guards. |
186
+ | Report cannot be trusted or causally ordered | Not applied; flags `needs_reconciliation = true` and refuses local replaces until a snapshot clears it. |
187
+
188
+ ### FIX 4.4 `ExecType` (Tag 150) → Client Input Mapping
189
+
190
+ | FIX 4.4 `ExecType` (Tag 150) | Target `ClientInput` |
191
+ |------------------------------|----------------------|
192
+ | `'0'` (`New`) | `OnAckNew` |
193
+ | `'4'` (`Canceled`) | `OnCanceled` |
194
+ | `'5'` (`Replaced`) | `OnReplaced` |
195
+ | `'6'` (`PendingCancel`) / `'E'` (`PendingReplace`) / `'A'` (`PendingNew`) | Optional `OnOrderSnapshot { authoritative: false, .. }` |
196
+ | `'8'` (`Rejected`) | `OnRejectNew` |
197
+ | `'C'` (`Expired`) | `OnExpired` |
198
+ | `'D'` (`Restated`) | `OnRestated` |
199
+ | `'F'` (`Trade`) / FIX 4.2 `'1'`, `'2'` | `OnExecution` |
200
+ | `'G'` (`TradeCorrect`) | `OnTradeCorrect` |
201
+ | `'H'` (`TradeCancel`) | `OnTradeCancel` |
202
+ | `'I'` (`OrderStatus`) | `OnOrderSnapshot` |
203
+ | `'3'` (`DoneForDay`) / `'9'` (`Suspended`) | `OnOrderSnapshot` or `OnRestated` carrying `ReportedStatus` |
204
+ | `35=9` (`OrderCancelReject`) | `OnCancelReject` |
205
+
206
+ ## Workspace Architecture
207
+
208
+ ```text
209
+ ordstate-cpp (header-only C++20 RAII wrapper; zero business logic)
210
+ │
211
+ ▼ #include "ordstate.h"
212
+ ordstate-ffi (cdylib + staticlib; ONLY crate with unsafe; 65 C11 symbols)
213
+ │
214
+ ▼ Rust crate dependency
215
+ ordstate-core (pure Rust; #![forbid(unsafe_code)]; no I/O, clocks, threads, async)
216
+ ```
217
+
218
+ ```text
219
+ ordstate/
220
+ ├── ordstate-core/ # Pure Rust core (#![forbid(unsafe_code)], #![deny(missing_docs)])
221
+ │ ├── src/
222
+ │ │ ├── types/ # Fixed-point Qty/Price, IDs, enums, config, outcomes, timestamps
223
+ │ │ ├── state/ # Orthogonal OrderState, invariants, execution ledger
224
+ │ │ ├── storage/ # Generational Slab and keyed open-addressing AliasIndex
225
+ │ │ ├── venue/ # VenueRegistry, 18 VenueInput variants, VenueOutput
226
+ │ │ ├── client/ # ClientRegistry, 20 ClientInput variants, watermark reconciler
227
+ │ │ └── replay/ # Canonical binary input codec + SHA-256 config_digest
228
+ │ ├── benches/ # Criterion latency benchmarks + p50/p99 percentile suite
229
+ │ └── tests/ # Transition tables, property tests, trace replay harness
230
+ ├── ordstate-ffi/ # C11 FFI crate (65 exported symbols, panic-safe boundary)
231
+ │ ├── include/ordstate.h # cbindgen-generated C11 header
232
+ │ └── tests/ # C11 (ASan/UBSan + layout canaries), Go (cgo -race), Java 22 (FFM), zero-alloc
233
+ ├── ordstate-cpp/ # Header-only C++20 RAII wrapper (include/ordstate.hpp)
234
+ ├── ordstate-py/ # Python bindings via PyO3 + maturin (abi3, Python 3.9+)
235
+ ├── ordstate-go/ # Idiomatic Go module via cgo + pkg-config over C ABI 1.0
236
+ ├── fuzz/ # 5 libFuzzer targets (venue, client, ABI, replay codec, differential)
237
+ └── docs/ # Generated transition tables, ABI spec, FIX 4.4 deviations, diagrams
238
+ ```
239
+
240
+ ### Feature Flags (`ordstate-core`)
241
+
242
+ | Feature | Default | Description |
243
+ |---------|---------|-------------|
244
+ | `venue` | Yes | Enables `ordstate_core::venue` (`VenueRegistry`, `VenueInput`, `VenueOutput`). |
245
+ | `client` | Yes | Enables `ordstate_core::client` (`ClientRegistry`, `ClientInput`, `ClientOutput`). |
246
+ | `strict-invariants` | No | Runs full structural invariant assertions after every transition in release builds. |
247
+
248
+ You can build a minimal single-perspective core by disabling default features:
249
+
250
+ ```toml
251
+ [dependencies]
252
+ ordstate-core = { version = "1.0", default-features = false, features = ["client"] }
253
+ ```
254
+
255
+ ## Status
256
+
257
+ `ordstate` is currently at **`v1.0.0`** (**C ABI `1.0`**, **Replay Schema `v3`**, MSRV **Rust `1.90.0`**). All verification gates—unit/property suites, zero-allocation coverage across all 38 inputs, generated transition tables (701 transitions), synthetic multi-broker profile simulations (tastytrade, IBKR, IG, Hyperliquid; validated via synthetic simulation rather than live broker captures), C11/C++20 ASan+UBSan tests, Miri FFI tests, Go `cgo -race` tests, Java 22 Panama FFM tests, Windows LLP64 layout canaries, MSRV 1.90.0, feature-matrix builds, and fuzz targets—pass.
258
+
259
+ ## Quick Start
260
+
261
+ ### Rust (`ordstate-core`)
262
+
263
+ Add `ordstate-core` to your `Cargo.toml`:
264
+
265
+ ```toml
266
+ [dependencies]
267
+ ordstate-core = "1.0"
268
+ ```
269
+
270
+ #### Venue Perspective (`VenueRegistry`)
271
+
272
+ ```rust
273
+ use ordstate_core::prelude::*;
274
+
275
+ fn main() -> Result<(), OrdstateError> {
276
+ // Pre-allocate all storage once (zero heap allocations during apply).
277
+ let config = RegistryConfig::for_orders(1_024, [0x42; 16]);
278
+ let mut venue = VenueRegistry::try_new(config)?;
279
+ let mut out_buf = [None; MAX_OUTPUTS_PER_CALL];
280
+
281
+ let cl_ord_id = ClOrdId::try_new(b"ORD-0001")?;
282
+ let instrument = InstrumentId::try_new(b"BTC-USD")?;
283
+ let qty = Qty::try_new(100, 0)?;
284
+ let px = Price::try_new(50_000_00, 2)?;
285
+
286
+ // 1. Stage incoming client order
287
+ let res = venue.apply(
288
+ VenueInput::ClientNewOrder {
289
+ cl_ord_id,
290
+ report_exec_id: ExecId::try_new(b"R-NEW-1")?,
291
+ instrument_id: instrument,
292
+ side: Side::Buy,
293
+ ord_type: OrdType::Limit,
294
+ tif: TimeInForce::Day,
295
+ term_price_scale: 2,
296
+ term_qty_scale: 0,
297
+ qty,
298
+ limit_px: Some(px),
299
+ stop_px: None,
300
+ expire_at: None,
301
+ user_data: UserData(0),
302
+ ts: Timestamp(1_000),
303
+ },
304
+ &mut out_buf,
305
+ )?;
306
+ let key = res.key.expect("staged order key");
307
+
308
+ // 2. Engine accepts the order and assigns a VenueOrderId
309
+ let _ = venue.apply(
310
+ VenueInput::EngineAcceptNew {
311
+ key,
312
+ exec_id: ExecId::try_new(b"E-ACK-1")?,
313
+ venue_order_id: VenueOrderId::try_new(b"V-9001")?,
314
+ ts: Timestamp(2_000),
315
+ },
316
+ &mut out_buf,
317
+ )?;
318
+
319
+ // 3. Engine records a partial fill
320
+ let _ = venue.apply(
321
+ VenueInput::EngineFill {
322
+ key,
323
+ exec_id: ExecId::try_new(b"E-FILL-1")?,
324
+ last_qty: NonZeroQty::try_new(40, 0)?,
325
+ last_px: px,
326
+ ts: Timestamp(3_000),
327
+ },
328
+ &mut out_buf,
329
+ )?;
330
+
331
+ let view = venue.order_view(key).expect("active order view");
332
+ assert_eq!(view.cum_executed.mantissa(), 40);
333
+ assert_eq!(view.leaves_qty.mantissa(), 60);
334
+ Ok(())
335
+ }
336
+ ```
337
+
338
+ ### C11 (`ordstate-ffi`)
339
+
340
+ Build the static/shared library with `cargo build --release -p ordstate-ffi` and include [`ordstate-ffi/include/ordstate.h`](ordstate-ffi/include/ordstate.h):
341
+
342
+ ```c
343
+ #include <assert.h>
344
+ #include <string.h>
345
+ #include "ordstate.h"
346
+
347
+ int main(void) {
348
+ ordstate_config_t cfg;
349
+ memset(&cfg, 0, sizeof(cfg));
350
+ cfg.struct_size = (uint32_t)sizeof(cfg);
351
+ cfg.max_orders = 1024;
352
+ cfg.max_aliases = 4096;
353
+ cfg.max_aliases_per_order = 4;
354
+ cfg.max_ledger_entries = 4096;
355
+ cfg.max_execs_per_order = 16;
356
+ cfg.max_seen_reports = 4096;
357
+ cfg.hash_seed[0] = 0x42;
358
+
359
+ ordstate_venue_t *venue = NULL;
360
+ ordstate_diag_t diag;
361
+ memset(&diag, 0, sizeof(diag));
362
+ diag.struct_size = (uint32_t)sizeof(diag);
363
+
364
+ assert(ordstate_venue_create(&cfg, &venue, &diag) == ORDSTATE_STATUS_OK);
365
+ // ... submit inputs via ordstate_venue_on_client_new(...), etc.
366
+ ordstate_venue_destroy(venue);
367
+ return 0;
368
+ }
369
+ ```
370
+
371
+ ### C++20 (`ordstate-cpp`)
372
+
373
+ Include the header-only RAII wrapper [`ordstate-cpp/include/ordstate.hpp`](ordstate-cpp/include/ordstate.hpp) alongside `ordstate.h`:
374
+
375
+ ```cpp
376
+ #include <cassert>
377
+ #include "ordstate.hpp"
378
+
379
+ int main() {
380
+ ordstate_config_t cfg{};
381
+ cfg.struct_size = static_cast<uint32_t>(sizeof(cfg));
382
+ cfg.max_orders = 1024;
383
+ cfg.max_aliases = 4096;
384
+ cfg.max_aliases_per_order = 4;
385
+ cfg.max_ledger_entries = 4096;
386
+ cfg.max_execs_per_order = 16;
387
+ cfg.max_seen_reports = 4096;
388
+ cfg.hash_seed[0] = 0x42;
389
+
390
+ ordstate::VenueHandle venue;
391
+ assert(ordstate::VenueHandle::create(cfg, venue) == ORDSTATE_STATUS_OK);
392
+ // RAII handle automatically destroys the registry on scope exit.
393
+ return 0;
394
+ }
395
+ ```
396
+
397
+ ### Go (`cgo`) & Java 22 (Panama FFM)
398
+
399
+ Complete end-to-end smoke tests demonstrating registry creation, order submission, fills, and teardown are included in the repository:
400
+
401
+ - **Go (`cgo`)**: [`ordstate-ffi/tests/go/smoke_test.go`](ordstate-ffi/tests/go/smoke_test.go) (`make go-test`)
402
+ - **Java 22 (Panama FFM)**: [`ordstate-ffi/tests/java/SmokeTest.java`](ordstate-ffi/tests/java/SmokeTest.java)
403
+
404
+ ## Performance Analysis
405
+
406
+ Benchmarks are implemented with Criterion in [`ordstate-core/benches/apply_bench.rs`](ordstate-core/benches/apply_bench.rs) covering three workloads: a 4-apply venue lifecycle cycle, a 4-apply client lifecycle cycle, and `ClOrdId` alias-replace churn.
407
+
408
+ Representative single-threaded latencies measured on Apple Silicon (release profile, `lto = "thin"`, `codegen-units = 1`, 10,000 samples per workload; absolute numbers are hardware- and workload-dependent):
409
+
410
+ | Workload | Operations / Cycle | p50 (cycle) | p50 (per `apply`) | p99 (cycle) | p99 (per `apply`) |
411
+ |----------|--------------------|-------------|-------------------|-------------|-------------------|
412
+ | `venue_4apply_cycle` | 4 (`New` → `Accept` → `Fill` → `Cancel`) | 291 ns | ~72 ns | 417 ns | ~104 ns |
413
+ | `client_4apply_cycle` | 4 (`Submit` → `Ack` → `Fill` → `Cancel`) | 333 ns | ~83 ns | 500 ns | ~125 ns |
414
+ | `alias_replace_churn` | 2 (`CancelReplace` → `Replaced`) | 167 ns | ~83 ns | 209 ns | ~104 ns |
415
+
416
+ ### Memory & Allocation Guarantees
417
+
418
+ - **Zero Hot-Path Heap Allocations**: Verified by [`ordstate-ffi/tests/zero_alloc.rs`](ordstate-ffi/tests/zero_alloc.rs) using a custom `#[global_allocator]` counting wrapper across all **38 inputs** (18 venue + 20 client).
419
+ - **Predictable O(1) Storage**: Generational `Slab` + keyed open-addressing `AliasIndex` + fixed-capacity `LedgerPool` eliminate pointer chasing and dynamic resizing during trading hours.
420
+
421
+ ## Documentation & Specifications
422
+
423
+ - [**Transition Tables (`docs/transitions.md`)**](docs/transitions.md) — Machine-generated reference of all 701 venue and client state transitions, verified on every CI run via `make transitions-check`.
424
+ - [**C11 ABI Specification (`docs/abi.md`)**](docs/abi.md) — Memory ownership, error codes, thread-safety contract, struct layout stability, and symbol inventory for `ordstate-ffi`.
425
+ - [**FIX 4.4 Deviations (`docs/fix-deviations.md`)**](docs/fix-deviations.md) — Explicit catalog of intentional refinements over FIX 4.4 Appendix D.
426
+
427
+ ## Makefile Commands
428
+
429
+ This project includes a `Makefile` with targets for local development, cross-language testing, and pre-push verification:
430
+
431
+ ### Build & Quality
432
+
433
+ ```sh
434
+ make fmt # Check rustfmt formatting
435
+ make clippy # Run clippy across all targets and features (-D warnings)
436
+ make test # Run full Rust test suite (--all-features --workspace)
437
+ make release # Build release workspace binaries and libraries
438
+ make msrv # Verify compilation on MSRV (Rust 1.90.0)
439
+ make feature-matrix # Verify clippy across all feature combinations
440
+ ```
441
+
442
+ ### FFI, Sanitizers & Cross-Language Tests
443
+
444
+ ```sh
445
+ make header-gen # Regenerate ordstate-ffi/include/ordstate.h via cbindgen
446
+ make header-check # Verify committed C11 header matches cbindgen output
447
+ make c-test # Build and run C11 layout canaries + smoke tests (ASan + UBSan)
448
+ make cpp-test # Build and run C++20 RAII smoke tests (ASan + UBSan)
449
+ make go-test # Build and run Go cgo Venue + Client tests (-race)
450
+ make miri # Run nightly Miri over ordstate-ffi
451
+ ```
452
+
453
+ ### Specifications, Benchmarks & Pre-Push
454
+
455
+ ```sh
456
+ make transitions-gen # Regenerate docs/transitions.md from core state machines
457
+ make transitions-check # Verify docs/transitions.md is up to date
458
+ make bench # Compile Criterion benchmarks
459
+ make hygiene # Run public repository hygiene checks
460
+ make pre-push # Full local gate (fmt, clippy, test, release, header, transitions, c, cpp, miri, hygiene)
461
+ ```
462
+
463
+ ## Contribution and Contact
464
+
465
+ Contributions are welcome! To contribute:
466
+
467
+ 1. Fork the repository.
468
+ 2. Create a feature or bug-fix branch.
469
+ 3. Make your changes and run `make pre-push` to verify formatting, lints, tests, headers, transition tables, sanitizers, and Miri.
470
+ 4. Commit your changes and push your branch to your fork.
471
+ 5. Open a pull request against `main`.
472
+
473
+ ### Contact Information
474
+
475
+ - **Author**: Joaquín Béjar García
476
+ - **Email**: jb@taunais.com
477
+ - **Telegram**: [@joaquin_bejar](https://t.me/joaquin_bejar)
478
+ - **Repository**: <https://github.com/joaquinbejar/ordstate>
479
+ - **Documentation**: <https://docs.rs/ordstate-core>
480
+
481
+ **License**: MIT