From 8227950ed55286b6b526b76ba3436cd776ae32ed Mon Sep 17 00:00:00 2001
From: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Date: Wed, 28 Sep 2022 14:43:04 +0200
Subject: [PATCH] Fix staking migration (#12373)

Causing issues on Kusama...

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---
 substrate/frame/staking/src/migrations.rs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/substrate/frame/staking/src/migrations.rs b/substrate/frame/staking/src/migrations.rs
index 8f37ae30dd0..f2ccb4f8b09 100644
--- a/substrate/frame/staking/src/migrations.rs
+++ b/substrate/frame/staking/src/migrations.rs
@@ -40,10 +40,14 @@ pub mod v12 {
 				"Expected v11 before upgrading to v12"
 			);
 
-			frame_support::ensure!(
-				T::HistoryDepth::get() == HistoryDepth::<T>::get(),
-				"Provided value of HistoryDepth should be same as the existing storage value"
-			);
+			if HistoryDepth::<T>::exists() {
+				frame_support::ensure!(
+					T::HistoryDepth::get() == HistoryDepth::<T>::get(),
+					"Provided value of HistoryDepth should be same as the existing storage value"
+				);
+			} else {
+				log::info!("No HistoryDepth in storage; nothing to remove");
+			}
 
 			Ok(Default::default())
 		}
-- 
GitLab