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
+13 -69
View File
@@ -364,19 +364,11 @@ pub mod pallet {
/// Any call to `set_members` must be careful that the member set doesn't get out of sync
/// with other logic managing the member set.
///
/// # <weight>
/// ## Weight
/// ## Complexity:
/// - `O(MP + N)` where:
/// - `M` old-members-count (code- and governance-bounded)
/// - `N` new-members-count (code- and governance-bounded)
/// - `P` proposals-count (code-bounded)
/// - DB:
/// - 1 storage mutation (codec `O(M)` read, `O(N)` write) for reading and writing the
/// members
/// - 1 storage read (codec `O(P)`) for reading the proposals
/// - `P` storage mutations (codec `O(M)`) for updating the votes for each proposal
/// - 1 storage write (codec `O(1)`) for deleting the old `prime` and setting the new one
/// # </weight>
#[pallet::call_index(0)]
#[pallet::weight((
T::WeightInfo::set_members(
@@ -428,13 +420,11 @@ pub mod pallet {
///
/// Origin must be a member of the collective.
///
/// # <weight>
/// ## Weight
/// - `O(M + P)` where `M` members-count (code-bounded) and `P` complexity of dispatching
/// `proposal`
/// - DB: 1 read (codec `O(M)`) + DB access of `proposal`
/// - 1 event
/// # </weight>
/// ## Complexity:
/// - `O(B + M + P)` where:
/// - `B` is `proposal` size in bytes (length-fee-bounded)
/// - `M` members-count (code-bounded)
/// - `P` complexity of dispatching `proposal`
#[pallet::call_index(1)]
#[pallet::weight((
T::WeightInfo::execute(
@@ -479,26 +469,13 @@ pub mod pallet {
/// `threshold` determines whether `proposal` is executed directly (`threshold < 2`)
/// or put up for voting.
///
/// # <weight>
/// ## Weight
/// ## Complexity
/// - `O(B + M + P1)` or `O(B + M + P2)` where:
/// - `B` is `proposal` size in bytes (length-fee-bounded)
/// - `M` is members-count (code- and governance-bounded)
/// - branching is influenced by `threshold` where:
/// - `P1` is proposal execution complexity (`threshold < 2`)
/// - `P2` is proposals-count (code-bounded) (`threshold >= 2`)
/// - DB:
/// - 1 storage read `is_member` (codec `O(M)`)
/// - 1 storage read `ProposalOf::contains_key` (codec `O(1)`)
/// - DB accesses influenced by `threshold`:
/// - EITHER storage accesses done by `proposal` (`threshold < 2`)
/// - OR proposal insertion (`threshold <= 2`)
/// - 1 storage mutation `Proposals` (codec `O(P2)`)
/// - 1 storage mutation `ProposalCount` (codec `O(1)`)
/// - 1 storage write `ProposalOf` (codec `O(B)`)
/// - 1 storage write `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(2)]
#[pallet::weight((
if *threshold < 2 {
@@ -557,14 +534,8 @@ pub mod pallet {
/// Transaction fees will be waived if the member is voting on any particular proposal
/// for the first time and the call is successful. Subsequent vote changes will charge a
/// fee.
/// # <weight>
/// ## Weight
/// ## Complexity
/// - `O(M)` where `M` is members-count (code- and governance-bounded)
/// - DB:
/// - 1 storage read `Members` (codec `O(M)`)
/// - 1 storage mutation `Voting` (codec `O(M)`)
/// - 1 event
/// # </weight>
#[pallet::call_index(3)]
#[pallet::weight((T::WeightInfo::vote(T::MaxMembers::get()), DispatchClass::Operational))]
pub fn vote(
@@ -605,20 +576,12 @@ pub mod pallet {
/// + `length_bound`: The upper bound for the length of the proposal in storage. Checked via
/// `storage::read` so it is `size_of::<u32>() == 4` larger than the pure length.
///
/// # <weight>
/// ## Weight
/// ## Complexity
/// - `O(B + M + P1 + P2)` where:
/// - `B` is `proposal` size in bytes (length-fee-bounded)
/// - `M` is members-count (code- and governance-bounded)
/// - `P1` is the complexity of `proposal` preimage.
/// - `P2` is proposal-count (code-bounded)
/// - DB:
/// - 2 storage reads (`Members`: codec `O(M)`, `Prime`: codec `O(1)`)
/// - 3 mutations (`Voting`: codec `O(M)`, `ProposalOf`: codec `O(B)`, `Proposals`: codec
/// `O(P2)`)
/// - any mutations done while executing `proposal` (`P1`)
/// - up to 3 events
/// # </weight>
#[pallet::call_index(4)]
#[pallet::weight((
{
@@ -657,12 +620,8 @@ pub mod pallet {
/// Parameters:
/// * `proposal_hash`: The hash of the proposal that should be disapproved.
///
/// # <weight>
/// Complexity: O(P) where P is the number of max proposals
/// DB Weight:
/// * Reads: Proposals
/// * Writes: Voting, Proposals, ProposalOf
/// # </weight>
/// ## Complexity
/// O(P) where P is the number of max proposals
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::disapprove_proposal(T::MaxProposals::get()))]
pub fn disapprove_proposal(
@@ -692,20 +651,12 @@ pub mod pallet {
/// + `length_bound`: The upper bound for the length of the proposal in storage. Checked via
/// `storage::read` so it is `size_of::<u32>() == 4` larger than the pure length.
///
/// # <weight>
/// ## Weight
/// ## Complexity
/// - `O(B + M + P1 + P2)` where:
/// - `B` is `proposal` size in bytes (length-fee-bounded)
/// - `M` is members-count (code- and governance-bounded)
/// - `P1` is the complexity of `proposal` preimage.
/// - `P2` is proposal-count (code-bounded)
/// - DB:
/// - 2 storage reads (`Members`: codec `O(M)`, `Prime`: codec `O(1)`)
/// - 3 mutations (`Voting`: codec `O(M)`, `ProposalOf`: codec `O(B)`, `Proposals`: codec
/// `O(P2)`)
/// - any mutations done while executing `proposal` (`P1`)
/// - up to 3 events
/// # </weight>
#[pallet::call_index(6)]
#[pallet::weight((
{
@@ -1026,18 +977,11 @@ impl<T: Config<I>, I: 'static> ChangeMembers<T::AccountId> for Pallet<T, I> {
/// NOTE: Does not enforce the expected `MaxMembers` limit on the amount of members, but
/// the weight estimations rely on it to estimate dispatchable weight.
///
/// # <weight>
/// ## Weight
/// ## Complexity
/// - `O(MP + N)`
/// - where `M` old-members-count (governance-bounded)
/// - where `N` new-members-count (governance-bounded)
/// - where `P` proposals-count
/// - DB:
/// - 1 storage read (codec `O(P)`) for reading the proposals
/// - `P` storage mutations for updating the votes (codec `O(M)`)
/// - 1 storage write (codec `O(N)`) for storing the new members
/// - 1 storage write (codec `O(1)`) for deleting the old prime
/// # </weight>
fn change_members_sorted(
_incoming: &[T::AccountId],
outgoing: &[T::AccountId],