mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
Moving NposSolution to frame (#11031)
* Move `sp-npos-elections-solution-type` to `frame-election-provider-support` First stab at it, will need to amend some more stuff * Fixing tests * Fixing tests * Fixing cargo.toml for std configuration * fmt * Committing suggested changes renaming, and re exporting macro. * Removing unneeded imports * Move `NposSolution` to frame * Removing `npos_election` dependencies Implementing _fpes better * some feedback for moving NPoSSolution to frame * fmt * more formatting * Fixed some imports and fmt * Fixing docs Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
@@ -38,7 +38,6 @@ sp-staking = { version = "4.0.0-dev", default-features = false, path = "../../..
|
||||
sp-session = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/session" }
|
||||
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/transaction-pool" }
|
||||
sp-version = { version = "5.0.0", default-features = false, path = "../../../primitives/version" }
|
||||
sp-npos-elections = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/npos-elections" }
|
||||
sp-io = { version = "6.0.0", default-features = false, path = "../../../primitives/io" }
|
||||
sp-sandbox = { version = "0.10.0-dev", default-features = false, path = "../../../primitives/sandbox" }
|
||||
|
||||
@@ -178,7 +177,6 @@ std = [
|
||||
"pallet-vesting/std",
|
||||
"log/std",
|
||||
"frame-try-runtime/std",
|
||||
"sp-npos-elections/std",
|
||||
"sp-io/std",
|
||||
"pallet-child-bounties/std",
|
||||
]
|
||||
|
||||
@@ -23,9 +23,11 @@
|
||||
#![recursion_limit = "256"]
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use frame_election_provider_support::onchain;
|
||||
use frame_election_provider_support::{onchain, ExtendedBalance, VoteWeight};
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
construct_runtime,
|
||||
pallet_prelude::Get,
|
||||
parameter_types,
|
||||
traits::{
|
||||
AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, Currency, EnsureOneOf,
|
||||
EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, KeyOwnerProofSystem,
|
||||
@@ -598,7 +600,7 @@ frame_election_provider_support::generate_solution_type!(
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub MaxNominations: u32 = <NposSolution16 as sp_npos_elections::NposSolution>::LIMIT as u32;
|
||||
pub MaxNominations: u32 = <NposSolution16 as frame_election_provider_support::NposSolution>::LIMIT as u32;
|
||||
}
|
||||
|
||||
/// The numbers configured here could always be more than the the maximum limits of staking pallet
|
||||
@@ -621,10 +623,8 @@ pub const MINER_MAX_ITERATIONS: u32 = 10;
|
||||
|
||||
/// A source of random balance for NposSolver, which is meant to be run by the OCW election miner.
|
||||
pub struct OffchainRandomBalancing;
|
||||
impl frame_support::pallet_prelude::Get<Option<(usize, sp_npos_elections::ExtendedBalance)>>
|
||||
for OffchainRandomBalancing
|
||||
{
|
||||
fn get() -> Option<(usize, sp_npos_elections::ExtendedBalance)> {
|
||||
impl Get<Option<(usize, ExtendedBalance)>> for OffchainRandomBalancing {
|
||||
fn get() -> Option<(usize, ExtendedBalance)> {
|
||||
use sp_runtime::traits::TrailingZeroInput;
|
||||
let iters = match MINER_MAX_ITERATIONS {
|
||||
0 => 0,
|
||||
@@ -693,7 +693,7 @@ impl pallet_bags_list::Config for Runtime {
|
||||
type ScoreProvider = Staking;
|
||||
type WeightInfo = pallet_bags_list::weights::SubstrateWeight<Runtime>;
|
||||
type BagThresholds = BagThresholds;
|
||||
type Score = sp_npos_elections::VoteWeight;
|
||||
type Score = VoteWeight;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
Reference in New Issue
Block a user