Function select_authorities

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

Pseudo-random selection the authorities for the given sidechain epoch, according to the Ariadne specification: https://input-output.atlassian.net/wiki/spaces/SID/pages/4228612151/Ariadne+-+committee+selection+algorithm

Committee size is P+T, where P (permissioned) and T (trustless) are constituents of the D parameter.

Committee is a result of the weighted selection with repetition.

Weight function for trustless candidate is:

  • let n be the number of permissioned candidates from MC data
  • if n == 0, then the weight is stake_delegation
  • otherwise, the weight is n * T * stake_delegation

Weight for each permissioned candidates is:

  • let W be the sum of all stake delegations of trustless candidates
  • if W == 0 or T == 0 (there are no valid trustless candidates, or they are not taken into account), then the weight is 1
  • otherwise, the weight is P * W