Expand description
Leader election strategies for simplex consensus.
This module provides the Config and Elector traits for customizing
how leaders are selected for each consensus round, along with built-in implementations.
§Built-in Electors
-
RoundRobin/RoundRobinElector: Deterministic rotation through participants based on view number. Optionally shuffled using a seed. Works with any signing scheme. -
Random/RandomElector: Uses randomness derived from BLS threshold signatures for unpredictable leader selection. Falls back to round-robin for the first view (no certificate available). Only works withbls12381_threshold.
§Custom Electors
Applications can implement Config and Elector for custom leader
selection logic such as stake-weighted selection or other application-specific strategies.
§Usage
This module uses a type-state pattern to ensure correct usage:
- Users create an elector
Config(e.g.,RoundRobin) - The config is passed to the consensus configuration
- Consensus calls
Config::buildinternally with the correct participants - The resulting
Electorcan only be created by consensus, preventing misuse
Structs§
- Random
- Configuration for leader election using threshold signature randomness.
- Random
Elector - Initialized random leader elector using threshold signature randomness.
- Round
Robin - Configuration for round-robin leader election.
- Round
Robin Elector - Initialized round-robin leader elector.