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

Improves documentation on num_slashing_spans when calling withdraw_unbounded in Staking. #14185

Merged
merged 3 commits into from
May 27, 2023
Merged
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
23 changes: 21 additions & 2 deletions frame/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,15 +1042,24 @@ pub mod pallet {

/// Remove any unlocked chunks from the `unlocking` queue from our management.
///
/// This essentially frees up that balance to be used by the stash account to do
/// whatever it wants.
/// This essentially frees up that balance to be used by the stash account to do whatever
/// it wants.
///
/// The dispatch origin for this call must be _Signed_ by the controller.
///
/// Emits `Withdrawn`.
///
/// See also [`Call::unbond`].
///
/// ## Parameters
gpestana marked this conversation as resolved.
Show resolved Hide resolved
///
/// - `num_slashing_spans` indicates the number of metadata slashing spans to clear when
/// this call results in a complete removal of all the data related to the stash account.
/// In this case, the `num_slashing_spans` must be larger or equal to the number of
/// slashing spans associated with the stash account in the [`SlashingSpans`] storage type,
/// otherwise the call will fail. The call weight is directly propotional to
/// `num_slashing_spans`.
///
/// ## Complexity
/// O(S) where S is the number of slashing spans to remove
/// NOTE: Weight annotation is the kill scenario, we refund otherwise.
Expand Down Expand Up @@ -1379,6 +1388,11 @@ pub mod pallet {
/// Force a current staker to become completely unstaked, immediately.
///
/// The dispatch origin must be Root.
///
/// ## Parameters
///
/// - `num_slashing_spans`: Refer to comments on [`Call::withdraw_unbonded`] for more
/// details.
#[pallet::call_index(15)]
#[pallet::weight(T::WeightInfo::force_unstake(*num_slashing_spans))]
pub fn force_unstake(
Expand Down Expand Up @@ -1519,6 +1533,11 @@ pub mod pallet {
/// It can be called by anyone, as long as `stash` meets the above requirements.
///
/// Refunds the transaction fees upon successful execution.
///
/// ## Parameters
///
/// - `num_slashing_spans`: Refer to comments on [`Call::withdraw_unbonded`] for more
/// details.
#[pallet::call_index(20)]
#[pallet::weight(T::WeightInfo::reap_stash(*num_slashing_spans))]
pub fn reap_stash(
Expand Down