mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
v1.3.3
Wave 3B of codec final rip (#101). bridgevm/codec.go was a 4-call singleton registering 3 types (Block, BridgeRequest, Genesis) — the Block + BridgeRequest pair persists on-disk via db.Put and ships over the wire via ParseBlock, so json's allocation cost and lack of stable field ordering are unacceptable. Hand-rolled binary mirrors zkvm/ (Wave 3A) for the canonical one-and-only-one way. Genesis was registered but never marshaled by Codec (vm.go uses json.Unmarshal on vmInit.Genesis), so it's dropped from the codec surface entirely — no replacement needed. Wire format (big-endian, length-prefixed): Block = parentID(32) | height(8) | timestamp(8) | nReqs(4) BridgeRequest* | nSigs(4) { nodeID(20) sig(len4|bytes) }* (sorted by NodeID) BridgeRequest = id(32) | srcChain(len4|str) | dstChain(len4|str) | asset(32) | amount(8) | recipient(len4|bytes) | sourceTxID(32) | confirmations(4) | status(len4|str) | nSigs(4) (len4|bytes)* | createdAtUnixNano(8) MPCSignatures (map[NodeID][]byte) is sorted by NodeID before write so encoding is deterministic across map-iteration orders — required for byte-identical output across nodes. Changes: - chains/bridgevm/codec.go: deleted singleton, replaced with package-level marshalBlock/unmarshalBlock + marshalBridgeRequest/unmarshalBridgeRequest following zkvm primitive-writer style (writeU32, readBytes, etc.) - chains/bridgevm/block.go: Codec.Marshal → marshalBlock in Bytes() - chains/bridgevm/vm.go: 3 sites Codec.{Marshal,Unmarshal} → marshal/unmarshalBlock - chains/bridgevm/codec_test.go: round-trip, determinism, short-buffer, trailing-bytes, nil-safety coverage Tests pass: bridgevm (0.39s, 7 new + all existing). Final grep "github.com/luxfi/codec" in bridgevm/: zero. Pre-check confirmed zero external consumers of bridgevm.Codec or bridgevm.codecVersion — only bridgevm.VMID / bridgevm.Factory used externally (node/node/vms.go). Remaining codec.go callers in chains/ module: zkvm (Wave 3A in flight).
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%