mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Rename BagsList to VoterList and Add Score (#5463)
* add migration for simple pallet rename
* fmt
* also add score migration
* add try-runtime feature to bags list
* add pre_upgrade to pallet rename
* update lockfile for {"substrate"}
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+172
-172
File diff suppressed because it is too large
Load Diff
@@ -241,6 +241,7 @@ try-runtime = [
|
|||||||
"pallet-authority-discovery/try-runtime",
|
"pallet-authority-discovery/try-runtime",
|
||||||
"pallet-authorship/try-runtime",
|
"pallet-authorship/try-runtime",
|
||||||
"pallet-balances/try-runtime",
|
"pallet-balances/try-runtime",
|
||||||
|
"pallet-bags-list/try-runtime",
|
||||||
"pallet-bounties/try-runtime",
|
"pallet-bounties/try-runtime",
|
||||||
"pallet-child-bounties/try-runtime",
|
"pallet-child-bounties/try-runtime",
|
||||||
"pallet-transaction-payment/try-runtime",
|
"pallet-transaction-payment/try-runtime",
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type NextNewSession = Session;
|
type NextNewSession = Session;
|
||||||
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
|
||||||
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
|
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
|
||||||
type VoterList = BagsList;
|
type VoterList = VoterList;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
type OnStakerSlash = ();
|
type OnStakerSlash = ();
|
||||||
@@ -1194,7 +1194,7 @@ impl InstanceFilter<Call> for ProxyType {
|
|||||||
Call::Crowdloan(..) |
|
Call::Crowdloan(..) |
|
||||||
Call::Slots(..) |
|
Call::Slots(..) |
|
||||||
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
||||||
Call::BagsList(..)
|
Call::VoterList(..)
|
||||||
),
|
),
|
||||||
ProxyType::Governance => matches!(
|
ProxyType::Governance => matches!(
|
||||||
c,
|
c,
|
||||||
@@ -1563,7 +1563,7 @@ construct_runtime! {
|
|||||||
Gilt: pallet_gilt::{Pallet, Call, Storage, Event<T>, Config} = 38,
|
Gilt: pallet_gilt::{Pallet, Call, Storage, Event<T>, Config} = 38,
|
||||||
|
|
||||||
// Provides a semi-sorted list of nominators for staking.
|
// Provides a semi-sorted list of nominators for staking.
|
||||||
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 39,
|
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 39,
|
||||||
|
|
||||||
// nomination pools: extension to staking.
|
// nomination pools: extension to staking.
|
||||||
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
|
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
|
||||||
@@ -1624,11 +1624,30 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
|
(
|
||||||
|
RenameBagsListToVoterList,
|
||||||
|
pallet_bags_list::migrations::AddScore<Runtime>,
|
||||||
InitiatePoolConfigs,
|
InitiatePoolConfigs,
|
||||||
|
),
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in the transactions.
|
/// The payload being signed in the transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
|
|
||||||
|
/// A migration which renames the pallet `BagsList` to `VoterList`
|
||||||
|
pub struct RenameBagsListToVoterList;
|
||||||
|
impl frame_support::traits::OnRuntimeUpgrade for RenameBagsListToVoterList {
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn pre_upgrade() -> Result<(), &'static str> {
|
||||||
|
// For other pre-upgrade checks, we need the storage to already be migrated.
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
frame_support::weights::Weight::MAX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate frame_benchmarking;
|
extern crate frame_benchmarking;
|
||||||
@@ -1653,7 +1672,7 @@ mod benches {
|
|||||||
[runtime_parachains::ump, Ump]
|
[runtime_parachains::ump, Ump]
|
||||||
// Substrate
|
// Substrate
|
||||||
[pallet_balances, Balances]
|
[pallet_balances, Balances]
|
||||||
[pallet_bags_list, BagsList]
|
[pallet_bags_list, VoterList]
|
||||||
[frame_benchmarking::baseline, Baseline::<Runtime>]
|
[frame_benchmarking::baseline, Baseline::<Runtime>]
|
||||||
[pallet_bounties, Bounties]
|
[pallet_bounties, Bounties]
|
||||||
[pallet_child_bounties, ChildBounties]
|
[pallet_child_bounties, ChildBounties]
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ try-runtime = [
|
|||||||
"pallet-authority-discovery/try-runtime",
|
"pallet-authority-discovery/try-runtime",
|
||||||
"pallet-authorship/try-runtime",
|
"pallet-authorship/try-runtime",
|
||||||
"pallet-balances/try-runtime",
|
"pallet-balances/try-runtime",
|
||||||
|
"pallet-bags-list/try-runtime",
|
||||||
"pallet-bounties/try-runtime",
|
"pallet-bounties/try-runtime",
|
||||||
"pallet-child-bounties/try-runtime",
|
"pallet-child-bounties/try-runtime",
|
||||||
"pallet-transaction-payment/try-runtime",
|
"pallet-transaction-payment/try-runtime",
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ impl Contains<Call> for BaseFilter {
|
|||||||
Call::Registrar(_) |
|
Call::Registrar(_) |
|
||||||
Call::Auctions(_) |
|
Call::Auctions(_) |
|
||||||
Call::Crowdloan(_) |
|
Call::Crowdloan(_) |
|
||||||
Call::BagsList(_) |
|
Call::VoterList(_) |
|
||||||
Call::XcmPallet(_) => true,
|
Call::XcmPallet(_) => true,
|
||||||
// All pallets are allowed, but exhaustive match is defensive
|
// All pallets are allowed, but exhaustive match is defensive
|
||||||
// in the case of adding new pallets.
|
// in the case of adding new pallets.
|
||||||
@@ -608,7 +608,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type NextNewSession = Session;
|
type NextNewSession = Session;
|
||||||
type ElectionProvider = ElectionProviderMultiPhase;
|
type ElectionProvider = ElectionProviderMultiPhase;
|
||||||
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
|
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
|
||||||
type VoterList = BagsList;
|
type VoterList = VoterList;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
type OnStakerSlash = ();
|
type OnStakerSlash = ();
|
||||||
@@ -1177,7 +1177,7 @@ impl InstanceFilter<Call> for ProxyType {
|
|||||||
Call::Crowdloan(..) |
|
Call::Crowdloan(..) |
|
||||||
Call::Slots(..) |
|
Call::Slots(..) |
|
||||||
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
||||||
Call::BagsList(..)
|
Call::VoterList(..)
|
||||||
),
|
),
|
||||||
ProxyType::Governance => matches!(
|
ProxyType::Governance => matches!(
|
||||||
c,
|
c,
|
||||||
@@ -1453,7 +1453,7 @@ construct_runtime! {
|
|||||||
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 36,
|
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 36,
|
||||||
|
|
||||||
// Provides a semi-sorted list of nominators for staking.
|
// Provides a semi-sorted list of nominators for staking.
|
||||||
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 37,
|
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 37,
|
||||||
|
|
||||||
// Parachains pallets. Start indices at 50 to leave room.
|
// Parachains pallets. Start indices at 50 to leave room.
|
||||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
||||||
@@ -1512,11 +1512,26 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
(RenameBagsListToVoterList, pallet_bags_list::migrations::AddScore<Runtime>),
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
|
|
||||||
|
/// A migration which renames the pallet `BagsList` to `VoterList`
|
||||||
|
pub struct RenameBagsListToVoterList;
|
||||||
|
impl frame_support::traits::OnRuntimeUpgrade for RenameBagsListToVoterList {
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn pre_upgrade() -> Result<(), &'static str> {
|
||||||
|
// For other pre-upgrade checks, we need the storage to already be migrated.
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
frame_support::weights::Weight::MAX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate frame_benchmarking;
|
extern crate frame_benchmarking;
|
||||||
@@ -1539,7 +1554,7 @@ mod benches {
|
|||||||
[runtime_parachains::paras_inherent, ParaInherent]
|
[runtime_parachains::paras_inherent, ParaInherent]
|
||||||
[runtime_parachains::ump, Ump]
|
[runtime_parachains::ump, Ump]
|
||||||
// Substrate
|
// Substrate
|
||||||
[pallet_bags_list, BagsList]
|
[pallet_bags_list, VoterList]
|
||||||
[pallet_balances, Balances]
|
[pallet_balances, Balances]
|
||||||
[frame_benchmarking::baseline, Baseline::<Runtime>]
|
[frame_benchmarking::baseline, Baseline::<Runtime>]
|
||||||
[pallet_bounties, Bounties]
|
[pallet_bounties, Bounties]
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ try-runtime = [
|
|||||||
"pallet-authorship/try-runtime",
|
"pallet-authorship/try-runtime",
|
||||||
"pallet-authority-discovery/try-runtime",
|
"pallet-authority-discovery/try-runtime",
|
||||||
"pallet-balances/try-runtime",
|
"pallet-balances/try-runtime",
|
||||||
|
"pallet-bags-list/try-runtime",
|
||||||
"pallet-transaction-payment/try-runtime",
|
"pallet-transaction-payment/try-runtime",
|
||||||
"pallet-collective/try-runtime",
|
"pallet-collective/try-runtime",
|
||||||
"pallet-elections-phragmen/try-runtime",
|
"pallet-elections-phragmen/try-runtime",
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type NextNewSession = Session;
|
type NextNewSession = Session;
|
||||||
type ElectionProvider = ElectionProviderMultiPhase;
|
type ElectionProvider = ElectionProviderMultiPhase;
|
||||||
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
|
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
|
||||||
type VoterList = BagsList;
|
type VoterList = VoterList;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
type OnStakerSlash = ();
|
type OnStakerSlash = ();
|
||||||
@@ -792,7 +792,7 @@ impl InstanceFilter<Call> for ProxyType {
|
|||||||
Call::Crowdloan(..) |
|
Call::Crowdloan(..) |
|
||||||
Call::Slots(..) |
|
Call::Slots(..) |
|
||||||
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
||||||
Call::BagsList(..) |
|
Call::VoterList(..) |
|
||||||
Call::NominationPools(..)
|
Call::NominationPools(..)
|
||||||
),
|
),
|
||||||
ProxyType::Staking => {
|
ProxyType::Staking => {
|
||||||
@@ -1098,7 +1098,7 @@ construct_runtime! {
|
|||||||
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 24,
|
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 24,
|
||||||
|
|
||||||
// Provides a semi-sorted list of nominators for staking.
|
// Provides a semi-sorted list of nominators for staking.
|
||||||
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 25,
|
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 25,
|
||||||
|
|
||||||
// Nomination pools for staking.
|
// Nomination pools for staking.
|
||||||
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 29,
|
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 29,
|
||||||
@@ -1161,11 +1161,26 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
(),
|
(RenameBagsListToVoterList, pallet_bags_list::migrations::AddScore<Runtime>),
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
|
|
||||||
|
/// A migration which renames the pallet `BagsList` to `VoterList`
|
||||||
|
pub struct RenameBagsListToVoterList;
|
||||||
|
impl frame_support::traits::OnRuntimeUpgrade for RenameBagsListToVoterList {
|
||||||
|
#[cfg(feature = "try-runtime")]
|
||||||
|
fn pre_upgrade() -> Result<(), &'static str> {
|
||||||
|
// For other pre-upgrade checks, we need the storage to already be migrated.
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
|
frame_support::storage::migration::move_pallet(b"BagsList", b"VoterList");
|
||||||
|
frame_support::weights::Weight::MAX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate frame_benchmarking;
|
extern crate frame_benchmarking;
|
||||||
@@ -1188,7 +1203,7 @@ mod benches {
|
|||||||
[runtime_parachains::paras_inherent, ParaInherent]
|
[runtime_parachains::paras_inherent, ParaInherent]
|
||||||
[runtime_parachains::ump, Ump]
|
[runtime_parachains::ump, Ump]
|
||||||
// Substrate
|
// Substrate
|
||||||
[pallet_bags_list, BagsList]
|
[pallet_bags_list, VoterList]
|
||||||
[pallet_balances, Balances]
|
[pallet_balances, Balances]
|
||||||
[pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
|
[pallet_election_provider_multi_phase, ElectionProviderMultiPhase]
|
||||||
[frame_election_provider_support, ElectionProviderBench::<Runtime>]
|
[frame_election_provider_support, ElectionProviderBench::<Runtime>]
|
||||||
|
|||||||
Reference in New Issue
Block a user