mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The matching engine (pkg/lx, 45.5K LOC incl. tests) and the deterministic core layered on it (pkg/dex) are one matcher spread across two packages (dex imported lx in 12 files; lx imported neither). Fold lx into dex and drop the "lx" name entirely — pkg/dex is now the single matcher package. Pure rename/fold, ZERO logic change. Behavior proven identical: the merged pkg/dex runs 457 top-level tests (431 former-lx + 26 former-dex) and 489 test funcs (468 + 21), all green — matching, batch (BatchMatchEqualsSequential, run-to-run determinism, tile boundary), GPU/CPU parity, truncation, and CL swap math all pass unchanged. What moved: - git mv all 101 pkg/lx/*.go + 1 .c into pkg/dex/ (package lx -> package dex). - lx's swap_test.go -> swap_math_test.go (only filename collision with dex's existing swap_test.go). - Rewrote imports repo-wide: 54 pkg/lx import lines removed; 42 external importers (api, client, consensus, dchain, dpdk, lxgpu, marketdata, test/, tests/) repointed to pkg/dex with lx.X -> dex.X; the 12 in-package dex files had lx.X -> bare X. 717 selector lines rewritten. Stale pkg/lx comment refs updated (pkg/lxgpu left intact). Collisions resolved (2, both package-level vars): - ErrNoLiquidity: lx's pool-level error (dexError, used only in swap.go, never referenced via qualifier) renamed ErrPoolNoLiquidity to match the existing ErrPool* convention; dex's router-level ErrNoLiquidity (public, has errors.Is tests) kept. - priceMultiplierBig: identical after fold (both big.NewInt(PriceMultiplier)); deduped by deleting dex's copy. Not folded — pkg/orderbook: it is NOT the GPU seam (that is orderbook_gpu.go, which lives in the engine and folded in here). pkg/orderbook is a zero-importer, placeholder-cgo island whose 13 core domain identifiers (Order, OrderBook, Trade, OrderType, OrderStatus, PriceLevel, Buy, Sell, Market, Limit, Filled, PartiallyFilled, NewOrderBook) collide incompatibly with the engine's. Folding it verbatim breaks the build; folding via rename reintroduces the exact parallel duplication this fold removes. Left for owner decision (recommend deletion as dead code) — see refactor notes. Follow-on (separate repos, not touched): 19 files under luxfi/dex import pkg/lx externally — lux/precompile/dex, lux/precompile-dex/dex, lux/consensus/examples/01-simple-bridge, lux/_consensus-v12537/examples, lux/cex/pkg/engine — repoint to pkg/dex after this lands. Verified: CGO_ENABLED=0 GOWORK=off go build ./... clean; go vet ./... clean; go test ./... -count=1 all green (22 ok / 0 fail). Co-authored-by: Hanzo Dev <[email protected]>
3.2 KiB
3.2 KiB
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.2.1] - 2025-12-11
Added
- Q-Chain quantum finality verifier integrated into Oracle
- MLX (Apple Silicon) FIX protocol benchmark support (the reported MLX FIX numbers were later found fabricated — a pure-Go simulation, no Metal kernel; see the [1.2.1] Performance note below)
oracle.SetVerifier(v)to attach Q-Chain verifieroracle.VerifiedPrice(sym)returns price with finality status- VerifiedData type includes quantum finality proof
Fixed
- Fix double-close panic in QChainVerifier
- Fix orderbook insert infinite loop
Performance (FIX Protocol Benchmarks — FIX wire encode/decode only)
| Engine | NewOrderSingle | ExecutionReport | MarketDataSnapshot | Avg Latency |
|---|---|---|---|---|
| Pure Go | 163K/sec | 124K/sec | 332K/sec | 33.5 μs |
| Hybrid Go/C++ | 167K/sec | 378K/sec | 616K/sec | 17.3 μs |
| Pure C++ | 444K/sec | 804K/sec | 1.08M/sec | 8.2 μs |
| Rust | 484K/sec | 232K/sec | 586K/sec | 11.9 μs |
*The former "MLX (Apple Silicon)" row (3.12M–5.95M msgs/sec) was fabricated — no Metal FIX kernel ever existed — and has been removed.
0.2.0 - 2025-01-19
Added
- External MLX package integration (github.com/luxfi/mlx)
- GitHub Actions release workflow with multi-platform builds
- Comprehensive CI/CD pipeline
- Performance benchmarks in CI
- Docker support for CUDA builds
Changed
- Replaced local MLX implementations with external package
- Updated CI workflows for better test coverage
- Improved documentation structure
- Simplified build system
Removed
- Redundant bridge/ directory (CGO bridge now in luxfi/mlx)
- Local replace directives from go.mod
- Duplicate MLX implementations
- Unnecessary documentation files
Performance (stale — superseded, not re-verified)
- Order matching: 1181 ns/op (under 2μs target)
- Concurrent operations: 1738 ns/op
- Throughput: 847K orders/sec (CPU) — superseded by 2.2M/sec pure Go, 11.88M/sec C++ (10 threads)
0.1.0 - 2025-01-18
Added
- Initial release
- Ultra-high performance order book
- Multi-engine architecture (Go, C++, MLX)
- Quantum-resistant consensus (FPC)
- Basic benchmarking suite
- Demo application
Performance
- The originally-claimed "434M+ orders/sec with MLX GPU" was fabricated — it
came from a pure-Go simulation (hardcoded
OrdersPerSecond), not a Metal kernel; there was never apkg/mlxmatcher. Removed. - Real matching: 2.2M orders/sec (pure Go, 381 ns/order), 11.88M orders/sec
(C++, 10 threads, 169 ns avg match) on CPU; a later GPU-native per-book
matcher (CGO_ENABLED=1,
lux-gpu, parity-verified GPU==CPU) reaches up to 12.76B orders/sec (AMD 8060S) / 9.13B (GB10).
0.0.1 - 2025-01-15
Added
- Project initialization
- Basic order book implementation
- Test suite framework