From 68032aef1783c087eb32fc52b9a7e76d50989af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Pestana?= Date: Mon, 22 May 2023 00:27:57 +0200 Subject: [PATCH 1/3] gpestana/11714-num_slashing_spans_docs --- frame/staking/src/pallet/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frame/staking/src/pallet/mod.rs b/frame/staking/src/pallet/mod.rs index 2b33573ac210f..a9f81a3afbe47 100644 --- a/frame/staking/src/pallet/mod.rs +++ b/frame/staking/src/pallet/mod.rs @@ -1042,8 +1042,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. /// @@ -1051,6 +1051,14 @@ pub mod pallet { /// /// See also [`Call::unbond`]. /// + /// ## Parameters + /// - `num_slashing_spans` indicates the number of metadata slashing spans to clear when + /// the call to [`Call::withdraw_unbounded`] 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. From c28666e6600f084e6990137ad0709e981c5c2ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Pestana?= Date: Sat, 27 May 2023 15:31:56 +0200 Subject: [PATCH 2/3] Update frame/staking/src/pallet/mod.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> --- frame/staking/src/pallet/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/frame/staking/src/pallet/mod.rs b/frame/staking/src/pallet/mod.rs index a9f81a3afbe47..da45b8af81a53 100644 --- a/frame/staking/src/pallet/mod.rs +++ b/frame/staking/src/pallet/mod.rs @@ -1052,6 +1052,7 @@ pub mod pallet { /// See also [`Call::unbond`]. /// /// ## Parameters + /// /// - `num_slashing_spans` indicates the number of metadata slashing spans to clear when /// the call to [`Call::withdraw_unbounded`] 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 From 74c057e0073f8694726c6761cdaf0b631086230a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Pestana?= Date: Sat, 27 May 2023 15:58:49 +0200 Subject: [PATCH 3/3] All calls that take num_slashing_span as parameters refer to comments on it --- frame/staking/src/pallet/mod.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frame/staking/src/pallet/mod.rs b/frame/staking/src/pallet/mod.rs index da45b8af81a53..91cdc2ce08545 100644 --- a/frame/staking/src/pallet/mod.rs +++ b/frame/staking/src/pallet/mod.rs @@ -1054,11 +1054,11 @@ pub mod pallet { /// ## Parameters /// /// - `num_slashing_spans` indicates the number of metadata slashing spans to clear when - /// the call to [`Call::withdraw_unbounded`] 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`. + /// 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 @@ -1388,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( @@ -1528,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(