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

* gpestana/11714-num_slashing_spans_docs

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

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

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

---------

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Gonçalo Pestana
2023-05-27 16:46:07 +02:00
committed by GitHub
parent 3320076f8a
commit 6d120d1890
+21 -2
View File
@@ -1040,8 +1040,8 @@ 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.
///
@@ -1049,6 +1049,15 @@ pub mod pallet {
///
/// 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.
@@ -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(
@@ -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(