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

Commit

Permalink
Improves documentation on num_slashing_spans when calling `withdraw…
Browse files Browse the repository at this point in the history
…_unbounded` in Staking. (#14185)

* gpestana/11714-num_slashing_spans_docs

* Update frame/staking/src/pallet/mod.rs

Co-authored-by: Kian Paimani <[email protected]>

* All calls that take num_slashing_span as parameters refer to comments on it

---------

Co-authored-by: Kian Paimani <[email protected]>
  • Loading branch information
gpestana and kianenigma authored May 27, 2023
1 parent 8b1af50 commit 10f06f4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions frame/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,15 +1040,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
///
/// - `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 @@ -1377,6 +1386,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 @@ -1517,6 +1531,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

0 comments on commit 10f06f4

Please sign in to comment.