Allow staking miner to use different election algorithms (#3752)

* WIP

* Dry run cmd working

* Monitor cmd works

* Configure balance with parameter type

* Comments

* cleannnn

* Add balancing to PhragMMS

* Move OffchainRanomBalancing to common

* DRY mine_unchecked over config.solver

* FMT

* Apply suggestions from code review

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

* Improve docs for any_runtime_unit!

* Some cleanup

* fmt

* Correct capitilaztion

* Improve version mismatch log

* Revert "Improve version mismatch log"

This reverts commit 57570403f654f1efa4307956cda2de6f0c64f70a.

* Apply suggestions from code review

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

* Remove Balancing struct and use Balancing Parameter type instead

* update Substrate

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Zeke Mostov
2021-09-09 13:21:54 -07:00
committed by GitHub
parent 83a35874ee
commit b048be06fe
13 changed files with 395 additions and 272 deletions
+5 -2
View File
@@ -356,7 +356,6 @@ parameter_types! {
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(5u32, 10_000);
// miner configs
pub const MinerMaxIterations: u32 = 10;
pub OffchainRepeat: BlockNumber = 5;
}
@@ -384,7 +383,6 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type RewardHandler = (); // nothing to do upon rewards
type SignedPhase = SignedPhase;
type SolutionImprovementThreshold = SolutionImprovementThreshold;
type MinerMaxIterations = MinerMaxIterations;
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
type MinerMaxLength = OffchainSolutionLengthLimit;
type OffchainRepeat = OffchainRepeat;
@@ -393,6 +391,11 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type Solution = NposCompactSolution24;
type OnChainAccuracy = Perbill;
type Fallback = Fallback;
type Solver = frame_election_provider_support::SequentialPhragmen<
AccountId,
pallet_election_provider_multi_phase::SolutionAccuracyOf<Runtime>,
runtime_common::elections::OffchainRandomBalancing,
>;
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EnsureOneOf<
AccountId,