Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 8310936

Browse files
authored
Un-deprecate Transactional Macro (#11807)
* un-deprecate transactional macro * add transactional back to nomination pools
1 parent d871277 commit 8310936

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

frame/nomination-pools/src/lib.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ use frame_support::{
316316
Currency, Defensive, DefensiveOption, DefensiveResult, DefensiveSaturating,
317317
ExistenceRequirement, Get,
318318
},
319-
CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
319+
transactional, CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
320320
};
321321
use scale_info::TypeInfo;
322322
use sp_core::U256;
@@ -1412,6 +1412,7 @@ pub mod pallet {
14121412
/// `existential deposit + amount` in their account.
14131413
/// * Only a pool with [`PoolState::Open`] can be joined
14141414
#[pallet::weight(T::WeightInfo::join())]
1415+
#[transactional]
14151416
pub fn join(
14161417
origin: OriginFor<T>,
14171418
#[pallet::compact] amount: BalanceOf<T>,
@@ -1472,6 +1473,7 @@ pub mod pallet {
14721473
T::WeightInfo::bond_extra_transfer()
14731474
.max(T::WeightInfo::bond_extra_reward())
14741475
)]
1476+
#[transactional]
14751477
pub fn bond_extra(origin: OriginFor<T>, extra: BondExtra<BalanceOf<T>>) -> DispatchResult {
14761478
let who = ensure_signed(origin)?;
14771479
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
@@ -1510,6 +1512,7 @@ pub mod pallet {
15101512
/// The member will earn rewards pro rata based on the members stake vs the sum of the
15111513
/// members in the pools stake. Rewards do not "expire".
15121514
#[pallet::weight(T::WeightInfo::claim_payout())]
1515+
#[transactional]
15131516
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
15141517
let who = ensure_signed(origin)?;
15151518
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
@@ -1549,6 +1552,7 @@ pub mod pallet {
15491552
/// there are too many unlocking chunks, the result of this call will likely be the
15501553
/// `NoMoreChunks` error from the staking system.
15511554
#[pallet::weight(T::WeightInfo::unbond())]
1555+
#[transactional]
15521556
pub fn unbond(
15531557
origin: OriginFor<T>,
15541558
member_account: T::AccountId,
@@ -1626,6 +1630,7 @@ pub mod pallet {
16261630
/// would probably see an error like `NoMoreChunks` emitted from the staking system when
16271631
/// they attempt to unbond.
16281632
#[pallet::weight(T::WeightInfo::pool_withdraw_unbonded(*num_slashing_spans))]
1633+
#[transactional]
16291634
pub fn pool_withdraw_unbonded(
16301635
origin: OriginFor<T>,
16311636
pool_id: PoolId,
@@ -1662,6 +1667,7 @@ pub mod pallet {
16621667
#[pallet::weight(
16631668
T::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans)
16641669
)]
1670+
#[transactional]
16651671
pub fn withdraw_unbonded(
16661672
origin: OriginFor<T>,
16671673
member_account: T::AccountId,
@@ -1787,6 +1793,7 @@ pub mod pallet {
17871793
/// In addition to `amount`, the caller will transfer the existential deposit; so the caller
17881794
/// needs at have at least `amount + existential_deposit` transferrable.
17891795
#[pallet::weight(T::WeightInfo::create())]
1796+
#[transactional]
17901797
pub fn create(
17911798
origin: OriginFor<T>,
17921799
#[pallet::compact] amount: BalanceOf<T>,
@@ -1875,6 +1882,7 @@ pub mod pallet {
18751882
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
18761883
/// account.
18771884
#[pallet::weight(T::WeightInfo::nominate(validators.len() as u32))]
1885+
#[transactional]
18781886
pub fn nominate(
18791887
origin: OriginFor<T>,
18801888
pool_id: PoolId,
@@ -1891,6 +1899,7 @@ pub mod pallet {
18911899
/// The dispatch origin of this call must be signed by the state toggler, or the root role
18921900
/// of the pool.
18931901
#[pallet::weight(T::WeightInfo::set_state())]
1902+
#[transactional]
18941903
pub fn set_state(
18951904
origin: OriginFor<T>,
18961905
pool_id: PoolId,
@@ -1921,6 +1930,7 @@ pub mod pallet {
19211930
/// The dispatch origin of this call must be signed by the state toggler, or the root role
19221931
/// of the pool.
19231932
#[pallet::weight(T::WeightInfo::set_metadata(metadata.len() as u32))]
1933+
#[transactional]
19241934
pub fn set_metadata(
19251935
origin: OriginFor<T>,
19261936
pool_id: PoolId,
@@ -1952,6 +1962,7 @@ pub mod pallet {
19521962
/// * `max_members` - Set [`MaxPoolMembers`].
19531963
/// * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
19541964
#[pallet::weight(T::WeightInfo::set_configs())]
1965+
#[transactional]
19551966
pub fn set_configs(
19561967
origin: OriginFor<T>,
19571968
min_join_bond: ConfigOp<BalanceOf<T>>,
@@ -1988,6 +1999,7 @@ pub mod pallet {
19881999
/// It emits an event, notifying UIs of the role change. This event is quite relevant to
19892000
/// most pool members and they should be informed of changes to pool roles.
19902001
#[pallet::weight(T::WeightInfo::update_roles())]
2002+
#[transactional]
19912003
pub fn update_roles(
19922004
origin: OriginFor<T>,
19932005
pool_id: PoolId,
@@ -2040,6 +2052,7 @@ pub mod pallet {
20402052
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
20412053
/// account.
20422054
#[pallet::weight(T::WeightInfo::chill())]
2055+
#[transactional]
20432056
pub fn chill(origin: OriginFor<T>, pool_id: PoolId) -> DispatchResult {
20442057
let who = ensure_signed(origin)?;
20452058
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;

frame/support/procedural/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ pub fn pallet(attr: TokenStream, item: TokenStream) -> TokenStream {
429429
/// }
430430
/// ```
431431
#[proc_macro_attribute]
432-
#[deprecated(note = "This is now the default behaviour for all extrinsics.")]
433432
pub fn transactional(attr: TokenStream, input: TokenStream) -> TokenStream {
434433
transactional::transactional(attr, input).unwrap_or_else(|e| e.to_compile_error().into())
435434
}

0 commit comments

Comments
 (0)