mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
c1ef83cf345cc70477725fe6862003d94d3f4efb
Adds four Go files to chains/dexvm so the DEX VM can call into the
lux-private/gpu-kernels plugin DEX launchers (AMM xyk + CLOB matcher +
BookArena lifecycle) without a build-time pkg-config dependency:
* backend.go cross-build types: GPUBackend enum, LuxAmmReservePair
(16 bytes, byte-equal to include/lux/gpu/dex.h),
CLOB ABI constants, ErrGPUNotAvailable.
* dexvm_gpu.go (cgo) dlopen probe at init() in order
cuda -> hip -> metal -> vulkan -> webgpu, resolving
lux_<backend>_{amm_xyk_batch,dex_clob_match,
dex_clob_arena_create,dex_clob_arena_destroy}.
Exposes AutoBackend / AMMSwap / CLOBMatch /
ArenaCreate / ArenaDestroy. unsafe.Sizeof guards
the AMM struct layout against silent ABI drift.
* dexvm_gpu_nocgo.go symmetric stubs returning ErrGPUNotAvailable so
the package surface is identical under both tags.
* dexvm_gpu_test.go round-trip test: dlopens the metal plugin (or any
other found under LUX_GPU_PLUGIN_DIR), runs a
single-pair AMM swap, asserts byte-equal output
to the CPU oracle (constant-product 1000 -> 1998
at rx=1M, ry=2M).
Existing dexvm vm.go / orderbook logic is untouched - consumers opt in
explicitly when ready. Both 'go build ./dexvm/...' and
'go build -tags cgo ./dexvm/...' are green.
Test output with LUX_GPU_PLUGIN_DIR=$HOME/work/lux-private/gpu-kernels/build-metal/backends/metal:
--- PASS: TestGPUAMMSwapRoundTrip (0.08s) [backend=metal]
--- PASS: TestGPUAMMSwapEmpty (0.00s)
bridgevm: close daemon-discovery RPC gap (getInfo, getSupportedChains, getChainConfig, getSignature) (#5)
Lux Chains
Independent VM plugin binaries for the Lux Network.
Each directory builds to a standalone binary that the Lux node loads as a plugin via --plugin-dir.
Build
make # build all VMs
make evm # build one VM
make test # test all
Install
lpm install evm
lpm install dexvm
Or copy binaries to ~/.lux/plugins/<vmid>.
VMs
| VM | Chain | Purpose |
|---|---|---|
| evm | C-Chain | EVM smart contracts |
| dexvm | D-Chain | Decentralized exchange |
| aivm | A-Chain | AI/ML inference |
| bridgevm | B-Chain | Cross-chain bridge |
| graphvm | G-Chain | GraphQL data layer |
| identityvm | I-Chain | Decentralized identity |
| keyvm | K-Chain | Key management |
| oraclevm | O-Chain | Oracle/off-chain data |
| quantumvm | Q-Chain | Post-quantum consensus signing (Pulsar) |
| relayvm | R-Chain | Cross-chain relay |
| servicenodevm | S-Chain | Service node registry |
| teleportvm | T-Chain | Unified teleport (bridge + relay + oracle) |
| thresholdvm (MPC) | M-Chain | MPC ceremonies (CGGMP21, FROST, Pulsar-general) — bridge custody for external wallets |
| thresholdvm (FHE) | F-Chain | FHE compute + TFHE bootstrap-key generation (encrypted EVM) |
| zkvm | Z-Chain | Groth16 over BLS12-381 (rolls N × ML-DSA-65 sigs into 192-byte proof) |
Languages
Go
98.2%
C
1.7%
Shell
0.1%