pub fn create_validators_with_nominators_for_era<T: Config>(
    validators: u32,
    nominators: u32,
    edge_per_nominator: usize,
    randomize_stake: bool,
    to_nominate: Option<u32>
) -> Result<Vec<<<T as Config>::Lookup as StaticLookup>::Source>, &'static str>
Expand description

This function generates validators and nominators who are randomly nominating edge_per_nominator random validators (until to_nominate if provided).

NOTE: This function will remove any existing validators or nominators to ensure we are working with a clean state.

Parameters:

  • validators: number of bonded validators
  • nominators: number of bonded nominators.
  • edge_per_nominator: number of edge (vote) per nominator.
  • randomize_stake: whether to randomize the stakes.
  • to_nominate: if Some(n), only the first n bonded validator are voted upon. Else, all of them are considered and edge_per_nominator random validators are voted for.

Return the validators chosen to be nominated.