Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ use frame_support::{
Currency, Defensive, DefensiveOption, DefensiveResult, DefensiveSaturating,
ExistenceRequirement, Get,
},
CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
transactional, CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
};
use scale_info::TypeInfo;
use sp_core::U256;
Expand Down Expand Up @@ -1412,6 +1412,7 @@ pub mod pallet {
/// `existential deposit + amount` in their account.
/// * Only a pool with [`PoolState::Open`] can be joined
#[pallet::weight(T::WeightInfo::join())]
#[transactional]
pub fn join(
origin: OriginFor<T>,
#[pallet::compact] amount: BalanceOf<T>,
Expand Down Expand Up @@ -1472,6 +1473,7 @@ pub mod pallet {
T::WeightInfo::bond_extra_transfer()
.max(T::WeightInfo::bond_extra_reward())
)]
#[transactional]
pub fn bond_extra(origin: OriginFor<T>, extra: BondExtra<BalanceOf<T>>) -> DispatchResult {
let who = ensure_signed(origin)?;
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
Expand Down Expand Up @@ -1510,6 +1512,7 @@ pub mod pallet {
/// The member will earn rewards pro rata based on the members stake vs the sum of the
/// members in the pools stake. Rewards do not "expire".
#[pallet::weight(T::WeightInfo::claim_payout())]
#[transactional]
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
Expand Down Expand Up @@ -1549,6 +1552,7 @@ pub mod pallet {
/// there are too many unlocking chunks, the result of this call will likely be the
/// `NoMoreChunks` error from the staking system.
#[pallet::weight(T::WeightInfo::unbond())]
#[transactional]
pub fn unbond(
origin: OriginFor<T>,
member_account: T::AccountId,
Expand Down Expand Up @@ -1626,6 +1630,7 @@ pub mod pallet {
/// would probably see an error like `NoMoreChunks` emitted from the staking system when
/// they attempt to unbond.
#[pallet::weight(T::WeightInfo::pool_withdraw_unbonded(*num_slashing_spans))]
#[transactional]
pub fn pool_withdraw_unbonded(
origin: OriginFor<T>,
pool_id: PoolId,
Expand Down Expand Up @@ -1662,6 +1667,7 @@ pub mod pallet {
#[pallet::weight(
T::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans)
)]
#[transactional]
pub fn withdraw_unbonded(
origin: OriginFor<T>,
member_account: T::AccountId,
Expand Down Expand Up @@ -1787,6 +1793,7 @@ pub mod pallet {
/// In addition to `amount`, the caller will transfer the existential deposit; so the caller
/// needs at have at least `amount + existential_deposit` transferrable.
#[pallet::weight(T::WeightInfo::create())]
#[transactional]
pub fn create(
origin: OriginFor<T>,
#[pallet::compact] amount: BalanceOf<T>,
Expand Down Expand Up @@ -1875,6 +1882,7 @@ pub mod pallet {
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
/// account.
#[pallet::weight(T::WeightInfo::nominate(validators.len() as u32))]
#[transactional]
pub fn nominate(
origin: OriginFor<T>,
pool_id: PoolId,
Expand All @@ -1891,6 +1899,7 @@ pub mod pallet {
/// The dispatch origin of this call must be signed by the state toggler, or the root role
/// of the pool.
#[pallet::weight(T::WeightInfo::set_state())]
#[transactional]
pub fn set_state(
origin: OriginFor<T>,
pool_id: PoolId,
Expand Down Expand Up @@ -1921,6 +1930,7 @@ pub mod pallet {
/// The dispatch origin of this call must be signed by the state toggler, or the root role
/// of the pool.
#[pallet::weight(T::WeightInfo::set_metadata(metadata.len() as u32))]
#[transactional]
pub fn set_metadata(
origin: OriginFor<T>,
pool_id: PoolId,
Expand Down Expand Up @@ -1952,6 +1962,7 @@ pub mod pallet {
/// * `max_members` - Set [`MaxPoolMembers`].
/// * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
#[pallet::weight(T::WeightInfo::set_configs())]
#[transactional]
pub fn set_configs(
origin: OriginFor<T>,
min_join_bond: ConfigOp<BalanceOf<T>>,
Expand Down Expand Up @@ -1988,6 +1999,7 @@ pub mod pallet {
/// It emits an event, notifying UIs of the role change. This event is quite relevant to
/// most pool members and they should be informed of changes to pool roles.
#[pallet::weight(T::WeightInfo::update_roles())]
#[transactional]
pub fn update_roles(
origin: OriginFor<T>,
pool_id: PoolId,
Expand Down Expand Up @@ -2040,6 +2052,7 @@ pub mod pallet {
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
/// account.
#[pallet::weight(T::WeightInfo::chill())]
#[transactional]
pub fn chill(origin: OriginFor<T>, pool_id: PoolId) -> DispatchResult {
let who = ensure_signed(origin)?;
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
Expand Down
1 change: 0 additions & 1 deletion frame/support/procedural/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ pub fn pallet(attr: TokenStream, item: TokenStream) -> TokenStream {
/// }
/// ```
#[proc_macro_attribute]
#[deprecated(note = "This is now the default behaviour for all extrinsics.")]
pub fn transactional(attr: TokenStream, input: TokenStream) -> TokenStream {
transactional::transactional(attr, input).unwrap_or_else(|e| e.to_compile_error().into())
}
Expand Down