From 4bfbbcd0227c8698121fae7151f32c34fc98aed3 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Sun, 28 Apr 2024 14:38:32 +0200 Subject: [PATCH 1/2] fix(nomination-pools(: Skip TVL check --- substrate/frame/nomination-pools/src/lib.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index 909a930e3821..a6cafb8f4bad 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -3371,15 +3371,19 @@ impl Pallet { Error::::MaxPoolMembers ); - ensure!( - TotalValueLocked::::get() == expected_tvl, - "TVL deviates from the actual sum of funds of all Pools." - ); + if StorageVersion::get::>() >= 7 { - ensure!( - TotalValueLocked::::get() <= total_balance_members, - "TVL must be equal to or less than the total balance of all PoolMembers." - ); + ensure!( + TotalValueLocked::::get() == expected_tvl, + "TVL deviates from the actual sum of funds of all Pools." + ); + + ensure!( + TotalValueLocked::::get() <= total_balance_members, + "TVL must be equal to or less than the total balance of all PoolMembers." + ); + + } if level <= 1 { return Ok(()) From 6360ec83bac62dea15541b2b7411dba7e1919381 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Sun, 28 Apr 2024 14:57:12 +0200 Subject: [PATCH 2/2] check frozen ED after v5 --- substrate/frame/nomination-pools/src/lib.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/substrate/frame/nomination-pools/src/lib.rs b/substrate/frame/nomination-pools/src/lib.rs index a6cafb8f4bad..ef87de104b4c 100644 --- a/substrate/frame/nomination-pools/src/lib.rs +++ b/substrate/frame/nomination-pools/src/lib.rs @@ -3408,9 +3408,13 @@ impl Pallet { ); } - // Warn if any pool has incorrect ED frozen. We don't want to fail hard as this could be a - // result of an intentional ED change. - let _ = Self::check_ed_imbalance()?; + if StorageVersion::get::>() >= 6 { + + // Warn if any pool has incorrect ED frozen. We don't want to fail hard as this could be a + // result of an intentional ED change. + let _ = Self::check_ed_imbalance()?; + + } Ok(()) }