Skip to content

Commit

Permalink
staking pallet migration : remove assertion that old pallet data is r…
Browse files Browse the repository at this point in the history
…emoved
  • Loading branch information
mnaamani committed Oct 14, 2023
1 parent 7afe0a6 commit 1d0eefc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions frame/staking/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ pub mod v11 {
}

move_pallet(old_pallet_name.as_bytes(), new_pallet_name.as_bytes());
clear_prefix(&twox_128(old_pallet_name.as_bytes()), None, None);
<T as frame_system::Config>::BlockWeights::get().max_block
} else {
log!(warn, "v11::migrate should be removed.");
Expand All @@ -232,11 +231,14 @@ pub mod v11 {
return Ok(())
}

let old_pallet_prefix = twox_128(N::get().as_bytes());
frame_support::ensure!(
sp_io::storage::next_key(&old_pallet_prefix).is_none(),
"old pallet data hasn't been removed"
);
// https://substrate-developer-hub.github.io/rustdocs/latest/frame_support/storage/migration/fn.move_pallet.html
// "The value at the key twox_128(old_pallet_name) is not moved."
// So this assertion seems incorrect!
// let old_pallet_prefix = twox_128(N::get().as_bytes());
// frame_support::ensure!(
// sp_io::storage::next_key(&old_pallet_prefix).is_none(),
// "old pallet data hasn't been removed"
// );

let new_pallet_name = <P as PalletInfoAccess>::name();
let new_pallet_prefix = twox_128(new_pallet_name.as_bytes());
Expand Down

0 comments on commit 1d0eefc

Please sign in to comment.