From 41ff8cbaef9e7b996bcb8d1a852cf4bb0eeff91b Mon Sep 17 00:00:00 2001 From: Dino Pacandi Date: Thu, 25 Jan 2024 14:43:22 +0100 Subject: [PATCH] Relaxed decommission mode --- pallets/dapps-staking/src/pallet/mod.rs | 11 +---------- pallets/dapps-staking/src/tests.rs | 24 ------------------------ 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/pallets/dapps-staking/src/pallet/mod.rs b/pallets/dapps-staking/src/pallet/mod.rs index 55b4d09be..3f5e23df5 100644 --- a/pallets/dapps-staking/src/pallet/mod.rs +++ b/pallets/dapps-staking/src/pallet/mod.rs @@ -305,8 +305,6 @@ pub mod pallet { NominationTransferToSameContract, /// Decommission is in progress so this call is not allowed. DecommissionInProgress, - /// Pallet decommission hasn't been started yet so this call is not allowed. - DecommissionNotStarted, } #[pallet::hooks] @@ -925,10 +923,6 @@ pub mod pallet { contract_id: T::SmartContract, ) -> DispatchResultWithPostInfo { Self::ensure_pallet_enabled()?; - ensure!( - DecommissionStarted::::get(), - Error::::DecommissionNotStarted - ); ensure_signed(origin)?; Self::internal_claim_staker_for(staker, contract_id) @@ -944,10 +938,7 @@ pub mod pallet { reward_destination: RewardDestination, ) -> DispatchResultWithPostInfo { Self::ensure_pallet_enabled()?; - ensure!( - DecommissionStarted::::get(), - Error::::DecommissionNotStarted - ); + ensure_signed(origin)?; Self::internal_set_reward_destination_for(staker, reward_destination) diff --git a/pallets/dapps-staking/src/tests.rs b/pallets/dapps-staking/src/tests.rs index 5b53ea6ec..bafef8807 100644 --- a/pallets/dapps-staking/src/tests.rs +++ b/pallets/dapps-staking/src/tests.rs @@ -2485,18 +2485,6 @@ fn claim_staker_for_works() { // Advance to next era so we can claim rewards for it advance_to_era(DappsStaking::current_era() + 1); - // Claiming for another staker is not possible unless decommission has started - assert_noop!( - DappsStaking::claim_staker_for( - RuntimeOrigin::signed(claimer), - staker, - smart_contract.clone() - ), - Error::::DecommissionNotStarted - ); - - // Enable decommission mode & claim the reward - assert_ok!(DappsStaking::decommission(RuntimeOrigin::root())); assert_ok!(DappsStaking::claim_staker_for( RuntimeOrigin::signed(claimer), staker, @@ -2524,18 +2512,6 @@ fn set_reward_destination_for_works() { assert_register(developer, &smart_contract); assert_bond_and_stake(staker, &smart_contract, 17); - // Claiming for another staker is not possible unless decommission has started - assert_noop!( - DappsStaking::set_reward_destination_for( - RuntimeOrigin::signed(caller), - staker, - RewardDestination::StakeBalance - ), - Error::::DecommissionNotStarted - ); - - // Enable decommission mode and set the reward destination - assert_ok!(DappsStaking::decommission(RuntimeOrigin::root())); assert_ok!(DappsStaking::set_reward_destination_for( RuntimeOrigin::signed(caller), staker,