Skip to content

Commit

Permalink
Release koi-6331 (#1526)
Browse files Browse the repository at this point in the history
* Add missing migration

* Release `koi-6331`

* Fix compile
  • Loading branch information
AurevoirXavier authored Jul 3, 2024
1 parent 094d6d0 commit 8b1bdb4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions runtime/common/src/migration_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ impl PalletCleaner {
}
}

pub fn migrate_identity_of<C>() -> u64
pub fn migrate_identity<C>() -> u64
where
C: ReservableCurrency<AccountId, Balance = Balance>,
{
migration::storage_iter_with_suffix::<Registration>(b"Identity", b"IdentityOf", &[])
let w = migration::clear_storage_prefix(b"AccountMigration", b"Identities", &[], None, None)
.backend;
let w1 = migration::storage_iter_with_suffix::<Registration>(b"Identity", b"IdentityOf", &[])
.drain()
.fold(0, |acc, (k, v)| {
if k.len() > 20 {
Expand All @@ -63,7 +65,9 @@ where
} else {
acc
}
})
});

(w + w1) as _
}

#[cfg_attr(test, derive(Debug, PartialEq))]
Expand Down
2 changes: 1 addition & 1 deletion runtime/crab/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn migrate() -> frame_support::weights::Weight {
maps: &[b"SuperOf", b"SubsOf", b"Registrars"],
}
.remove_all();
w += migration_helper::migrate_identity_of::<pallet_balances::Pallet<Runtime>>();
w += migration_helper::migrate_identity::<pallet_balances::Pallet<Runtime>>();

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(0, w)
Expand Down
2 changes: 1 addition & 1 deletion runtime/darwinia/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn migrate() -> frame_support::weights::Weight {
maps: &[b"SuperOf", b"SubsOf", b"Registrars"],
}
.remove_all();
w += migration_helper::migrate_identity_of::<pallet_balances::Pallet<Runtime>>();
w += migration_helper::migrate_identity::<pallet_balances::Pallet<Runtime>>();

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, w)
Expand Down
2 changes: 1 addition & 1 deletion runtime/koi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Darwinia Koi"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_6_3_0,
spec_version: 6_6_3_1,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down
2 changes: 1 addition & 1 deletion runtime/koi/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn migrate() -> frame_support::weights::Weight {
maps: &[b"SuperOf", b"SubsOf", b"Registrars"],
}
.remove_all();
w += migration_helper::migrate_identity_of::<pallet_balances::Pallet<Runtime>>();
w += migration_helper::migrate_identity::<pallet_balances::Pallet<Runtime>>();

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(2, w)
Expand Down

0 comments on commit 8b1bdb4

Please sign in to comment.