Allow pallet-election-provider to accept smaller solutions as well (#10905)

* Allow `pallet-election-provider` to accept smaller
solutions, issue #9478

* Fixing a typo

* Adding some more tests
Removing a seemingly outdated comment

* making it a URL

* Updating test name as per suggestion

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Updating documentation to be more explicit

And to follow the general guidelines

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

* Fixing formatting

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Georges
2022-03-17 12:52:26 +00:00
committed by GitHub
parent be45d83aa2
commit 1c4afdad22
3 changed files with 54 additions and 8 deletions
@@ -289,6 +289,12 @@ pub trait ElectionDataProvider {
///
/// This should be implemented as a self-weighing function. The implementor should register its
/// appropriate weight at the end of execution with the system pallet directly.
///
/// A sensible implementation should use the minimum between this value and
/// [`Self::targets().len()`], since desiring a winner set larger than candidates is not
/// feasible.
///
/// This is documented further in issue: <https://github.com/paritytech/substrate/issues/9478>
fn desired_targets() -> data_provider::Result<u32>;
/// Provide a best effort prediction about when the next election is about to happen.