Skip to content

Commit 06891d8

Browse files
committed
fix(nomination-pools): Skip ED and TVL check for v6 and v7
1 parent 710edc9 commit 06891d8

File tree

1 file changed

+19
-11
lines changed
  • substrate/frame/nomination-pools/src

1 file changed

+19
-11
lines changed

substrate/frame/nomination-pools/src/lib.rs

+19-11
Original file line numberDiff line numberDiff line change
@@ -3802,15 +3802,19 @@ impl<T: Config> Pallet<T> {
38023802
Error::<T>::MaxPoolMembers
38033803
);
38043804

3805-
ensure!(
3806-
TotalValueLocked::<T>::get() == expected_tvl,
3807-
"TVL deviates from the actual sum of funds of all Pools."
3808-
);
3805+
if StorageVersion::get::<crate::Pallet<T>>() >= 7 {
38093806

3810-
ensure!(
3811-
TotalValueLocked::<T>::get() <= total_balance_members,
3812-
"TVL must be equal to or less than the total balance of all PoolMembers."
3813-
);
3807+
ensure!(
3808+
TotalValueLocked::<T>::get() == expected_tvl,
3809+
"TVL deviates from the actual sum of funds of all Pools."
3810+
);
3811+
3812+
ensure!(
3813+
TotalValueLocked::<T>::get() <= total_balance_members,
3814+
"TVL must be equal to or less than the total balance of all PoolMembers."
3815+
);
3816+
3817+
}
38143818

38153819
if level <= 1 {
38163820
return Ok(())
@@ -3838,9 +3842,13 @@ impl<T: Config> Pallet<T> {
38383842
);
38393843
}
38403844

3841-
// Warn if any pool has incorrect ED frozen. We don't want to fail hard as this could be a
3842-
// result of an intentional ED change.
3843-
let _ = Self::check_ed_imbalance()?;
3845+
if StorageVersion::get::<crate::Pallet<T>>() >= 6 {
3846+
3847+
// Warn if any pool has incorrect ED frozen. We don't want to fail hard as this could be a
3848+
// result of an intentional ED change.
3849+
let _ = Self::check_ed_imbalance()?;
3850+
3851+
}
38443852

38453853
Ok(())
38463854
}

0 commit comments

Comments
 (0)