From d2868d2c4cc3f44723b380a54807b8e7f9829102 Mon Sep 17 00:00:00 2001 From: Janislav Date: Wed, 18 Dec 2024 16:24:11 +0100 Subject: [PATCH] chore: Removed upgrade condition for pending swaps (#5497) * chore: Removed upgrade condition for pending swaps * chore: removed NoUsedNonce and NoPendingSwaps upgrade requirement * chore: fixed clippy --- state-chain/pallets/cf-environment/src/lib.rs | 12 ++---------- state-chain/pallets/cf-swapping/src/lib.rs | 12 ++---------- state-chain/runtime/src/lib.rs | 5 +---- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/state-chain/pallets/cf-environment/src/lib.rs b/state-chain/pallets/cf-environment/src/lib.rs index c970816572..6e907013df 100644 --- a/state-chain/pallets/cf-environment/src/lib.rs +++ b/state-chain/pallets/cf-environment/src/lib.rs @@ -20,8 +20,8 @@ use cf_primitives::{ NetworkEnvironment, SemVer, }; use cf_traits::{ - CompatibleCfeVersions, ExecutionCondition, GetBitcoinFeeInfo, KeyProvider, - NetworkEnvironmentProvider, SafeMode, SolanaNonceWatch, + CompatibleCfeVersions, GetBitcoinFeeInfo, KeyProvider, NetworkEnvironmentProvider, SafeMode, + SolanaNonceWatch, }; use frame_support::{pallet_prelude::*, traits::StorageVersion}; use frame_system::pallet_prelude::*; @@ -754,11 +754,3 @@ impl NetworkEnvironmentProvider for Pallet { Self::network_environment() } } - -pub struct NoUsedNonce(PhantomData); - -impl ExecutionCondition for NoUsedNonce { - fn is_satisfied() -> bool { - SolanaUnavailableNonceAccounts::::iter().next().is_none() - } -} diff --git a/state-chain/pallets/cf-swapping/src/lib.rs b/state-chain/pallets/cf-swapping/src/lib.rs index b9a2200e6c..203ed85d8e 100644 --- a/state-chain/pallets/cf-swapping/src/lib.rs +++ b/state-chain/pallets/cf-swapping/src/lib.rs @@ -17,8 +17,8 @@ use cf_primitives::{ use cf_runtime_utilities::log_or_panic; use cf_traits::{ impl_pallet_safe_mode, AffiliateRegistry, BalanceApi, Bonding, ChannelIdAllocator, DepositApi, - ExecutionCondition, FundingInfo, IngressEgressFeeApi, SwapLimitsProvider, SwapRequestHandler, - SwapRequestType, SwapRequestTypeEncoded, SwapType, SwappingApi, + FundingInfo, IngressEgressFeeApi, SwapLimitsProvider, SwapRequestHandler, SwapRequestType, + SwapRequestTypeEncoded, SwapType, SwappingApi, }; use frame_support::{ pallet_prelude::*, @@ -2143,14 +2143,6 @@ impl SwapLimitsProvider for Pallet { } } -pub struct NoPendingSwaps(PhantomData); - -impl ExecutionCondition for NoPendingSwaps { - fn is_satisfied() -> bool { - SwapQueue::::iter().all(|(_, swaps)| swaps.is_empty()) - } -} - impl AffiliateRegistry for Pallet { type AccountId = T::AccountId; diff --git a/state-chain/runtime/src/lib.rs b/state-chain/runtime/src/lib.rs index d8d80c993c..958fe639d2 100644 --- a/state-chain/runtime/src/lib.rs +++ b/state-chain/runtime/src/lib.rs @@ -728,10 +728,7 @@ impl pallet_cf_governance::Config for Runtime { type RuntimeEvent = RuntimeEvent; type TimeSource = Timestamp; type WeightInfo = pallet_cf_governance::weights::PalletWeight; - type UpgradeCondition = ( - pallet_cf_validator::NotDuringRotation, - (pallet_cf_swapping::NoPendingSwaps, pallet_cf_environment::NoUsedNonce), - ); + type UpgradeCondition = pallet_cf_validator::NotDuringRotation; type RuntimeUpgrade = chainflip::RuntimeUpgradeManager; type CompatibleCfeVersions = Environment; type AuthoritiesCfeVersions = Validator;