From 9007ac14074c25aed8a1ccf5c0bfc8f0eb507ffd Mon Sep 17 00:00:00 2001 From: Cem Eliguzel Date: Fri, 13 Oct 2023 11:57:05 +0000 Subject: [PATCH] Fix for the breaking change from polkadot v1.1.0 The pre/post_upgrade methods of a tuple of migrations should not be called directly. --- pallets/maintenance-mode/src/types.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pallets/maintenance-mode/src/types.rs b/pallets/maintenance-mode/src/types.rs index 2a3b5238..5fe500c3 100644 --- a/pallets/maintenance-mode/src/types.rs +++ b/pallets/maintenance-mode/src/types.rs @@ -25,7 +25,7 @@ use frame_support::{ use frame_system::pallet_prelude::BlockNumberFor as BlockNumberOf; use sp_std::marker::PhantomData; #[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; +use sp_runtime::TryRuntimeError; pub struct ExecutiveHooks(PhantomData); @@ -94,20 +94,11 @@ where } #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, sp_runtime::DispatchError> { + fn try_on_runtime_upgrade(checks: bool) -> Result { if Pallet::::maintenance_mode() { - T::MaintenanceExecutiveHooks::pre_upgrade() + T::MaintenanceExecutiveHooks::try_on_runtime_upgrade(checks) } else { - T::NormalExecutiveHooks::pre_upgrade() - } - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), sp_runtime::DispatchError> { - if Pallet::::maintenance_mode() { - T::MaintenanceExecutiveHooks::post_upgrade(state) - } else { - T::NormalExecutiveHooks::post_upgrade(state) + T::NormalExecutiveHooks::try_on_runtime_upgrade(checks) } } }