Expand description
Provides concrete election implementations for author
selection using plugin-based election traits.
It binds the generic election abstractions
defined in to pallet-specific storage, configuration, and runtime models.
The module implements two distinct election strategies:
§Flat Election
- Aggregates all economic exposure of an author (self-collateral and third-party backing) into a single influence value.
- Influence is computed via a runtime-configured
Influenceplugin model. - Each author contributes exactly one comparable weight into the election.
This model favors total economic commitment, regardless of its source.
§Fair Election
- Preserves individual backing contributions from external funders.
- Explicitly may include candidate’s self-collateral from election weight as one of the backers.
- Each backer contributes a distinct weight entry for the author.
This model favors distributed support and discourages dominance through self-backed influence.
§Architecture
Both election modes:
- Implement
InspectWeightto expose candidate weights in a model-appropriate form. - Implement
ElectionManagerto:- prepare election inputs,
- invoke plugin-based election models,
- enforce governance constraints (minimum / maximum elected),
- persist election results,
- and emit lifecycle events.
All election computation logic is delegated to runtime-configured plugins. This ensures that:
- election algorithms can evolve without pallet code changes,
- multiple election strategies can coexist safely,
- and governance retains control over election semantics.
§Storage Semantics
- Election results are stored per block and keyed by the most recent election round.
- Historical elections remain immutable.
- Removal operations only affect the latest election state.
§Design Guarantees
- No election logic is hardcoded in this module.
- Influence and weight calculations are fully externalized.
- Strong type safety is preserved across all election paths.
This module serves as the bridge between abstract election traits and pallet-level author governance.