Skip to content

Commit 926b510

Browse files
authored
Merge pull request #3533 from autonomys/migrations
add empty migrations for mainnet
2 parents df124a5 + e437f41 commit 926b510

File tree

6 files changed

+55
-1
lines changed

6 files changed

+55
-1
lines changed

crates/pallet-domains/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub mod block_tree;
1313
pub mod bundle_storage_fund;
1414
pub mod domain_registry;
1515
pub mod extensions;
16+
pub mod migrations;
1617
pub mod runtime_registry;
1718
mod staking;
1819
mod staking_epoch;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mod v1_to_v5;
2+
3+
pub use v1_to_v5::VersionCheckedMigrateDomainsV1ToV5;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Migration module for pallet-domains
2+
3+
use crate::{Config, Pallet};
4+
use core::marker::PhantomData;
5+
use frame_support::migrations::VersionedMigration;
6+
use frame_support::traits::UncheckedOnRuntimeUpgrade;
7+
use frame_support::weights::Weight;
8+
9+
pub type VersionCheckedMigrateDomainsV1ToV5<T> = VersionedMigration<
10+
1,
11+
5,
12+
VersionUncheckedMigrateV1ToV5<T>,
13+
Pallet<T>,
14+
<T as frame_system::Config>::DbWeight,
15+
>;
16+
17+
pub struct VersionUncheckedMigrateV1ToV5<T>(PhantomData<T>);
18+
impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV1ToV5<T> {
19+
fn on_runtime_upgrade() -> Weight {
20+
Weight::zero()
21+
}
22+
}

crates/subspace-runtime/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,11 @@ pub type Executive = frame_executive::Executive<
11001100
Runtime,
11011101
AllPalletsWithSystem,
11021102
// TODO: remove only after migrations are run on Mainnet
1103-
pallet_messenger::migrations::VersionCheckedMigrateDomainsV1ToV2<Runtime>,
1103+
(
1104+
pallet_domains::migrations::VersionCheckedMigrateDomainsV1ToV5<Runtime>,
1105+
pallet_messenger::migrations::VersionCheckedMigrateDomainsV0ToV1<Runtime>,
1106+
pallet_messenger::migrations::VersionCheckedMigrateDomainsV1ToV2<Runtime>,
1107+
),
11041108
>;
11051109

11061110
impl pallet_subspace::extensions::MaybeSubspaceCall<Runtime> for RuntimeCall {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
mod v0_to_v1;
12
mod v1_to_v2;
23

4+
pub use v0_to_v1::VersionCheckedMigrateDomainsV0ToV1;
35
pub(crate) use v1_to_v2::migrate_channels::{get_channel, get_open_channels};
46
pub use v1_to_v2::VersionCheckedMigrateDomainsV1ToV2;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Migration module for pallet-messenger
2+
3+
use crate::{Config, Pallet};
4+
use core::marker::PhantomData;
5+
use frame_support::migrations::VersionedMigration;
6+
use frame_support::traits::UncheckedOnRuntimeUpgrade;
7+
use frame_support::weights::Weight;
8+
9+
pub type VersionCheckedMigrateDomainsV0ToV1<T> = VersionedMigration<
10+
0,
11+
1,
12+
VersionUncheckedMigrateV0ToV1<T>,
13+
Pallet<T>,
14+
<T as frame_system::Config>::DbWeight,
15+
>;
16+
17+
pub struct VersionUncheckedMigrateV0ToV1<T>(PhantomData<T>);
18+
impl<T: Config> UncheckedOnRuntimeUpgrade for VersionUncheckedMigrateV0ToV1<T> {
19+
fn on_runtime_upgrade() -> Weight {
20+
Weight::zero()
21+
}
22+
}

0 commit comments

Comments
 (0)