Function select_authorities

Source
pub fn select_authorities<SC>(
    registered_seats: u16,
    permissioned_seats: u16,
    registered_candidates: Vec<(SC, Weight)>,
    permissioned_candidates: Vec<SC>,
    seed: <ChaCha20Rng as SeedableRng>::Seed,
) -> Option<Vec<SC>>
where SC: Ord + Clone,
Expand description

Selects committee according to D-parameter and candidates lists. Resulting committee has size of registered_seats + permissioned_seats. If both registered_candidates and permissioned_candidates are not empty then the selected committee has exactly registered_seats assigned to registered_candidates.

Let E_i be the expected number of places in the resulting committee of candidate i calculated from D-parameter and its weight relative to other candidates. Then candidate i is guaranteed to get at least floor[E_i] seats.

Edge cases: If candidates of one type are missing, then their seats are assigned to candidates of other type. It is because D-parameter is desired not mandatory ratio. If registered_seats and permissioned_seats are 0, empty committee is returned. It is same as for original Ariadne. This function returns same selection regardless of input vectors ordering.