Files
consensus/pkg/rust
zeekayandHanzo Dev b7f7d907fb vote: name the MPC transport's home, and say the two lanes do not interoperate
Two claims in this file were wrong about the world outside it.

`MsgMPCReady = 62` is `github.com/luxfi/mpc` (`pkg/transport/wire.go`), a
repository of its own — not a package inside `luxfi/node`. A reader following
the citation to check the collision would not have found it. The conclusion it
supports is unchanged and now carries the reason it holds: that ring listens on
its own port behind mandatory PQ TLS 1.3 and closes any connection whose first
frame is not a `MsgMPCReady` carrying JSON, which a vote payload is not.

And the id was presented as the only thing between this lane and the C++ one,
which reads as "fix the constant and they interoperate". They do not. C++ frames
`block_id(32) ‖ pubkey(48) ‖ sig(96)` and names its signer by a 48-byte key;
this lane frames `signed_message(226) ‖ node(20) ‖ sig(96)` and names it by the
20-byte NodeID a proof of possession binds. C++ signs the same canonical message
and then transmits only the block id, so its receiver rebuilds the preimage —
the second derivation the payload rule exists to prevent. On the two counts with
a standard behind them, 0x11 is `MsgResponse` in the Go registry and Go names a
validator by `ids.NodeID`; this side holds both. The reconciliation is owed on
the C++ side, and until it is paid neither can read the other's frames.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-02 00:21:14 -07:00
..

lux-consensus

Pure-Rust SDK for the Lux Quasar consensus stack — Wave threshold voting, FPC (Fast Probabilistic Consensus), Photon validator sampling, Focus confidence accumulation, and post-quantum hybrid finality via BLS12-381 + Pulsar (Module-LWE threshold, FIPS 204 byte-equal).

Features

Flag What it pulls in
default CPU-only, no extra deps beyond blst and hex
simd blake3 (SIMD hashing) + rayon (data-parallel vote tally)
mlx Apple Silicon GPU acceleration via mlx-sys (implies simd)
cuda NVIDIA GPU acceleration (implies simd) — work in progress
gpu mlx + cuda — auto-select per platform

Usage

use lux_consensus::*;

let config = QuasarConfig::mainnet();
let mut engine = QuasarEngine::new(config);
engine.start().unwrap();

let block = Block::new(
    ID::from([1u8; 32]),
    ID::from([0u8; 32]),
    1,
    b"Hello, Lux!".to_vec(),
);
engine.add(block.clone()).unwrap();

// A validator is named by its 20-byte NodeID — never the 32-byte block id.
for i in 0..20 {
    engine.add_validator(NodeID::from([i; 20]), 1).unwrap();
}

for i in 0..20 {
    let vote = Vote::new(block.id.clone(), VoteType::Preference, NodeID::from([i; 20]));
    engine.record_vote(vote).unwrap();
}

assert!(engine.is_accepted(&block.id));
engine.stop().unwrap();

Architecture

  • Wave — adaptive-threshold voting driven by FPC outputs
  • FPC — PRF-derived per-round thresholds for fast probabilistic consensus
  • Photon — luminance-tracked validator sampling
  • Focus — β consecutive rounds of confidence before commit
  • Quasar — a two-thirds-by-stake certificate: the distinct signed accepts themselves, each checked against its own signer's key

License

Lux Ecosystem License 1.2 — see the LICENSE file.