Alter behavior of max_validators_per_core (#2143)

* guide: ensure max-per-core leads to creation of extra, semi-useless cores

* alter behavior of max_validators_per_core

* guide fixes
This commit is contained in:
Robert Habermeier
2020-12-24 13:55:34 -05:00
committed by GitHub
parent fc553a15de
commit 2557181ecf
2 changed files with 26 additions and 20 deletions
@@ -175,13 +175,14 @@ Actions:
1. Set `SessionStartBlock` to current block number.
1. Clear all `Some` members of `AvailabilityCores`. Return all parathread claims to queue with retries un-incremented.
1. Set `configuration = Configuration::configuration()` (see [`HostConfiguration`](../types/runtime.md#host-configuration))
1. Resize `AvailabilityCores` to have length `Paras::parachains().len() + configuration.parathread_cores with all `None` entries.
1. Determine the number of cores & validator groups as `n_cores`. This is the maximum of
1. `Paras::parachains().len() + configuration.parathread_cores`
1. `n_validators / max_validators_per_core` if `configuration.max_validators_per_core` is `Some` and non-zero.
1. Resize `AvailabilityCores` to have length `n_cores` with all `None` entries.
1. Compute new validator groups by shuffling using a secure randomness beacon
- We need a total of `N = Paras::parachains().len() + configuration.parathread_cores` validator groups.
- First, we obtain "shuffled validators" `SV` by shuffling the validators using the `SessionChangeNotification`'s random seed.
- Then, we truncate `SV` to have at most `configuration.max_validators_per_core * N` members, if `configuration.max_validators_per_core` is `Some`.
- Note that the total number of validators `V` in `SV` may not be evenly divided by `N`.
- The groups are selected by partitioning `SV`. The first V % N groups will have (V / N) + 1 members, while the remaining groups will have (V / N) members each.
- We obtain "shuffled validators" `SV` by shuffling the validators using the `SessionChangeNotification`'s random seed.
- Note that the total number of validators `V` in `SV` may not be evenly divided by `n_cores`.
- The groups are selected by partitioning `SV`. The first V % N groups will have (V / n_cores) + 1 members, while the remaining groups will have (V / N) members each.
1. Prune the parathread queue to remove all retries beyond `configuration.parathread_retries`.
- Also prune all parathread claims corresponding to de-registered parathreads.
- all pruned claims should have their entry removed from the parathread index.