Configurable maximum validators (#2586)

* guide: max_validators

* guide: new approach

* restrict validators based on configurable max

* add some tests

* fix wasm build (Vec)

* clean up warnings

* add logging

* set validator indices in tests as well

* fix common tests

* Update runtime/parachains/src/util.rs

Co-authored-by: Andronik Ordian <write@reusable.software>

Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
Robert Habermeier
2021-03-09 12:38:55 -06:00
committed by GitHub
parent 30e4a67f0c
commit 8b4f46d2df
17 changed files with 300 additions and 83 deletions
@@ -285,6 +285,7 @@ mod tests {
System: frame_system::{Module, Call, Config, Storage, Event<T>},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
Parachains: paras::{Module, Origin, Call, Storage, Config<T>},
Shared: shared::{Module, Call, Storage},
Inclusion: inclusion::{Module, Call, Storage, Event<T>},
Registrar: paras_registrar::{Module, Call, Storage},
Staking: pallet_staking::{Module, Call, Config<T>, Storage, Event<T>, ValidateUnsigned},
@@ -466,7 +467,7 @@ mod tests {
pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"test");
mod app {
use super::super::Inclusion;
use super::super::Shared;
use sp_application_crypto::{app_crypto, sr25519};
app_crypto!(sr25519, super::KEY_TYPE);
@@ -476,7 +477,7 @@ mod tests {
fn into_account(self) -> Self::AccountId {
let id = self.0.clone().into();
Inclusion::validators().iter().position(|b| *b == id).unwrap() as u64
Shared::active_validator_keys().iter().position(|b| *b == id).unwrap() as u64
}
}
}