Skip to content

Commit

Permalink
chore: Removed upgrade condition for pending swaps (#5497)
Browse files Browse the repository at this point in the history
* chore: Removed upgrade condition for pending swaps

* chore: removed NoUsedNonce and NoPendingSwaps upgrade requirement

* chore: fixed clippy
  • Loading branch information
Janislav authored Dec 18, 2024
1 parent 799db2f commit d2868d2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 24 deletions.
12 changes: 2 additions & 10 deletions state-chain/pallets/cf-environment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -754,11 +754,3 @@ impl<T: Config> NetworkEnvironmentProvider for Pallet<T> {
Self::network_environment()
}
}

pub struct NoUsedNonce<T: Config>(PhantomData<T>);

impl<T: Config> ExecutionCondition for NoUsedNonce<T> {
fn is_satisfied() -> bool {
SolanaUnavailableNonceAccounts::<T>::iter().next().is_none()
}
}
12 changes: 2 additions & 10 deletions state-chain/pallets/cf-swapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*,
Expand Down Expand Up @@ -2143,14 +2143,6 @@ impl<T: Config> SwapLimitsProvider for Pallet<T> {
}
}

pub struct NoPendingSwaps<T: Config>(PhantomData<T>);

impl<T: Config> ExecutionCondition for NoPendingSwaps<T> {
fn is_satisfied() -> bool {
SwapQueue::<T>::iter().all(|(_, swaps)| swaps.is_empty())
}
}

impl<T: Config> AffiliateRegistry for Pallet<T> {
type AccountId = T::AccountId;

Expand Down
5 changes: 1 addition & 4 deletions state-chain/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,7 @@ impl pallet_cf_governance::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type TimeSource = Timestamp;
type WeightInfo = pallet_cf_governance::weights::PalletWeight<Runtime>;
type UpgradeCondition = (
pallet_cf_validator::NotDuringRotation<Runtime>,
(pallet_cf_swapping::NoPendingSwaps<Runtime>, pallet_cf_environment::NoUsedNonce<Runtime>),
);
type UpgradeCondition = pallet_cf_validator::NotDuringRotation<Runtime>;
type RuntimeUpgrade = chainflip::RuntimeUpgradeManager;
type CompatibleCfeVersions = Environment;
type AuthoritiesCfeVersions = Validator;
Expand Down

0 comments on commit d2868d2

Please sign in to comment.