Files
consensus/pkg/rust
zeekayandHanzo Dev 2fab570b4b conformance: freeze what the predicate DECIDES, not only what it encodes
The corpus stated what a validator signs and what a certificate looks like
on the wire. That is necessary and it is not sufficient: an implementation
can reproduce every byte and still finalize on the wrong number of signers,
because encoding and deciding are different questions. A build carrying no
weighted predicate at all passed a corpus that only ever asked it to encode.

So the corpus now asks the other question. Each case states a validator set,
the distinct signers a certificate carries and the rung it attests, and
records what VerifyWeighted decided about it — read from the live predicate,
never restated, the same way the proof-of-possession vector records what
pop.Verify returns.

Both edges of a forty-one seat set are pinned, seven seats apart, so an
implementation that confuses the majority floor for the supermajority floor
cannot pass by accident. The lone holder of a stake majority is pinned
refusing on the COUNT: stake cannot buy a pass past the signer floor, which
is what stops a single holder self-igniting.

Signatures are not the subject. Every vote is resolved as correctly signed,
so a case can only turn on the weighted half. Braiding the two would mean a
weighted rule could not be stated without a key ceremony, and a runner that
lacked one would report PASS by skipping the case — the failure this closes.

The golden alone would let a moved threshold be re-blessed with -update, so
the boundaries are also stated outright and recomputed in arbitrary
precision: 2*voted > total, and 3*voted > 2*total. Neither can share an
off-by-one with the floors it checks.

The export rung's own signer floor (R4) and the keyless denominator (R5) are
left as open decisions rather than frozen expectations, marked where the next
cut extends this section.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-01 13:18:51 -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.