bounding staking: BoundedElectionProvider trait (#12362)

* add a bounded election provider trait

* extract common trait election provider base

* fmt

* only bound the outer support vector

* fix tests

* docs

* fix rust docs

* fmt

* fix rustdocs

* docs

* improve docs

* small doc change
This commit is contained in:
Ankan
2022-09-28 22:52:16 +02:00
committed by GitHub
parent ea43466879
commit 6137c8707b
7 changed files with 99 additions and 55 deletions
@@ -297,7 +297,7 @@ impl onchain::Config for OnChainSeqPhragmen {
}
pub struct MockFallback;
impl ElectionProvider for MockFallback {
impl ElectionProviderBase for MockFallback {
type AccountId = AccountId;
type BlockNumber = u64;
type Error = &'static str;
@@ -306,7 +306,8 @@ impl ElectionProvider for MockFallback {
fn ongoing() -> bool {
false
}
}
impl ElectionProvider for MockFallback {
fn elect() -> Result<Supports<AccountId>, Self::Error> {
Self::elect_with_bounds(Bounded::max_value(), Bounded::max_value())
}