From 18ad449015e243d148d48688f2492d435fc75522 Mon Sep 17 00:00:00 2001 From: PG Herveou <pgherveou@gmail.com> Date: Tue, 31 Oct 2023 12:08:32 +0100 Subject: [PATCH] Contracts migration update (#2091) Restore fix from #2077 --- substrate/frame/contracts/src/migration.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/substrate/frame/contracts/src/migration.rs b/substrate/frame/contracts/src/migration.rs index 1873ef2765b..6d61cb6b1e1 100644 --- a/substrate/frame/contracts/src/migration.rs +++ b/substrate/frame/contracts/src/migration.rs @@ -312,10 +312,7 @@ impl<T: Config, const TEST_ALL_STEPS: bool> OnRuntimeUpgrade for Migration<T, TE let current_version = <Pallet<T>>::current_storage_version(); if on_chain_version == current_version { - log::warn!( - target: LOG_TARGET, - "No upgrade: Please remove this migration from your Migrations tuple" - ) + return Ok(Default::default()) } log::debug!( @@ -324,9 +321,11 @@ impl<T: Config, const TEST_ALL_STEPS: bool> OnRuntimeUpgrade for Migration<T, TE <Pallet<T>>::name(), on_chain_version, current_version ); - if !T::Migrations::is_upgrade_supported(on_chain_version, current_version) { - log::warn!(target: LOG_TARGET, "Unsupported upgrade: VERSION_RANGE should be (on-chain storage version + 1, current storage version)") - } + ensure!( + T::Migrations::is_upgrade_supported(on_chain_version, current_version), + "Unsupported upgrade: VERSION_RANGE should be (on-chain storage version + 1, current storage version)" + ); + Ok(Default::default()) } -- GitLab