Skip to content

Commit 1a650d3

Browse files
committed
Remove StateTrieMigration pallet - V0→V1 migration complete
The state trie migration from V0 to V1 format has been completed on: - Polkadot relay chain (2,192,421 top items + 10,423 child items) - Asset Hub Polkadot (5,448,606 top items) - Asset Hub Kusama (288,016 top items) This PR removes the pallet-state-trie-migration from these runtimes and adds RemovePallet migrations to clean up the storage. Closes #74 (for Polkadot ecosystem chains)
1 parent 7e81390 commit 1a650d3

File tree

8 files changed

+32
-147
lines changed

8 files changed

+32
-147
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
### Removed
10+
11+
- Remove StateTrieMigration pallet from Polkadot relay chain, Asset Hub Polkadot, and Asset Hub Kusama - V0→V1 state trie migration complete ([polkadot-fellows/runtimes#XXX](https://github.com/polkadot-fellows/runtimes/pull/XXX))
12+
913
### Changed
1014

1115
- Apply patch for stable2409-6 ([polkadot-fellows/runtimes/pull/623](https://github.com/polkadot-fellows/runtimes/pull/623))

Cargo.lock

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

relay/polkadot/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pallet-staking = { workspace = true }
7272
pallet-staking-reward-fn = { workspace = true }
7373
pallet-staking-reward-curve = { workspace = true }
7474
pallet-staking-runtime-api = { workspace = true }
75-
pallet-state-trie-migration = { workspace = true }
7675
frame-system = { workspace = true }
7776
frame-system-rpc-runtime-api = { workspace = true }
7877
polkadot-runtime-constants = { workspace = true }
@@ -178,7 +177,6 @@ std = [
178177
"pallet-staking-reward-fn/std",
179178
"pallet-staking-runtime-api/std",
180179
"pallet-staking/std",
181-
"pallet-state-trie-migration/std",
182180
"pallet-timestamp/std",
183181
"pallet-transaction-payment-rpc-runtime-api/std",
184182
"pallet-transaction-payment/std",
@@ -256,7 +254,6 @@ runtime-benchmarks = [
256254
"pallet-scheduler/runtime-benchmarks",
257255
"pallet-session-benchmarking/runtime-benchmarks",
258256
"pallet-staking/runtime-benchmarks",
259-
"pallet-state-trie-migration/runtime-benchmarks",
260257
"pallet-timestamp/runtime-benchmarks",
261258
"pallet-treasury/runtime-benchmarks",
262259
"pallet-utility/runtime-benchmarks",
@@ -310,7 +307,6 @@ try-runtime = [
310307
"pallet-scheduler/try-runtime",
311308
"pallet-session/try-runtime",
312309
"pallet-staking/try-runtime",
313-
"pallet-state-trie-migration/try-runtime",
314310
"pallet-timestamp/try-runtime",
315311
"pallet-transaction-payment/try-runtime",
316312
"pallet-treasury/try-runtime",

relay/polkadot/src/lib.rs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,27 +1454,6 @@ impl pallet_delegated_staking::Config for Runtime {
14541454
type CoreStaking = Staking;
14551455
}
14561456

1457-
parameter_types! {
1458-
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
1459-
pub const MigrationSignedDepositPerItem: Balance = CENTS;
1460-
pub const MigrationSignedDepositBase: Balance = 20 * CENTS * 100;
1461-
pub const MigrationMaxKeyLen: u32 = 512;
1462-
}
1463-
1464-
impl pallet_state_trie_migration::Config for Runtime {
1465-
type RuntimeHoldReason = RuntimeHoldReason;
1466-
type RuntimeEvent = RuntimeEvent;
1467-
type Currency = Balances;
1468-
type SignedDepositPerItem = MigrationSignedDepositPerItem;
1469-
type SignedDepositBase = MigrationSignedDepositBase;
1470-
type ControlOrigin = EnsureRoot<AccountId>;
1471-
type SignedFilter = frame_support::traits::NeverEnsureOrigin<AccountId>;
1472-
1473-
// Use same weights as substrate ones.
1474-
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
1475-
type MaxKeyLen = MigrationMaxKeyLen;
1476-
}
1477-
14781457
/// The [frame_support::traits::tokens::ConversionFromAssetBalance] implementation provided by the
14791458
/// `AssetRate` pallet instance.
14801459
///
@@ -1603,9 +1582,6 @@ construct_runtime! {
16031582
Crowdloan: crowdloan = 73,
16041583
Coretime: coretime = 74,
16051584

1606-
// State trie migration pallet, only temporary.
1607-
StateTrieMigration: pallet_state_trie_migration = 98,
1608-
16091585
// Pallet for sending XCM.
16101586
XcmPallet: pallet_xcm = 99,
16111587

@@ -1659,8 +1635,17 @@ pub type Migrations = (migrations::Unreleased, migrations::Permanent);
16591635
pub mod migrations {
16601636
use super::*;
16611637

1638+
parameter_types! {
1639+
pub const StateTrieMigrationPalletName: &'static str = "StateTrieMigration";
1640+
}
1641+
16621642
/// Unreleased migrations. Add new ones here:
1663-
pub type Unreleased = ();
1643+
pub type Unreleased = (
1644+
frame_support::migrations::RemovePallet<
1645+
StateTrieMigrationPalletName,
1646+
<Runtime as frame_system::Config>::DbWeight,
1647+
>,
1648+
);
16641649

16651650
/// Migrations/checks that do not need to be versioned and can run on every update.
16661651
pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,);

system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pallet-nfts = { workspace = true }
4545
pallet-nfts-runtime-api = { workspace = true }
4646
pallet-proxy = { workspace = true }
4747
pallet-session = { workspace = true }
48-
pallet-state-trie-migration = { workspace = true }
4948
pallet-timestamp = { workspace = true }
5049
pallet-transaction-payment = { workspace = true }
5150
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
@@ -135,7 +134,6 @@ runtime-benchmarks = [
135134
"pallet-nfts/runtime-benchmarks",
136135
"pallet-proxy/runtime-benchmarks",
137136
"pallet-remote-proxy/runtime-benchmarks",
138-
"pallet-state-trie-migration/runtime-benchmarks",
139137
"pallet-timestamp/runtime-benchmarks",
140138
"pallet-uniques/runtime-benchmarks",
141139
"pallet-utility/runtime-benchmarks",
@@ -176,7 +174,6 @@ try-runtime = [
176174
"pallet-proxy/try-runtime",
177175
"pallet-remote-proxy/try-runtime",
178176
"pallet-session/try-runtime",
179-
"pallet-state-trie-migration/try-runtime",
180177
"pallet-timestamp/try-runtime",
181178
"pallet-transaction-payment/try-runtime",
182179
"pallet-uniques/try-runtime",
@@ -228,7 +225,6 @@ std = [
228225
"pallet-proxy/std",
229226
"pallet-remote-proxy/std",
230227
"pallet-session/std",
231-
"pallet-state-trie-migration/std",
232228
"pallet-timestamp/std",
233229
"pallet-transaction-payment-rpc-runtime-api/std",
234230
"pallet-transaction-payment/std",

system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,9 +1049,6 @@ construct_runtime!(
10491049

10501050
PoolAssets: pallet_assets::<Instance3> = 55,
10511051
AssetConversion: pallet_asset_conversion = 56,
1052-
1053-
// State trie migration pallet, only temporary.
1054-
StateTrieMigration: pallet_state_trie_migration = 70,
10551052
}
10561053
);
10571054

@@ -1079,8 +1076,17 @@ pub type SignedExtra = (
10791076
pub type UncheckedExtrinsic =
10801077
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
10811078

1079+
parameter_types! {
1080+
pub const StateTrieMigrationPalletName: &'static str = "StateTrieMigration";
1081+
}
1082+
10821083
/// Migrations to apply on runtime upgrade.
10831084
pub type Migrations = (
1085+
// Remove StateTrieMigration pallet storage - migration complete
1086+
frame_support::migrations::RemovePallet<
1087+
StateTrieMigrationPalletName,
1088+
<Runtime as frame_system::Config>::DbWeight,
1089+
>,
10841090
// permanent
10851091
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
10861092
);
@@ -1773,39 +1779,6 @@ cumulus_pallet_parachain_system::register_validate_block! {
17731779
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
17741780
}
17751781

1776-
parameter_types! {
1777-
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
1778-
pub const MigrationSignedDepositPerItem: Balance = CENTS;
1779-
pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS;
1780-
pub const MigrationMaxKeyLen: u32 = 512;
1781-
}
1782-
1783-
impl pallet_state_trie_migration::Config for Runtime {
1784-
type RuntimeEvent = RuntimeEvent;
1785-
type Currency = Balances;
1786-
type RuntimeHoldReason = RuntimeHoldReason;
1787-
type SignedDepositPerItem = MigrationSignedDepositPerItem;
1788-
type SignedDepositBase = MigrationSignedDepositBase;
1789-
// An origin that can control the whole pallet: Should be a Fellowship member or the controller
1790-
// of the migration.
1791-
type ControlOrigin = EitherOfDiverse<
1792-
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
1793-
EnsureSignedBy<MigControllerRoot, AccountId>,
1794-
>;
1795-
type SignedFilter = EnsureSignedBy<MigController, AccountId>;
1796-
1797-
// Replace this with weight based on your runtime.
1798-
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
1799-
1800-
type MaxKeyLen = MigrationMaxKeyLen;
1801-
}
1802-
// Statemint State Migration Controller account controlled by parity.io. Can trigger migration.
1803-
// See bot code https://github.com/paritytech/polkadot-scripts/blob/master/src/services/state_trie_migration.ts
1804-
ord_parameter_types! {
1805-
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
1806-
pub const MigControllerRoot: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
1807-
}
1808-
18091782
#[cfg(test)]
18101783
mod tests {
18111784
use super::*;
@@ -1879,13 +1852,4 @@ mod tests {
18791852
ForeignAssetsAssetDeposit::get()
18801853
);
18811854
}
1882-
1883-
#[test]
1884-
fn ensure_key_ss58() {
1885-
use frame_support::traits::SortedMembers;
1886-
use sp_core::crypto::Ss58Codec;
1887-
let acc =
1888-
AccountId::from_ss58check("5F4EbSkZz18X36xhbsjvDNs6NuZ82HyYtq5UiJ1h9SBHJXZD").unwrap();
1889-
assert_eq!(acc, MigController::sorted_members()[0]);
1890-
}
18911855
}

system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pallet-nfts = { workspace = true }
4545
pallet-nfts-runtime-api = { workspace = true }
4646
pallet-proxy = { workspace = true }
4747
pallet-session = { workspace = true }
48-
pallet-state-trie-migration = { workspace = true }
4948
pallet-timestamp = { workspace = true }
5049
pallet-transaction-payment = { workspace = true }
5150
pallet-transaction-payment-rpc-runtime-api = { workspace = true }
@@ -133,7 +132,6 @@ runtime-benchmarks = [
133132
"pallet-multisig/runtime-benchmarks",
134133
"pallet-nfts/runtime-benchmarks",
135134
"pallet-proxy/runtime-benchmarks",
136-
"pallet-state-trie-migration/runtime-benchmarks",
137135
"pallet-timestamp/runtime-benchmarks",
138136
"pallet-uniques/runtime-benchmarks",
139137
"pallet-utility/runtime-benchmarks",
@@ -173,7 +171,6 @@ try-runtime = [
173171
"pallet-nfts/try-runtime",
174172
"pallet-proxy/try-runtime",
175173
"pallet-session/try-runtime",
176-
"pallet-state-trie-migration/try-runtime",
177174
"pallet-timestamp/try-runtime",
178175
"pallet-transaction-payment/try-runtime",
179176
"pallet-uniques/try-runtime",
@@ -223,7 +220,6 @@ std = [
223220
"pallet-nfts/std",
224221
"pallet-proxy/std",
225222
"pallet-session/std",
226-
"pallet-state-trie-migration/std",
227223
"pallet-timestamp/std",
228224
"pallet-transaction-payment-rpc-runtime-api/std",
229225
"pallet-transaction-payment/std",

system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,9 +1008,6 @@ construct_runtime!(
10081008
ForeignAssets: pallet_assets::<Instance2> = 53,
10091009
PoolAssets: pallet_assets::<Instance3> = 54,
10101010
AssetConversion: pallet_asset_conversion = 55,
1011-
1012-
// State trie migration pallet, only temporary.
1013-
StateTrieMigration: pallet_state_trie_migration = 70,
10141011
}
10151012
);
10161013

@@ -1038,8 +1035,17 @@ pub type SignedExtra = (
10381035
pub type UncheckedExtrinsic =
10391036
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
10401037

1038+
parameter_types! {
1039+
pub const StateTrieMigrationPalletName: &'static str = "StateTrieMigration";
1040+
}
1041+
10411042
/// Migrations to apply on runtime upgrade.
10421043
pub type Migrations = (
1044+
// Remove StateTrieMigration pallet storage - migration complete
1045+
frame_support::migrations::RemovePallet<
1046+
StateTrieMigrationPalletName,
1047+
<Runtime as frame_system::Config>::DbWeight,
1048+
>,
10431049
// permanent
10441050
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
10451051
);
@@ -1752,39 +1758,6 @@ cumulus_pallet_parachain_system::register_validate_block! {
17521758
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
17531759
}
17541760

1755-
parameter_types! {
1756-
// The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high)
1757-
pub const MigrationSignedDepositPerItem: Balance = CENTS;
1758-
pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS;
1759-
pub const MigrationMaxKeyLen: u32 = 512;
1760-
}
1761-
1762-
impl pallet_state_trie_migration::Config for Runtime {
1763-
type RuntimeEvent = RuntimeEvent;
1764-
type Currency = Balances;
1765-
type RuntimeHoldReason = RuntimeHoldReason;
1766-
type SignedDepositPerItem = MigrationSignedDepositPerItem;
1767-
type SignedDepositBase = MigrationSignedDepositBase;
1768-
// An origin that can control the whole pallet: Should be a Fellowship member or the controller
1769-
// of the migration.
1770-
type ControlOrigin = EitherOfDiverse<
1771-
EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
1772-
EnsureSignedBy<MigControllerRoot, AccountId>,
1773-
>;
1774-
type SignedFilter = EnsureSignedBy<MigController, AccountId>;
1775-
1776-
// Replace this with weight based on your runtime.
1777-
type WeightInfo = pallet_state_trie_migration::weights::SubstrateWeight<Runtime>;
1778-
1779-
type MaxKeyLen = MigrationMaxKeyLen;
1780-
}
1781-
// Statemint State Migration Controller account controlled by parity.io. Can trigger migration.
1782-
// See bot code https://github.com/paritytech/polkadot-scripts/blob/master/src/services/state_trie_migration.ts
1783-
ord_parameter_types! {
1784-
pub const MigController: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
1785-
pub const MigControllerRoot: AccountId = AccountId::from(hex_literal::hex!("8458ed39dc4b6f6c7255f7bc42be50c2967db126357c999d44e12ca7ac80dc52"));
1786-
}
1787-
17881761
#[cfg(test)]
17891762
mod tests {
17901763
use super::*;
@@ -1858,13 +1831,4 @@ mod tests {
18581831
ForeignAssetsAssetDeposit::get()
18591832
);
18601833
}
1861-
1862-
#[test]
1863-
fn ensure_key_ss58() {
1864-
use frame_support::traits::SortedMembers;
1865-
use sp_core::crypto::Ss58Codec;
1866-
let acc =
1867-
AccountId::from_ss58check("5F4EbSkZz18X36xhbsjvDNs6NuZ82HyYtq5UiJ1h9SBHJXZD").unwrap();
1868-
assert_eq!(acc, MigController::sorted_members()[0]);
1869-
}
18701834
}

0 commit comments

Comments
 (0)