mirror of
https://github.com/luxfi/consensus.git
synced 2026-09-24 00:26:58 +00:00
Register refuses a validator admitted with no stake, because a keyed seat carrying zero weight is a phantom signer: it raises the count of distinct signers a floor is read against and contributes nothing to the stake the same certificate is weighed by. FlattenValidatorSet admitted it, so the clause the two doors are supposed to share meant one thing at registration and another on a set the chain had already admitted. The corpus said so before the code did. AdmissionCase already records that "the weight clauses are common to both" doors, and the transcribed rule in verdict_test.go already demanded a zeroWeight refusal for any case carrying a weightless seat, at either door — there was simply no case exercising this one. There is now, produced by the live function, and it fails against the old door on the golden AND on the transcribed rule independently. Refused, not skipped, and that is not the trade this door makes for an undecodable key. Skipping a bad key costs a signer the set was going to lose anyway; admitting a weightless keyed seat is a signer the set gains for free. A KEYLESS seat with no stake is untouched: it is skipped before the weight clause, never becomes a signer, and neither signs nor weighs — the leniency this door keeps, and the one Rust's insert_unkeyed keeps for the same reason. Placed where Register places it and where Rust's ValidatorSet::insert places it: after the key is known to be present, before it is decoded. A shaped key is therefore enough to reach the clause on either side, which is what lets the Rust runner answer this row instead of skipping it as it must skip the other two at this door. Co-authored-by: Hanzo Dev <[email protected]>
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.