Enable bags-list pallet in polkadot (#4080)

* Enable bags-list pallet in polkadot

* add files

* Remove trailing semicolon

* more fixes

* Update runtime/polkadot/src/lib.rs

* add features

* remove par

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Kian Paimani
2021-10-25 11:18:17 +01:00
committed by GitHub
parent 182667830f
commit f9bd3c576f
13 changed files with 382 additions and 21 deletions
+2 -2
View File
@@ -37,6 +37,7 @@ sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch =
pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-bounties = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -72,7 +73,6 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
@@ -124,6 +124,7 @@ std = [
"frame-executive/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-bags-list/std",
"pallet-balances/std",
"pallet-bounties/std",
"pallet-transaction-payment/std",
@@ -175,7 +176,6 @@ std = [
"xcm-executor/std",
"xcm-builder/std",
"frame-election-provider-support/std",
"pallet-bags-list/std",
]
runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
+5 -5
View File
@@ -101,7 +101,7 @@ use constants::{currency::*, fee::*, time::*};
mod weights;
// Voter bag threshold definitions.
mod voter_bags;
mod bag_thresholds;
#[cfg(test)]
mod tests;
@@ -409,7 +409,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
}
parameter_types! {
pub const BagThresholds: &'static [u64] = &voter_bags::THRESHOLDS;
pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS;
}
impl pallet_bags_list::Config for Runtime {
@@ -525,8 +525,7 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
// Use the nominators map to iter voters, but also perform the bags-list migration and keep
// it up-to-date.
// Use the nominators map to iter voters, but also keep bags-list up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}
@@ -1079,7 +1078,8 @@ impl InstanceFilter<Call> for ProxyType {
Call::Registrar(paras_registrar::Call::reserve {..}) |
Call::Crowdloan(..) |
Call::Slots(..) |
Call::Auctions(..) // Specifically omitting the entire XCM Pallet
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
Call::BagsList(..)
),
ProxyType::Governance => matches!(
c,