mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 11:21:07 +00:00
Un-deprecate Transactional Macro (#11807)
* un-deprecate transactional macro * add transactional back to nomination pools
This commit is contained in:
@@ -316,7 +316,7 @@ use frame_support::{
|
|||||||
Currency, Defensive, DefensiveOption, DefensiveResult, DefensiveSaturating,
|
Currency, Defensive, DefensiveOption, DefensiveResult, DefensiveSaturating,
|
||||||
ExistenceRequirement, Get,
|
ExistenceRequirement, Get,
|
||||||
},
|
},
|
||||||
CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
|
transactional, CloneNoBound, DefaultNoBound, RuntimeDebugNoBound,
|
||||||
};
|
};
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_core::U256;
|
use sp_core::U256;
|
||||||
@@ -1412,6 +1412,7 @@ pub mod pallet {
|
|||||||
/// `existential deposit + amount` in their account.
|
/// `existential deposit + amount` in their account.
|
||||||
/// * Only a pool with [`PoolState::Open`] can be joined
|
/// * Only a pool with [`PoolState::Open`] can be joined
|
||||||
#[pallet::weight(T::WeightInfo::join())]
|
#[pallet::weight(T::WeightInfo::join())]
|
||||||
|
#[transactional]
|
||||||
pub fn join(
|
pub fn join(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
#[pallet::compact] amount: BalanceOf<T>,
|
#[pallet::compact] amount: BalanceOf<T>,
|
||||||
@@ -1472,6 +1473,7 @@ pub mod pallet {
|
|||||||
T::WeightInfo::bond_extra_transfer()
|
T::WeightInfo::bond_extra_transfer()
|
||||||
.max(T::WeightInfo::bond_extra_reward())
|
.max(T::WeightInfo::bond_extra_reward())
|
||||||
)]
|
)]
|
||||||
|
#[transactional]
|
||||||
pub fn bond_extra(origin: OriginFor<T>, extra: BondExtra<BalanceOf<T>>) -> DispatchResult {
|
pub fn bond_extra(origin: OriginFor<T>, extra: BondExtra<BalanceOf<T>>) -> DispatchResult {
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
|
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
|
||||||
@@ -1510,6 +1512,7 @@ pub mod pallet {
|
|||||||
/// The member will earn rewards pro rata based on the members stake vs the sum of the
|
/// 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".
|
/// members in the pools stake. Rewards do not "expire".
|
||||||
#[pallet::weight(T::WeightInfo::claim_payout())]
|
#[pallet::weight(T::WeightInfo::claim_payout())]
|
||||||
|
#[transactional]
|
||||||
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
|
pub fn claim_payout(origin: OriginFor<T>) -> DispatchResult {
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
|
let (mut member, mut bonded_pool, mut reward_pool) = Self::get_member_with_pools(&who)?;
|
||||||
@@ -1549,6 +1552,7 @@ pub mod pallet {
|
|||||||
/// there are too many unlocking chunks, the result of this call will likely be the
|
/// there are too many unlocking chunks, the result of this call will likely be the
|
||||||
/// `NoMoreChunks` error from the staking system.
|
/// `NoMoreChunks` error from the staking system.
|
||||||
#[pallet::weight(T::WeightInfo::unbond())]
|
#[pallet::weight(T::WeightInfo::unbond())]
|
||||||
|
#[transactional]
|
||||||
pub fn unbond(
|
pub fn unbond(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
member_account: T::AccountId,
|
member_account: T::AccountId,
|
||||||
@@ -1626,6 +1630,7 @@ pub mod pallet {
|
|||||||
/// would probably see an error like `NoMoreChunks` emitted from the staking system when
|
/// would probably see an error like `NoMoreChunks` emitted from the staking system when
|
||||||
/// they attempt to unbond.
|
/// they attempt to unbond.
|
||||||
#[pallet::weight(T::WeightInfo::pool_withdraw_unbonded(*num_slashing_spans))]
|
#[pallet::weight(T::WeightInfo::pool_withdraw_unbonded(*num_slashing_spans))]
|
||||||
|
#[transactional]
|
||||||
pub fn pool_withdraw_unbonded(
|
pub fn pool_withdraw_unbonded(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
@@ -1662,6 +1667,7 @@ pub mod pallet {
|
|||||||
#[pallet::weight(
|
#[pallet::weight(
|
||||||
T::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans)
|
T::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans)
|
||||||
)]
|
)]
|
||||||
|
#[transactional]
|
||||||
pub fn withdraw_unbonded(
|
pub fn withdraw_unbonded(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
member_account: T::AccountId,
|
member_account: T::AccountId,
|
||||||
@@ -1787,6 +1793,7 @@ pub mod pallet {
|
|||||||
/// In addition to `amount`, the caller will transfer the existential deposit; so the caller
|
/// In addition to `amount`, the caller will transfer the existential deposit; so the caller
|
||||||
/// needs at have at least `amount + existential_deposit` transferrable.
|
/// needs at have at least `amount + existential_deposit` transferrable.
|
||||||
#[pallet::weight(T::WeightInfo::create())]
|
#[pallet::weight(T::WeightInfo::create())]
|
||||||
|
#[transactional]
|
||||||
pub fn create(
|
pub fn create(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
#[pallet::compact] amount: BalanceOf<T>,
|
#[pallet::compact] amount: BalanceOf<T>,
|
||||||
@@ -1875,6 +1882,7 @@ pub mod pallet {
|
|||||||
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
|
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
|
||||||
/// account.
|
/// account.
|
||||||
#[pallet::weight(T::WeightInfo::nominate(validators.len() as u32))]
|
#[pallet::weight(T::WeightInfo::nominate(validators.len() as u32))]
|
||||||
|
#[transactional]
|
||||||
pub fn nominate(
|
pub fn nominate(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
@@ -1891,6 +1899,7 @@ pub mod pallet {
|
|||||||
/// The dispatch origin of this call must be signed by the state toggler, or the root role
|
/// The dispatch origin of this call must be signed by the state toggler, or the root role
|
||||||
/// of the pool.
|
/// of the pool.
|
||||||
#[pallet::weight(T::WeightInfo::set_state())]
|
#[pallet::weight(T::WeightInfo::set_state())]
|
||||||
|
#[transactional]
|
||||||
pub fn set_state(
|
pub fn set_state(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
@@ -1921,6 +1930,7 @@ pub mod pallet {
|
|||||||
/// The dispatch origin of this call must be signed by the state toggler, or the root role
|
/// The dispatch origin of this call must be signed by the state toggler, or the root role
|
||||||
/// of the pool.
|
/// of the pool.
|
||||||
#[pallet::weight(T::WeightInfo::set_metadata(metadata.len() as u32))]
|
#[pallet::weight(T::WeightInfo::set_metadata(metadata.len() as u32))]
|
||||||
|
#[transactional]
|
||||||
pub fn set_metadata(
|
pub fn set_metadata(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
@@ -1952,6 +1962,7 @@ pub mod pallet {
|
|||||||
/// * `max_members` - Set [`MaxPoolMembers`].
|
/// * `max_members` - Set [`MaxPoolMembers`].
|
||||||
/// * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
|
/// * `max_members_per_pool` - Set [`MaxPoolMembersPerPool`].
|
||||||
#[pallet::weight(T::WeightInfo::set_configs())]
|
#[pallet::weight(T::WeightInfo::set_configs())]
|
||||||
|
#[transactional]
|
||||||
pub fn set_configs(
|
pub fn set_configs(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
min_join_bond: ConfigOp<BalanceOf<T>>,
|
min_join_bond: ConfigOp<BalanceOf<T>>,
|
||||||
@@ -1988,6 +1999,7 @@ pub mod pallet {
|
|||||||
/// It emits an event, notifying UIs of the role change. This event is quite relevant to
|
/// 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.
|
/// most pool members and they should be informed of changes to pool roles.
|
||||||
#[pallet::weight(T::WeightInfo::update_roles())]
|
#[pallet::weight(T::WeightInfo::update_roles())]
|
||||||
|
#[transactional]
|
||||||
pub fn update_roles(
|
pub fn update_roles(
|
||||||
origin: OriginFor<T>,
|
origin: OriginFor<T>,
|
||||||
pool_id: PoolId,
|
pool_id: PoolId,
|
||||||
@@ -2040,6 +2052,7 @@ pub mod pallet {
|
|||||||
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
|
/// This directly forward the call to the staking pallet, on behalf of the pool bonded
|
||||||
/// account.
|
/// account.
|
||||||
#[pallet::weight(T::WeightInfo::chill())]
|
#[pallet::weight(T::WeightInfo::chill())]
|
||||||
|
#[transactional]
|
||||||
pub fn chill(origin: OriginFor<T>, pool_id: PoolId) -> DispatchResult {
|
pub fn chill(origin: OriginFor<T>, pool_id: PoolId) -> DispatchResult {
|
||||||
let who = ensure_signed(origin)?;
|
let who = ensure_signed(origin)?;
|
||||||
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
|
let bonded_pool = BondedPool::<T>::get(pool_id).ok_or(Error::<T>::PoolNotFound)?;
|
||||||
|
|||||||
@@ -429,7 +429,6 @@ pub fn pallet(attr: TokenStream, item: TokenStream) -> TokenStream {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
#[deprecated(note = "This is now the default behaviour for all extrinsics.")]
|
|
||||||
pub fn transactional(attr: TokenStream, input: TokenStream) -> TokenStream {
|
pub fn transactional(attr: TokenStream, input: TokenStream) -> TokenStream {
|
||||||
transactional::transactional(attr, input).unwrap_or_else(|e| e.to_compile_error().into())
|
transactional::transactional(attr, input).unwrap_or_else(|e| e.to_compile_error().into())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user