Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Enable bags-list pallet in polkadot
  • Loading branch information
kianenigma committed Oct 14, 2021
commit 353a2fdcdb8cb2598b5590b99083f04dfb6b243a
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
27 changes: 3 additions & 24 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ use constants::{currency::*, fee::*, time::*};
mod weights;

// Voter bag threshold definitions.
mod voter_bags;
mod bag_thresholds;

#[cfg(test)]
mod tests;
Expand Down Expand Up @@ -412,7 +412,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 {
Expand Down Expand Up @@ -528,8 +528,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>;
}
Expand Down Expand Up @@ -1563,7 +1562,6 @@ pub type Executive = frame_executive::Executive<
TechnicalMembershipStoragePrefixMigration,
MigrateTipsPalletPrefix,
BountiesPrefixMigration,
StakingBagsListMigrationV8,
),
>;
/// The payload being signed in the transactions.
Expand Down Expand Up @@ -1718,25 +1716,6 @@ impl OnRuntimeUpgrade for MigrateTipsPalletPrefix {
}
}

// Migration to generate pallet staking's `SortedListProvider` from pre-existing nominators.
pub struct StakingBagsListMigrationV8;

impl OnRuntimeUpgrade for StakingBagsListMigrationV8 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_staking::migrations::v8::migrate::<Runtime>()
}

#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::pre_migrate::<Runtime>()
}

#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::post_migrate::<Runtime>()
}
}

#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
Expand Down
234 changes: 0 additions & 234 deletions runtime/kusama/src/voter_bags.rs

This file was deleted.

2 changes: 2 additions & 0 deletions runtime/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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 }
Expand Down Expand Up @@ -114,6 +115,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",
Expand Down
Loading