Skip to content

Commit

Permalink
Set storage version
Browse files Browse the repository at this point in the history
Signed-off-by: Xavier Lau <xavier@inv.cafe>
  • Loading branch information
AurevoirXavier committed Aug 12, 2024
1 parent df83f28 commit ccc597b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 4 additions & 1 deletion runtime/crab/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
}

fn migrate() -> frame_support::weights::Weight {
frame_support::traits::StorageVersion::new(2)
.put::<cumulus_pallet_dmp_queue::Pallet<Runtime>>();

const KTON_DAO_VAULT_ADDR: &str = "0x652182C6aBc0bBE41b5702b05a26d109A405EAcA";

#[cfg(feature = "try-runtime")]
assert!(array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR).is_ok());
assert!(array_bytes::hex_n_into::<_, AccountId, 20>(KTON_DAO_VAULT_ADDR).is_ok());

if let Ok(w) = array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR) {
<darwinia_staking::KtonRewardDistributionContract<Runtime>>::put(w);
Expand Down
5 changes: 4 additions & 1 deletion runtime/darwinia/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
}

fn migrate() -> frame_support::weights::Weight {
frame_support::traits::StorageVersion::new(2)
.put::<cumulus_pallet_dmp_queue::Pallet<Runtime>>();

let _ = migration::clear_storage_prefix(
b"BridgeKusamaGrandpa",
b"ImportedHeaders",
Expand All @@ -64,7 +67,7 @@ fn migrate() -> frame_support::weights::Weight {
const KTON_DAO_VAULT_ADDR: &str = "0x652182C6aBc0bBE41b5702b05a26d109A405EAcA";

#[cfg(feature = "try-runtime")]
assert!(array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR).is_ok());
assert!(array_bytes::hex_n_into::<_, AccountId, 20>(KTON_DAO_VAULT_ADDR).is_ok());

if let Ok(w) = array_bytes::hex_n_into::<_, _, 20>(KTON_DAO_VAULT_ADDR) {
<darwinia_staking::KtonRewardDistributionContract<Runtime>>::put(w);
Expand Down
10 changes: 3 additions & 7 deletions runtime/koi/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@ impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
}

fn migrate() -> frame_support::weights::Weight {
let n = migration_helper::PalletCleaner {
name: b"EthereumXcm",
values: &[b"Nonce", b"EthereumXcmSuspended"],
maps: &[],
}
.remove_storage_values();
frame_support::traits::StorageVersion::new(2)
.put::<cumulus_pallet_dmp_queue::Pallet<Runtime>>();

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(0, n)
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(0, 1)
}

0 comments on commit ccc597b

Please sign in to comment.