Skip to content

Commit 86fde36

Browse files
authored
Adding migrations to clean Rococo Gov 1 storage & reserved funds (#1849)
Following [polkadot#7314](paritytech/polkadot#7314) and after merging #1177 this PR solves #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 🧹
1 parent 38ef04e commit 86fde36

File tree

1 file changed

+61
-0
lines changed
  • polkadot/runtime/rococo/src

1 file changed

+61
-0
lines changed

polkadot/runtime/rococo/src/lib.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,52 @@ pub type Migrations = migrations::Unreleased;
14141414
pub mod migrations {
14151415
use super::*;
14161416

1417+
use frame_support::traits::LockIdentifier;
1418+
use frame_system::pallet_prelude::BlockNumberFor;
1419+
1420+
parameter_types! {
1421+
pub const DemocracyPalletName: &'static str = "Democracy";
1422+
pub const CouncilPalletName: &'static str = "Council";
1423+
pub const TechnicalCommitteePalletName: &'static str = "TechnicalCommittee";
1424+
pub const PhragmenElectionPalletName: &'static str = "PhragmenElection";
1425+
pub const TechnicalMembershipPalletName: &'static str = "TechnicalMembership";
1426+
pub const TipsPalletName: &'static str = "Tips";
1427+
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
1428+
}
1429+
1430+
// Special Config for Gov V1 pallets, allowing us to run migrations for them without
1431+
// implementing their configs on [`Runtime`].
1432+
pub struct UnlockConfig;
1433+
impl pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockConfig for UnlockConfig {
1434+
type Currency = Balances;
1435+
type MaxVotes = ConstU32<100>;
1436+
type MaxDeposits = ConstU32<100>;
1437+
type AccountId = AccountId;
1438+
type BlockNumber = BlockNumberFor<Runtime>;
1439+
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1440+
type PalletName = DemocracyPalletName;
1441+
}
1442+
impl pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockConfig
1443+
for UnlockConfig
1444+
{
1445+
type Currency = Balances;
1446+
type MaxVotesPerVoter = ConstU32<16>;
1447+
type PalletId = PhragmenElectionPalletId;
1448+
type AccountId = AccountId;
1449+
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1450+
type PalletName = PhragmenElectionPalletName;
1451+
}
1452+
impl pallet_tips::migrations::unreserve_deposits::UnlockConfig<()> for UnlockConfig {
1453+
type Currency = Balances;
1454+
type Hash = Hash;
1455+
type DataDepositPerByte = DataDepositPerByte;
1456+
type TipReportDepositBase = TipReportDepositBase;
1457+
type AccountId = AccountId;
1458+
type BlockNumber = BlockNumberFor<Runtime>;
1459+
type DbWeight = <Runtime as frame_system::Config>::DbWeight;
1460+
type PalletName = TipsPalletName;
1461+
}
1462+
14171463
/// Unreleased migrations. Add new ones here:
14181464
pub type Unreleased = (
14191465
pallet_society::migrations::VersionCheckedMigrateToV2<Runtime, (), ()>,
@@ -1426,6 +1472,21 @@ pub mod migrations {
14261472
paras_registrar::migration::VersionCheckedMigrateToV1<Runtime, ()>,
14271473
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, ()>,
14281474
pallet_referenda::migration::v1::MigrateV0ToV1<Runtime, pallet_referenda::Instance2>,
1475+
1476+
// Unlock & unreserve Gov1 funds
1477+
1478+
pallet_elections_phragmen::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
1479+
pallet_democracy::migrations::unlock_and_unreserve_all_funds::UnlockAndUnreserveAllFunds<UnlockConfig>,
1480+
pallet_tips::migrations::unreserve_deposits::UnreserveDeposits<UnlockConfig, ()>,
1481+
1482+
// Delete all Gov v1 pallet storage key/values.
1483+
1484+
frame_support::migrations::RemovePallet<DemocracyPalletName, <Runtime as frame_system::Config>::DbWeight>,
1485+
frame_support::migrations::RemovePallet<CouncilPalletName, <Runtime as frame_system::Config>::DbWeight>,
1486+
frame_support::migrations::RemovePallet<TechnicalCommitteePalletName, <Runtime as frame_system::Config>::DbWeight>,
1487+
frame_support::migrations::RemovePallet<PhragmenElectionPalletName, <Runtime as frame_system::Config>::DbWeight>,
1488+
frame_support::migrations::RemovePallet<TechnicalMembershipPalletName, <Runtime as frame_system::Config>::DbWeight>,
1489+
frame_support::migrations::RemovePallet<TipsPalletName, <Runtime as frame_system::Config>::DbWeight>,
14291490
);
14301491
}
14311492

0 commit comments

Comments
 (0)