Skip to content

Commit

Permalink
[frame/im-online] remove ensure from pre_upgrade
Browse files Browse the repository at this point in the history
modify ensure in post_upgrade to allow for future upgrades
refs paritytech#14251 (comment)
  • Loading branch information
melekes committed Jun 16, 2023
1 parent 42cda4f commit 8149804
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions frame/im-online/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ pub mod v1 {
impl<T: Config> OnRuntimeUpgrade for Migration<T> {
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
ensure!(StorageVersion::get::<Pallet<T>>() == 0, "can only upgrade from version 0");

let count = v0::ReceivedHeartbeats::<T>::iter().count();
log::info!(target: TARGET, "Migrating {} received heartbeats", count);

Expand Down Expand Up @@ -111,7 +109,7 @@ pub mod v1 {
old_received_heartbeats
);
}
ensure!(StorageVersion::get::<Pallet<T>>() == 1, "must upgrade");
ensure!(StorageVersion::get::<Pallet<T>>() >= 1, "must upgrade");

Ok(())
}
Expand Down

0 comments on commit 8149804

Please sign in to comment.