cleanup <weight></weight> from docs comments (#13350)

* cleanup <weight></weight> from docs comments

* Changes to address review commnets

* Fix CI cargo test --docs

---------

Co-authored-by: parity-processbot <>
This commit is contained in:
Vivek Pandya
2023-02-14 19:39:36 +05:30
committed by GitHub
parent 56b90e199d
commit 35e8e137c5
22 changed files with 202 additions and 635 deletions
+19 -54
View File
@@ -840,15 +840,13 @@ pub mod pallet {
/// The dispatch origin for this call must be _Signed_ by the stash account.
///
/// Emits `Bonded`.
/// # <weight>
/// ## Complexity
/// - Independent of the arguments. Moderate complexity.
/// - O(1).
/// - Three extra DB entries.
///
/// NOTE: Two of the storage writes (`Self::bonded`, `Self::payee`) are _never_ cleaned
/// unless the `origin` falls below _existential deposit_ and gets removed as dust.
/// ------------------
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::bond())]
pub fn bond(
@@ -915,10 +913,9 @@ pub mod pallet {
///
/// Emits `Bonded`.
///
/// # <weight>
/// ## Complexity
/// - Independent of the arguments. Insignificant complexity.
/// - O(1).
/// # </weight>
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::bond_extra())]
pub fn bond_extra(
@@ -1076,10 +1073,9 @@ pub mod pallet {
///
/// See also [`Call::unbond`].
///
/// # <weight>
/// Complexity O(S) where S is the number of slashing spans to remove
/// ## Complexity
/// O(S) where S is the number of slashing spans to remove
/// NOTE: Weight annotation is the kill scenario, we refund otherwise.
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::withdraw_unbonded_kill(*num_slashing_spans))]
pub fn withdraw_unbonded(
@@ -1136,11 +1132,10 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash.
///
/// # <weight>
/// ## Complexity
/// - The transaction's complexity is proportional to the size of `targets` (N)
/// which is capped at CompactAssignments::LIMIT (T::MaxNominations).
/// - Both the reads and writes follow a similar pattern.
/// # </weight>
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::nominate(targets.len() as u32))]
pub fn nominate(
@@ -1205,11 +1200,10 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash.
///
/// # <weight>
/// ## Complexity
/// - Independent of the arguments. Insignificant complexity.
/// - Contains one read.
/// - Writes are limited to the `origin` account key.
/// # </weight>
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::chill())]
pub fn chill(origin: OriginFor<T>) -> DispatchResult {
@@ -1225,16 +1219,12 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash.
///
/// # <weight>
/// ## Complexity
/// - O(1)
/// - Independent of the arguments. Insignificant complexity.
/// - Contains a limited number of reads.
/// - Writes are limited to the `origin` account key.
/// ---------
/// - Weight: O(1)
/// - DB Weight:
/// - Read: Ledger
/// - Write: Payee
/// # </weight>
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::set_payee())]
pub fn set_payee(
@@ -1254,16 +1244,11 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the stash, not the controller.
///
/// # <weight>
/// ## Complexity
/// O(1)
/// - Independent of the arguments. Insignificant complexity.
/// - Contains a limited number of reads.
/// - Writes are limited to the `origin` account key.
/// ----------
/// Weight: O(1)
/// DB Weight:
/// - Read: Bonded, Ledger New Controller, Ledger Old Controller
/// - Write: Bonded, Ledger New Controller, Ledger Old Controller
/// # </weight>
#[pallet::call_index(8)]
#[pallet::weight(T::WeightInfo::set_controller())]
pub fn set_controller(
@@ -1289,10 +1274,8 @@ pub mod pallet {
///
/// The dispatch origin must be Root.
///
/// # <weight>
/// Weight: O(1)
/// Write: Validator Count
/// # </weight>
/// ## Complexity
/// O(1)
#[pallet::call_index(9)]
#[pallet::weight(T::WeightInfo::set_validator_count())]
pub fn set_validator_count(
@@ -1315,9 +1298,8 @@ pub mod pallet {
///
/// The dispatch origin must be Root.
///
/// # <weight>
/// ## Complexity
/// Same as [`Self::set_validator_count`].
/// # </weight>
#[pallet::call_index(10)]
#[pallet::weight(T::WeightInfo::set_validator_count())]
pub fn increase_validator_count(
@@ -1341,9 +1323,8 @@ pub mod pallet {
///
/// The dispatch origin must be Root.
///
/// # <weight>
/// ## Complexity
/// Same as [`Self::set_validator_count`].
/// # </weight>
#[pallet::call_index(11)]
#[pallet::weight(T::WeightInfo::set_validator_count())]
pub fn scale_validator_count(origin: OriginFor<T>, factor: Percent) -> DispatchResult {
@@ -1370,11 +1351,9 @@ pub mod pallet {
/// Thus the election process may be ongoing when this is called. In this case the
/// election will continue until the next era is triggered.
///
/// # <weight>
/// ## Complexity
/// - No arguments.
/// - Weight: O(1)
/// - Write: ForceEra
/// # </weight>
#[pallet::call_index(12)]
#[pallet::weight(T::WeightInfo::force_no_eras())]
pub fn force_no_eras(origin: OriginFor<T>) -> DispatchResult {
@@ -1394,11 +1373,9 @@ pub mod pallet {
/// If this is called just before a new era is triggered, the election process may not
/// have enough blocks to get a result.
///
/// # <weight>
/// ## Complexity
/// - No arguments.
/// - Weight: O(1)
/// - Write ForceEra
/// # </weight>
#[pallet::call_index(13)]
#[pallet::weight(T::WeightInfo::force_new_era())]
pub fn force_new_era(origin: OriginFor<T>) -> DispatchResult {
@@ -1497,18 +1474,8 @@ pub mod pallet {
/// The origin of this call must be _Signed_. Any account can call this function, even if
/// it is not one of the stakers.
///
/// # <weight>
/// - Time complexity: at most O(MaxNominatorRewardedPerValidator).
/// - Contains a limited number of reads and writes.
/// -----------
/// N is the Number of payouts for the validator (including the validator)
/// Weight:
/// - Reward Destination Staked: O(N)
/// - Reward Destination Controller (Creating): O(N)
///
/// NOTE: weights are assuming that payouts are made to alive stash account (Staked).
/// Paying even a dead controller is cheaper weight-wise. We don't do any refunds here.
/// # </weight>
/// ## Complexity
/// - At most O(MaxNominatorRewardedPerValidator).
#[pallet::call_index(18)]
#[pallet::weight(T::WeightInfo::payout_stakers_alive_staked(
T::MaxNominatorRewardedPerValidator::get()
@@ -1526,11 +1493,9 @@ pub mod pallet {
///
/// The dispatch origin must be signed by the controller.
///
/// # <weight>
/// ## Complexity
/// - Time complexity: O(L), where L is unlocking chunks
/// - Bounded by `MaxUnlockingChunks`.
/// - Storage changes: Can't increase storage, only decrease it.
/// # </weight>
#[pallet::call_index(19)]
#[pallet::weight(T::WeightInfo::rebond(T::MaxUnlockingChunks::get() as u32))]
pub fn rebond(