mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 18:51:12 +00:00
Adding migrations to clean Rococo Gov 1 storage & reserved funds (#1849)
Following [polkadot#7314](https://github.com/paritytech/polkadot/pull/7314) and after merging https://github.com/paritytech/polkadot-sdk/pull/1177 this PR solves https://github.com/paritytech/polkadot-sdk/issues/1618 The following is a summary of the outcome of the migration. | Module | Total Accounts | Total stake to unlock | Total deposit to unreserve | | ------- | --------------- | --------------------- | -------------------------- | | Elections Phragmen | 27 | 1,132.821063320441 ROC | 1.465386531600 ROC | | Democracy | 69 | 2733.923509345613 ROC | 0.166666665000 ROC | | Tips | 4 | N/A | 0.015099999849 ROC | The migrations will also remove the following amount of keys 103 Democracy keys 🧹 5 Council keys 🧹 1 TechnicalCommittee keys 🧹 25 PhragmenElection keys 🧹 1 TechnicalMembership keys 🧹 9 Tips keys 🧹
This commit is contained in:
committed by
GitHub
parent
38ef04eb53
commit
86fde367c0
@@ -1414,6 +1414,52 @@ pub type Migrations = migrations::Unreleased;
|
||||
pub mod migrations {
|
||||
use super::*;
|
||||
|
||||
use frame_support::traits::LockIdentifier;
|
||||
use frame_system::pallet_prelude::BlockNumberFor;
|
||||
|
||||
parameter_types! {
|
||||
pub const DemocracyPalletName: &'static str = "Democracy";
|
||||
pub const CouncilPalletName: &'static str = "Council";
|
||||
pub const TechnicalCommitteePalletName: &'static str = "TechnicalCommittee";
|
||||
pub const PhragmenElectionPalletName: &'static str = "PhragmenElection";
|
||||
pub const TechnicalMembershipPalletName: &'static str = "TechnicalMembership";
|
||||
pub const TipsPalletName: &'static str = "Tips";
|
||||
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
|
||||
}
|
||||
|
||||
// Special Config for Gov V1 pallets, allowing us to run migrations for them without
|
||||
// implementing their configs on [`Runtime`].
|
||||
pub struct UnlockConfig;
|
||||
impl pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockConfig for UnlockConfig {
|
||||
type Currency = Balances;
|
||||
type MaxVotes = ConstU32<100>;
|
||||
type MaxDeposits = ConstU32<100>;
|
||||
type AccountId = AccountId;
|
||||
type BlockNumber = BlockNumberFor<Runtime>;
|
||||
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
|
||||
type PalletName = DemocracyPalletName;
|
||||
}
|
||||
impl pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockConfig
|
||||
for UnlockConfig
|
||||
{
|
||||
type Currency = Balances;
|
||||
type MaxVotesPerVoter = ConstU32<16>;
|
||||
type PalletId = PhragmenElectionPalletId;
|
||||
type AccountId = AccountId;
|
||||
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
|
||||
type PalletName = PhragmenElectionPalletName;
|
||||
}
|
||||
impl pallet_tips::migrations::unreserve_deposits::UnlockConfig<()> for UnlockConfig {
|
||||
type Currency = Balances;
|
||||
type Hash = Hash;
|
||||
type DataDepositPerByte = DataDepositPerByte;
|
||||
type TipReportDepositBase = TipReportDepositBase;
|
||||
type AccountId = AccountId;
|
||||
type BlockNumber = BlockNumberFor<Runtime>;
|
||||
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
|
||||
type PalletName = TipsPalletName;
|
||||
}
|
||||
|
||||
/// Unreleased migrations. Add new ones here:
|
||||
pub type Unreleased = (
|
||||
pallet_society::migrations::VersionCheckedMigrateToV2<Runtime, (), ()>,
|
||||
@@ -1426,6 +1472,21 @@ pub mod migrations {
|
||||
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ()>,
|
||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
|
||||
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, pallet_referenda::Instance2>,
|
||||
|
||||
// Unlock & unreserve Gov1 funds
|
||||
|
||||
pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
|
||||
pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
|
||||
pallet_tips::migrations::unreserve_deposits::UnreserveDeposits<UnlockConfig, ()>,
|
||||
|
||||
// Delete all Gov v1 pallet storage key/values.
|
||||
|
||||
frame_support::migrations::RemovePallet<DemocracyPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
frame_support::migrations::RemovePallet<CouncilPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
frame_support::migrations::RemovePallet<TechnicalCommitteePalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
frame_support::migrations::RemovePallet<PhragmenElectionPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
frame_support::migrations::RemovePallet<TechnicalMembershipPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user