Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
(
migration::CustomOnRuntimeUpgrade,
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
),
migration::CustomOnRuntimeUpgrade,
>;

/// Runtime version.
Expand Down
18 changes: 16 additions & 2 deletions runtime/crab/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use crate::*;
// polkadot-sdk
#[allow(unused_imports)]
use frame_support::{migration, storage::unhashed};
use frame_support::migration;

pub struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
Expand All @@ -36,6 +36,11 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
log::info!("post");

assert!(Balances::locks(AccountId::from(
<[u8; 20]>::dehexify("0x3d6a81177e17d5dbbd36f23ea5328acdf3471209").unwrap(),
))
.is_empty());

Ok(())
}

Expand All @@ -45,5 +50,14 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
}

fn migrate() -> frame_support::weights::Weight {
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(0, 0)
use array_bytes::Dehexify;
use frame_support::traits::LockableCurrency;

if let Ok(who) = <[u8; 20]>::dehexify("0x3d6a81177e17d5dbbd36f23ea5328acdf3471209") {
let who = AccountId::from(who);

Balances::remove_lock(*b"vesting ", &who);
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(5, 10)
}
15 changes: 14 additions & 1 deletion runtime/darwinia/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn post_upgrade(_state: Vec<u8>) -> Result<(), sp_runtime::DispatchError> {
log::info!("post");

assert!(Balances::locks(AccountId::from(
<[u8; 20]>::dehexify("0x52f6cbe5f29094d235df65e31b67977a235e6380").unwrap(),
))
.is_empty());

Ok(())
}

Expand Down Expand Up @@ -136,5 +141,13 @@ fn migrate() -> frame_support::weights::Weight {
Balances::unreserve(&who, 5_000 * UNIT * count);
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(30, 40)
use frame_support::traits::LockableCurrency;

if let Ok(who) = <[u8; 20]>::dehexify("0x52f6cbe5f29094d235df65e31b67977a235e6380") {
let who = AccountId::from(who);

Balances::remove_lock(*b"democrac", &who);
}

<Runtime as frame_system::Config>::DbWeight::get().reads_writes(40, 50)
}
Loading