mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 13:01:07 +00:00
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:
@@ -267,7 +267,7 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be `Signed` by the transactor.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - Dependent on arguments but not critical, given proper implementations for input config
|
||||
/// types. See related functions below.
|
||||
/// - It contains a limited number of reads and writes internally and no complex
|
||||
@@ -281,9 +281,6 @@ pub mod pallet {
|
||||
/// - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
|
||||
/// - `transfer_keep_alive` works the same way as `transfer`, but has an additional check
|
||||
/// that the transfer will not kill the origin account.
|
||||
/// ---------------------------------
|
||||
/// - Origin account is already in memory, so no DB operations for them.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::transfer())]
|
||||
pub fn transfer(
|
||||
@@ -360,10 +357,9 @@ pub mod pallet {
|
||||
|
||||
/// Exactly as `transfer`, except the origin must be root and the source account may be
|
||||
/// specified.
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - Same as transfer, but additional read and write because the source account is not
|
||||
/// assumed to be in the overlay.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::WeightInfo::force_transfer())]
|
||||
pub fn force_transfer(
|
||||
@@ -417,9 +413,8 @@ pub mod pallet {
|
||||
/// - `keep_alive`: A boolean to determine if the `transfer_all` operation should send all
|
||||
/// of the funds the account has, causing the sender account to be killed (false), or
|
||||
/// transfer everything except at least the existential deposit, which will guarantee to
|
||||
/// keep the sender account alive (true). # <weight>
|
||||
/// keep the sender account alive (true). ## Complexity
|
||||
/// - O(1). Just like transfer, but reading the user's transferable balance first.
|
||||
/// #</weight>
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::WeightInfo::transfer_all())]
|
||||
pub fn transfer_all(
|
||||
@@ -1484,10 +1479,9 @@ where
|
||||
// restrictions like locks and vesting balance.
|
||||
// Is a no-op if amount to be withdrawn is zero.
|
||||
//
|
||||
// # <weight>
|
||||
// ## Complexity
|
||||
// Despite iterating over a list of locks, they are limited by the number of
|
||||
// lock IDs, which means the number of runtime pallets that intend to use and create locks.
|
||||
// # </weight>
|
||||
fn ensure_can_withdraw(
|
||||
who: &T::AccountId,
|
||||
amount: T::Balance,
|
||||
|
||||
@@ -349,9 +349,8 @@ pub mod pallet {
|
||||
///
|
||||
/// May only be called from `T::SpendOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::approve_bounty())]
|
||||
pub fn approve_bounty(
|
||||
@@ -381,9 +380,8 @@ pub mod pallet {
|
||||
///
|
||||
/// May only be called from `T::SpendOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::propose_curator())]
|
||||
pub fn propose_curator(
|
||||
@@ -431,9 +429,8 @@ pub mod pallet {
|
||||
/// anyone in the community to call out that a curator is not doing their due diligence, and
|
||||
/// we should pick a new curator. In this case the curator should also be slashed.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::unassign_curator())]
|
||||
pub fn unassign_curator(
|
||||
@@ -517,9 +514,8 @@ pub mod pallet {
|
||||
///
|
||||
/// May only be called from the curator.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::accept_curator())]
|
||||
pub fn accept_curator(
|
||||
@@ -560,9 +556,8 @@ pub mod pallet {
|
||||
/// - `bounty_id`: Bounty ID to award.
|
||||
/// - `beneficiary`: The beneficiary account whom will receive the payout.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::award_bounty())]
|
||||
pub fn award_bounty(
|
||||
@@ -608,9 +603,8 @@ pub mod pallet {
|
||||
///
|
||||
/// - `bounty_id`: Bounty ID to claim.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::claim_bounty())]
|
||||
pub fn claim_bounty(
|
||||
@@ -672,9 +666,8 @@ pub mod pallet {
|
||||
///
|
||||
/// - `bounty_id`: Bounty ID to cancel.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::close_bounty_proposed()
|
||||
.max(<T as Config<I>>::WeightInfo::close_bounty_active()))]
|
||||
@@ -764,9 +757,8 @@ pub mod pallet {
|
||||
/// - `bounty_id`: Bounty ID to extend.
|
||||
/// - `remark`: additional information.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::extend_bounty_expiry())]
|
||||
pub fn extend_bounty_expiry(
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -1617,15 +1617,9 @@ impl<T: Config> Pallet<T> {
|
||||
/// Current era is ending; we should finish up any proposals.
|
||||
///
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity:
|
||||
/// If a referendum is launched or maturing, this will take full block weight if queue is not
|
||||
/// empty. Otherwise:
|
||||
/// - Complexity: `O(R)` where `R` is the number of unbaked referenda.
|
||||
/// - Db reads: `LastTabledWasExternal`, `NextExternal`, `PublicProps`, `account`,
|
||||
/// `ReferendumCount`, `LowestUnbaked`
|
||||
/// - Db writes: `PublicProps`, `account`, `ReferendumCount`, `DepositOf`, `ReferendumInfoOf`
|
||||
/// - Db reads per R: `DepositOf`, `ReferendumInfoOf`
|
||||
/// # </weight>
|
||||
/// empty. Otherwise, `O(R)` where `R` is the number of unbaked referenda.
|
||||
fn begin_block(now: T::BlockNumber) -> Weight {
|
||||
let max_block_weight = T::BlockWeights::get().max_block;
|
||||
let mut weight = Weight::zero();
|
||||
|
||||
@@ -435,9 +435,9 @@ pub mod pallet {
|
||||
/// Even if a candidate ends up being a member, they must call [`Call::renounce_candidacy`]
|
||||
/// to get their deposit back. Losing the spot in an election will always lead to a slash.
|
||||
///
|
||||
/// # <weight>
|
||||
/// The number of current candidates must be provided as witness data.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// O(C + log(C)) where C is candidate_count.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::WeightInfo::submit_candidacy(*candidate_count))]
|
||||
pub fn submit_candidacy(
|
||||
@@ -479,10 +479,12 @@ pub mod pallet {
|
||||
/// next round.
|
||||
///
|
||||
/// The dispatch origin of this call must be signed, and have one of the above roles.
|
||||
///
|
||||
/// # <weight>
|
||||
/// The type of renouncing must be provided as witness data.
|
||||
/// # </weight>
|
||||
///
|
||||
/// ## Complexity
|
||||
/// - Renouncing::Candidate(count): O(count + log(count))
|
||||
/// - Renouncing::Member: O(1)
|
||||
/// - Renouncing::RunnerUp: O(1)
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(match *renouncing {
|
||||
Renouncing::Candidate(count) => T::WeightInfo::renounce_candidacy_candidate(count),
|
||||
@@ -542,10 +544,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Note that this does not affect the designated block number of the next election.
|
||||
///
|
||||
/// # <weight>
|
||||
/// If we have a replacement, we use a small weight. Else, since this is a root call and
|
||||
/// will go into phragmen, we assume full block for now.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - Check details of remove_and_replace_member() and do_phragmen().
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(if *rerun_election {
|
||||
T::WeightInfo::remove_member_without_replacement()
|
||||
@@ -579,9 +579,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin of this call must be root.
|
||||
///
|
||||
/// # <weight>
|
||||
/// The total number of voters and those that are defunct must be provided as witness data.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - Check is_defunct_voter() details.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::WeightInfo::clean_defunct_voters(*_num_voters, *_num_defunct))]
|
||||
pub fn clean_defunct_voters(
|
||||
|
||||
@@ -279,11 +279,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `RegistrarAdded` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R)` where `R` registrar-count (governance-bounded and code-bounded).
|
||||
/// - One storage mutation (codec `O(R)`).
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::add_registrar(T::MaxRegistrars::get()))]
|
||||
pub fn add_registrar(
|
||||
@@ -322,14 +319,10 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IdentitySet` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(X + X' + R)`
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded)
|
||||
/// - where `R` judgements-count (registrar-count-bounded)
|
||||
/// - One balance reserve operation.
|
||||
/// - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight( T::WeightInfo::set_identity(
|
||||
T::MaxRegistrars::get(), // R
|
||||
@@ -389,17 +382,10 @@ pub mod pallet {
|
||||
///
|
||||
/// - `subs`: The identity's (new) sub-accounts.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(P + S)`
|
||||
/// - where `P` old-subs-count (hard- and deposit-bounded).
|
||||
/// - where `S` subs-count (hard- and deposit-bounded).
|
||||
/// - At most one balance operations.
|
||||
/// - DB:
|
||||
/// - `P + S` storage mutations (codec complexity `O(1)`)
|
||||
/// - One storage read (codec complexity `O(P)`).
|
||||
/// - One storage write (codec complexity `O(S)`).
|
||||
/// - One storage-exists (`IdentityOf::contains_key`).
|
||||
/// # </weight>
|
||||
// TODO: This whole extrinsic screams "not optimized". For example we could
|
||||
// filter any overlap between new and old subs, and avoid reading/writing
|
||||
// to those values... We could also ideally avoid needing to write to
|
||||
@@ -469,15 +455,11 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IdentityCleared` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R + S + X)`
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
/// - where `S` subs-count (hard- and deposit-bounded).
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded).
|
||||
/// - One balance-unreserve operation.
|
||||
/// - `2` storage reads and `S + 2` storage deletions.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::WeightInfo::clear_identity(
|
||||
T::MaxRegistrars::get(), // R
|
||||
@@ -524,12 +506,10 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `JudgementRequested` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R + X)`.
|
||||
/// - One balance-reserve operation.
|
||||
/// - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded).
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::WeightInfo::request_judgement(
|
||||
T::MaxRegistrars::get(), // R
|
||||
@@ -587,12 +567,10 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `JudgementUnrequested` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R + X)`.
|
||||
/// - One balance-reserve operation.
|
||||
/// - One storage mutation `O(R + X)`.
|
||||
/// - One event
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded).
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::WeightInfo::cancel_request(
|
||||
T::MaxRegistrars::get(), // R
|
||||
@@ -637,11 +615,9 @@ pub mod pallet {
|
||||
/// - `index`: the index of the registrar whose fee is to be set.
|
||||
/// - `fee`: the new fee.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R)`.
|
||||
/// - One storage mutation `O(R)`.
|
||||
/// - Benchmark: 7.315 + R * 0.329 µs (min squares analysis)
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(T::WeightInfo::set_fee(T::MaxRegistrars::get()))] // R
|
||||
pub fn set_fee(
|
||||
@@ -676,11 +652,9 @@ pub mod pallet {
|
||||
/// - `index`: the index of the registrar whose fee is to be set.
|
||||
/// - `new`: the new account ID.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R)`.
|
||||
/// - One storage mutation `O(R)`.
|
||||
/// - Benchmark: 8.823 + R * 0.32 µs (min squares analysis)
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(T::WeightInfo::set_account_id(T::MaxRegistrars::get()))] // R
|
||||
pub fn set_account_id(
|
||||
@@ -716,11 +690,9 @@ pub mod pallet {
|
||||
/// - `index`: the index of the registrar whose fee is to be set.
|
||||
/// - `fields`: the fields that the registrar concerns themselves with.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R)`.
|
||||
/// - One storage mutation `O(R)`.
|
||||
/// - Benchmark: 7.464 + R * 0.325 µs (min squares analysis)
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(T::WeightInfo::set_fields(T::MaxRegistrars::get()))] // R
|
||||
pub fn set_fields(
|
||||
@@ -763,13 +735,10 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `JudgementGiven` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R + X)`.
|
||||
/// - One balance-transfer operation.
|
||||
/// - Up to one account-lookup operation.
|
||||
/// - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded).
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight(T::WeightInfo::provide_judgement(
|
||||
T::MaxRegistrars::get(), // R
|
||||
@@ -838,12 +807,11 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IdentityKilled` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - `O(R + S + X)`.
|
||||
/// - One balance-reserve operation.
|
||||
/// - `S + 2` storage mutations.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - `O(R + S + X)`
|
||||
/// - where `R` registrar-count (governance-bounded).
|
||||
/// - where `S` subs-count (hard- and deposit-bounded).
|
||||
/// - where `X` additional-field-count (deposit-bounded and code-bounded).
|
||||
#[pallet::call_index(10)]
|
||||
#[pallet::weight(T::WeightInfo::kill_identity(
|
||||
T::MaxRegistrars::get(), // R
|
||||
|
||||
@@ -463,15 +463,11 @@ pub mod pallet {
|
||||
|
||||
#[pallet::call]
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(K + E)` where K is length of `Keys` (heartbeat.validators_len) and E is
|
||||
/// length of `heartbeat.network_state.external_address`
|
||||
/// ## Complexity:
|
||||
/// - `O(K + E)` where K is length of `Keys` (heartbeat.validators_len) and E is length of
|
||||
/// `heartbeat.network_state.external_address`
|
||||
/// - `O(K)`: decoding of length `K`
|
||||
/// - `O(E)`: decoding/encoding of length `E`
|
||||
/// - DbReads: pallet_session `Validators`, pallet_session `CurrentIndex`, `Keys`,
|
||||
/// `ReceivedHeartbeats`
|
||||
/// - DbWrites: `ReceivedHeartbeats`
|
||||
/// # </weight>
|
||||
// NOTE: the weight includes the cost of validate_unsigned as it is part of the cost to
|
||||
// import block with such an extrinsic.
|
||||
#[pallet::call_index(0)]
|
||||
|
||||
@@ -90,14 +90,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IndexAssigned` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - One storage mutation (codec `O(1)`).
|
||||
/// - One reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::claim())]
|
||||
pub fn claim(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
|
||||
@@ -122,16 +116,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IndexAssigned` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - One storage mutation (codec `O(1)`).
|
||||
/// - One transfer operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - DB Weight:
|
||||
/// - Reads: Indices Accounts, System Account (recipient)
|
||||
/// - Writes: Indices Accounts, System Account (recipient)
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::transfer())]
|
||||
pub fn transfer(
|
||||
@@ -165,14 +151,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IndexFreed` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - One storage mutation (codec `O(1)`).
|
||||
/// - One reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::WeightInfo::free())]
|
||||
pub fn free(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
|
||||
@@ -200,16 +180,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IndexAssigned` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - One storage mutation (codec `O(1)`).
|
||||
/// - Up to one reserve operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - DB Weight:
|
||||
/// - Reads: Indices Accounts, System Account (original owner)
|
||||
/// - Writes: Indices Accounts, System Account (original owner)
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::WeightInfo::force_transfer())]
|
||||
pub fn force_transfer(
|
||||
@@ -241,14 +213,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `IndexFrozen` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - One storage mutation (codec `O(1)`).
|
||||
/// - Up to one slash operation.
|
||||
/// - One event.
|
||||
/// -------------------
|
||||
/// - DB Weight: 1 Read/Write (Accounts)
|
||||
/// # </weight>
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::WeightInfo::freeze())]
|
||||
pub fn freeze(origin: OriginFor<T>, index: T::AccountIndex) -> DispatchResult {
|
||||
|
||||
@@ -263,12 +263,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Result is equivalent to the dispatched result.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// O(Z + C) where Z is the length of the call and C its execution weight.
|
||||
/// -------------------------------
|
||||
/// - DB Weight: None
|
||||
/// - Plus Call Weight
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
@@ -344,7 +340,7 @@ pub mod pallet {
|
||||
/// on success, result is `Ok` and the result from the interior call, if it was executed,
|
||||
/// may be found in the deposited `MultisigExecuted` event.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(S + Z + Call)`.
|
||||
/// - Up to one balance-reserve or unreserve operation.
|
||||
/// - One passthrough operation, one insert, both `O(S)` where `S` is the number of
|
||||
@@ -357,12 +353,6 @@ pub mod pallet {
|
||||
/// - The weight of the `call`.
|
||||
/// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit
|
||||
/// taken for its lifetime of `DepositBase + threshold * DepositFactor`.
|
||||
/// -------------------------------
|
||||
/// - DB Weight:
|
||||
/// - Reads: Multisig Storage, [Caller Account]
|
||||
/// - Writes: Multisig Storage, [Caller Account]
|
||||
/// - Plus Call Weight
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight({
|
||||
let s = other_signatories.len() as u32;
|
||||
@@ -411,7 +401,7 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE: If this is the final approval, you will want to use `as_multi` instead.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(S)`.
|
||||
/// - Up to one balance-reserve or unreserve operation.
|
||||
/// - One passthrough operation, one insert, both `O(S)` where `S` is the number of
|
||||
@@ -422,11 +412,6 @@ pub mod pallet {
|
||||
/// - One event.
|
||||
/// - Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit
|
||||
/// taken for its lifetime of `DepositBase + threshold * DepositFactor`.
|
||||
/// ----------------------------------
|
||||
/// - DB Weight:
|
||||
/// - Read: Multisig Storage, [Caller Account]
|
||||
/// - Write: Multisig Storage, [Caller Account]
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight({
|
||||
let s = other_signatories.len() as u32;
|
||||
@@ -466,7 +451,7 @@ pub mod pallet {
|
||||
/// transaction for this dispatch.
|
||||
/// - `call_hash`: The hash of the call to be executed.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(S)`.
|
||||
/// - Up to one balance-reserve or unreserve operation.
|
||||
/// - One passthrough operation, one insert, both `O(S)` where `S` is the number of
|
||||
@@ -475,11 +460,6 @@ pub mod pallet {
|
||||
/// - One event.
|
||||
/// - I/O: 1 read `O(S)`, one remove.
|
||||
/// - Storage: removes one item.
|
||||
/// ----------------------------------
|
||||
/// - DB Weight:
|
||||
/// - Read: Multisig Storage, [Caller Account], Refund Account
|
||||
/// - Write: Multisig Storage, [Caller Account], Refund Account
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::WeightInfo::cancel_as_multi(other_signatories.len() as u32))]
|
||||
pub fn cancel_as_multi(
|
||||
|
||||
@@ -129,12 +129,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - At most one balance operation.
|
||||
/// - One storage read/write.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(50_000_000)]
|
||||
pub fn set_name(origin: OriginFor<T>, name: Vec<u8>) -> DispatchResult {
|
||||
@@ -162,12 +158,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - One balance operation.
|
||||
/// - One storage read/write.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(70_000_000)]
|
||||
pub fn clear_name(origin: OriginFor<T>) -> DispatchResult {
|
||||
@@ -189,12 +181,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must match `T::ForceOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - One unbalanced handler (probably a balance transfer)
|
||||
/// - One storage read/write.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(70_000_000)]
|
||||
pub fn kill_name(origin: OriginFor<T>, target: AccountIdLookupOf<T>) -> DispatchResult {
|
||||
@@ -217,12 +205,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must match `T::ForceOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - At most one balance operation.
|
||||
/// - One storage read/write.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(70_000_000)]
|
||||
pub fn force_name(
|
||||
|
||||
@@ -363,10 +363,6 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Anonymously schedule a task after a delay.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Same as [`schedule`].
|
||||
/// # </weight>
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::schedule(T::MaxScheduledPerBlock::get()))]
|
||||
pub fn schedule_after(
|
||||
@@ -389,10 +385,6 @@ pub mod pallet {
|
||||
}
|
||||
|
||||
/// Schedule a named task after a delay.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Same as [`schedule_named`](Self::schedule_named).
|
||||
/// # </weight>
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config>::WeightInfo::schedule_named(T::MaxScheduledPerBlock::get()))]
|
||||
pub fn schedule_named_after(
|
||||
|
||||
@@ -587,14 +587,9 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin of this function must be signed.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(1)`. Actual cost depends on the number of length of
|
||||
/// `T::Keys::key_ids()` which is fixed.
|
||||
/// - DbReads: `origin account`, `T::ValidatorIdOf`, `NextKeys`
|
||||
/// - DbWrites: `origin account`, `NextKeys`
|
||||
/// - DbReads per key id: `KeyOwner`
|
||||
/// - DbWrites per key id: `KeyOwner`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is
|
||||
/// fixed.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::set_keys())]
|
||||
pub fn set_keys(origin: OriginFor<T>, keys: T::Keys, proof: Vec<u8>) -> DispatchResult {
|
||||
@@ -614,13 +609,9 @@ pub mod pallet {
|
||||
/// means being a controller account) or directly convertible into a validator ID (which
|
||||
/// usually means being a stash account).
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(1)` in number of key types. Actual cost depends on the number of length
|
||||
/// of `T::Keys::key_ids()` which is fixed.
|
||||
/// - DbReads: `T::ValidatorIdOf`, `NextKeys`, `origin account`
|
||||
/// - DbWrites: `NextKeys`, `origin account`
|
||||
/// - DbWrites per key id: `KeyOwner`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)` in number of key types. Actual cost depends on the number of length of
|
||||
/// `T::Keys::key_ids()` which is fixed.
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::purge_keys())]
|
||||
pub fn purge_keys(origin: OriginFor<T>) -> DispatchResult {
|
||||
|
||||
@@ -689,30 +689,12 @@ pub mod pallet {
|
||||
/// Parameters:
|
||||
/// - `value`: A one time payment the bid would like to receive when joining the society.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids), C (len of candidates), M (len of members), X (balance reserve)
|
||||
/// - Storage Reads:
|
||||
/// - One storage read to check for suspended candidate. O(1)
|
||||
/// - One storage read to check for suspended member. O(1)
|
||||
/// - One storage read to retrieve all current bids. O(B)
|
||||
/// - One storage read to retrieve all current candidates. O(C)
|
||||
/// - One storage read to retrieve all members. O(M)
|
||||
/// - Storage Writes:
|
||||
/// - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization
|
||||
/// w/ read)
|
||||
/// - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1)
|
||||
/// - Notable Computation:
|
||||
/// - O(B + C + log M) search to check user is not already a part of society.
|
||||
/// - O(log B) search to insert the new bid sorted.
|
||||
/// - External Pallet Operations:
|
||||
/// - One balance reserve operation. O(X)
|
||||
/// - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT.
|
||||
/// - Events:
|
||||
/// - One event for new bid.
|
||||
/// - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT.
|
||||
///
|
||||
/// Total Complexity: O(M + B + C + logM + logB + X)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + B + C + logM + logB + X)
|
||||
/// - B (len of bids)
|
||||
/// - C (len of candidates)
|
||||
/// - M (len of members)
|
||||
/// - X (balance reserve)
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn bid(origin: OriginFor<T>, value: BalanceOf<T, I>) -> DispatchResult {
|
||||
@@ -745,14 +727,10 @@ pub mod pallet {
|
||||
/// Parameters:
|
||||
/// - `pos`: Position in the `Bids` vector of the bid who wants to unbid.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids), X (balance unreserve)
|
||||
/// - One storage read and write to retrieve and update the bids. O(B)
|
||||
/// - Either one unreserve balance action O(X) or one vouching storage removal. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(B + X)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(B + X)
|
||||
/// - B (len of bids)
|
||||
/// - X (balance unreserve)
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn unbid(origin: OriginFor<T>, pos: u32) -> DispatchResult {
|
||||
@@ -799,33 +777,12 @@ pub mod pallet {
|
||||
/// - `tip`: Your cut of the total `value` payout when the candidate is inducted into
|
||||
/// the society. Tips larger than `value` will be saturated upon payout.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids), C (len of candidates), M (len of members)
|
||||
/// - Storage Reads:
|
||||
/// - One storage read to retrieve all members. O(M)
|
||||
/// - One storage read to check member is not already vouching. O(1)
|
||||
/// - One storage read to check for suspended candidate. O(1)
|
||||
/// - One storage read to check for suspended member. O(1)
|
||||
/// - One storage read to retrieve all current bids. O(B)
|
||||
/// - One storage read to retrieve all current candidates. O(C)
|
||||
/// - Storage Writes:
|
||||
/// - One storage write to insert vouching status to the member. O(1)
|
||||
/// - One storage mutate to add a new bid to the vector O(B) (TODO: possible optimization
|
||||
/// w/ read)
|
||||
/// - Up to one storage removal if bid.len() > MAX_BID_COUNT. O(1)
|
||||
/// - Notable Computation:
|
||||
/// - O(log M) search to check sender is a member.
|
||||
/// - O(B + C + log M) search to check user is not already a part of society.
|
||||
/// - O(log B) search to insert the new bid sorted.
|
||||
/// - External Pallet Operations:
|
||||
/// - One balance reserve operation. O(X)
|
||||
/// - Up to one balance unreserve operation if bids.len() > MAX_BID_COUNT.
|
||||
/// - Events:
|
||||
/// - One event for vouch.
|
||||
/// - Up to one event for AutoUnbid if bid.len() > MAX_BID_COUNT.
|
||||
///
|
||||
/// Total Complexity: O(M + B + C + logM + logB + X)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + B + C + logM + logB + X)
|
||||
/// - B (len of bids)
|
||||
/// - C (len of candidates)
|
||||
/// - M (len of members)
|
||||
/// - X (balance reserve)
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn vouch(
|
||||
@@ -869,15 +826,9 @@ pub mod pallet {
|
||||
/// Parameters:
|
||||
/// - `pos`: Position in the `Bids` vector of the bid who should be unvouched.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids)
|
||||
/// - One storage read O(1) to check the signer is a vouching member.
|
||||
/// - One storage mutate to retrieve and update the bids. O(B)
|
||||
/// - One vouching storage removal. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(B)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(B)
|
||||
/// - B (len of bids)
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn unvouch(origin: OriginFor<T>, pos: u32) -> DispatchResult {
|
||||
@@ -910,16 +861,10 @@ pub mod pallet {
|
||||
/// - `approve`: A boolean which says if the candidate should be approved (`true`) or
|
||||
/// rejected (`false`).
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: C (len of candidates), M (len of members)
|
||||
/// - One storage read O(M) and O(log M) search to check user is a member.
|
||||
/// - One account lookup.
|
||||
/// - One storage read O(C) and O(C) search to check that user is a candidate.
|
||||
/// - One storage write to add vote to votes. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(M + logM + C)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + logM + C)
|
||||
/// - C (len of candidates)
|
||||
/// - M (len of members)
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn vote(
|
||||
@@ -949,14 +894,9 @@ pub mod pallet {
|
||||
/// - `approve`: A boolean which says if the candidate should be
|
||||
/// approved (`true`) or rejected (`false`).
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Key: M (len of members)
|
||||
/// - One storage read O(M) and O(log M) search to check user is a member.
|
||||
/// - One storage write to add vote to votes. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(M + logM)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + logM)
|
||||
/// - M (len of members)
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn defender_vote(origin: OriginFor<T>, approve: bool) -> DispatchResult {
|
||||
@@ -982,16 +922,11 @@ pub mod pallet {
|
||||
/// The dispatch origin for this call must be _Signed_ and a member with
|
||||
/// payouts remaining.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: M (len of members), P (number of payouts for a particular member)
|
||||
/// - One storage read O(M) and O(log M) search to check signer is a member.
|
||||
/// - One storage read O(P) to get all payouts for a member.
|
||||
/// - One storage read O(1) to get the current block number.
|
||||
/// - One currency transfer call. O(X)
|
||||
/// - One storage write or removal to update the member's payouts. O(P)
|
||||
///
|
||||
/// Total Complexity: O(M + logM + P + X)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + logM + P + X)
|
||||
/// - M (len of members)
|
||||
/// - P (number of payouts for a particular member)
|
||||
/// - X (currency transfer call)
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn payout(origin: OriginFor<T>) -> DispatchResult {
|
||||
@@ -1028,13 +963,8 @@ pub mod pallet {
|
||||
/// - `max_members` - The initial max number of members for the society.
|
||||
/// - `rules` - The rules of this society concerning membership.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Two storage mutates to set `Head` and `Founder`. O(1)
|
||||
/// - One storage write to add the first member to society. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1)
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn found(
|
||||
@@ -1063,13 +993,8 @@ pub mod pallet {
|
||||
/// the `Founder` and the `Head`. This implies that it may only be done when there is one
|
||||
/// member.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Two storage reads O(1).
|
||||
/// - Four storage removals O(1).
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1)
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn unfound(origin: OriginFor<T>) -> DispatchResult {
|
||||
@@ -1103,19 +1028,10 @@ pub mod pallet {
|
||||
/// - `forgive` - A boolean representing whether the suspension judgement origin forgives
|
||||
/// (`true`) or rejects (`false`) a suspended member.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids), M (len of members)
|
||||
/// - One storage read to check `who` is a suspended member. O(1)
|
||||
/// - Up to one storage write O(M) with O(log M) binary search to add a member back to
|
||||
/// society.
|
||||
/// - Up to 3 storage removals O(1) to clean up a removed member.
|
||||
/// - Up to one storage write O(B) with O(B) search to remove vouched bid from bids.
|
||||
/// - Up to one additional event if unvouch takes place.
|
||||
/// - One storage removal. O(1)
|
||||
/// - One event for the judgement.
|
||||
///
|
||||
/// Total Complexity: O(M + logM + B)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + logM + B)
|
||||
/// - B (len of bids)
|
||||
/// - M (len of members)
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn judge_suspended_member(
|
||||
@@ -1171,29 +1087,11 @@ pub mod pallet {
|
||||
/// - `who` - The suspended candidate to be judged.
|
||||
/// - `judgement` - `Approve`, `Reject`, or `Rebid`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// Key: B (len of bids), M (len of members), X (balance action)
|
||||
/// - One storage read to check `who` is a suspended candidate.
|
||||
/// - One storage removal of the suspended candidate.
|
||||
/// - Approve Logic
|
||||
/// - One storage read to get the available pot to pay users with. O(1)
|
||||
/// - One storage write to update the available pot. O(1)
|
||||
/// - One storage read to get the current block number. O(1)
|
||||
/// - One storage read to get all members. O(M)
|
||||
/// - Up to one unreserve currency action.
|
||||
/// - Up to two new storage writes to payouts.
|
||||
/// - Up to one storage write with O(log M) binary search to add a member to society.
|
||||
/// - Reject Logic
|
||||
/// - Up to one repatriate reserved currency action. O(X)
|
||||
/// - Up to one storage write to ban the vouching member from vouching again.
|
||||
/// - Rebid Logic
|
||||
/// - Storage mutate with O(log B) binary search to place the user back into bids.
|
||||
/// - Up to one additional event if unvouch takes place.
|
||||
/// - One storage removal.
|
||||
/// - One event for the judgement.
|
||||
///
|
||||
/// Total Complexity: O(M + logM + B + X)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(M + logM + B + X)
|
||||
/// - B (len of bids)
|
||||
/// - M (len of members)
|
||||
/// - X (balance action)
|
||||
#[pallet::call_index(10)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn judge_suspended_candidate(
|
||||
@@ -1262,12 +1160,8 @@ pub mod pallet {
|
||||
/// Parameters:
|
||||
/// - `max` - The maximum number of members for the society.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - One storage write to update the max. O(1)
|
||||
/// - One event.
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1)
|
||||
#[pallet::call_index(11)]
|
||||
#[pallet::weight(T::BlockWeights::get().max_block / 10)]
|
||||
pub fn set_max_members(origin: OriginFor<T>, max: u32) -> DispatchResult {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -142,12 +142,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - Limited storage reads.
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + 10,000.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
@@ -173,10 +169,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - The weight of this call is defined by the caller.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight((*_weight, call.get_dispatch_info().class))]
|
||||
pub fn sudo_unchecked_weight(
|
||||
@@ -199,11 +193,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - Limited storage reads.
|
||||
/// - One DB change.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(0)]
|
||||
pub fn set_key(
|
||||
@@ -226,12 +217,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - Limited storage reads.
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + 10,000.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
|
||||
@@ -374,9 +374,8 @@ pub mod pallet {
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Make some on-chain remark.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::SystemWeightInfo::remark(_remark.len() as u32))]
|
||||
pub fn remark(origin: OriginFor<T>, _remark: Vec<u8>) -> DispatchResultWithPostInfo {
|
||||
@@ -396,16 +395,8 @@ pub mod pallet {
|
||||
|
||||
/// Set the new runtime code.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
|
||||
/// - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is
|
||||
/// expensive).
|
||||
/// - 1 storage write (codec `O(C)`).
|
||||
/// - 1 digest item.
|
||||
/// - 1 event.
|
||||
/// The weight of this function is dependent on the runtime, but generally this is very
|
||||
/// expensive. We will treat this as a full block.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))]
|
||||
pub fn set_code(origin: OriginFor<T>, code: Vec<u8>) -> DispatchResultWithPostInfo {
|
||||
@@ -417,13 +408,8 @@ pub mod pallet {
|
||||
|
||||
/// Set the new runtime code without doing any checks of the given `code`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(C)` where `C` length of `code`
|
||||
/// - 1 storage write (codec `O(C)`).
|
||||
/// - 1 digest item.
|
||||
/// - 1 event.
|
||||
/// The weight of this function is dependent on the runtime. We will treat this as a full
|
||||
/// block. # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight((T::BlockWeights::get().max_block, DispatchClass::Operational))]
|
||||
pub fn set_code_without_checks(
|
||||
@@ -1423,10 +1409,8 @@ impl<T: Config> Pallet<T> {
|
||||
|
||||
/// Deposits a log and ensures it matches the block's log data.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`
|
||||
/// - 1 storage write (codec `O(1)`)
|
||||
/// # </weight>
|
||||
pub fn deposit_log(item: generic::DigestItem) {
|
||||
<Digest<T>>::append(item);
|
||||
}
|
||||
|
||||
@@ -171,10 +171,8 @@ pub mod pallet {
|
||||
T::WeightInfo::on_finalize()
|
||||
}
|
||||
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`
|
||||
/// - 1 storage deletion (codec `O(1)`).
|
||||
/// # </weight>
|
||||
fn on_finalize(_n: BlockNumberFor<T>) {
|
||||
assert!(DidUpdate::<T>::take(), "Timestamp must be updated once in the block");
|
||||
}
|
||||
@@ -192,12 +190,11 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be `Inherent`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)
|
||||
/// - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in
|
||||
/// `on_finalize`)
|
||||
/// - 1 event handler `on_timestamp_set`. Must be `O(1)`.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight((
|
||||
T::WeightInfo::set(),
|
||||
|
||||
@@ -231,12 +231,9 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `NewTip` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(R)` where `R` length of `reason`.
|
||||
/// ## Complexity
|
||||
/// - `O(R)` where `R` length of `reason`.
|
||||
/// - encoding and hashing of 'reason'
|
||||
/// - DbReads: `Reasons`, `Tips`
|
||||
/// - DbWrites: `Reasons`, `Tips`
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::report_awesome(reason.len() as u32))]
|
||||
pub fn report_awesome(
|
||||
@@ -289,12 +286,9 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `TipRetracted` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(1)`
|
||||
/// ## Complexity
|
||||
/// - `O(1)`
|
||||
/// - Depends on the length of `T::Hash` which is fixed.
|
||||
/// - DbReads: `Tips`, `origin account`
|
||||
/// - DbWrites: `Reasons`, `Tips`, `origin account`
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::retract_tip())]
|
||||
pub fn retract_tip(origin: OriginFor<T>, hash: T::Hash) -> DispatchResult {
|
||||
@@ -325,15 +319,12 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `NewTip` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(R + T)` where `R` length of `reason`, `T` is the number of tippers.
|
||||
/// ## Complexity
|
||||
/// - `O(R + T)` where `R` length of `reason`, `T` is the number of tippers.
|
||||
/// - `O(T)`: decoding `Tipper` vec of length `T`. `T` is charged as upper bound given by
|
||||
/// `ContainsLengthBound`. The actual cost depends on the implementation of
|
||||
/// `T::Tippers`.
|
||||
/// - `O(R)`: hashing and encoding of reason of length `R`
|
||||
/// - DbReads: `Tippers`, `Reasons`
|
||||
/// - DbWrites: `Reasons`, `Tips`
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::tip_new(reason.len() as u32, T::Tippers::max_len() as u32))]
|
||||
pub fn tip_new(
|
||||
@@ -379,16 +370,13 @@ pub mod pallet {
|
||||
/// Emits `TipClosing` if the threshold of tippers has been reached and the countdown period
|
||||
/// has started.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(T)` where `T` is the number of tippers. decoding `Tipper` vec of length
|
||||
/// `T`, insert tip and check closing, `T` is charged as upper bound given by
|
||||
/// `ContainsLengthBound`. The actual cost depends on the implementation of `T::Tippers`.
|
||||
/// ## Complexity
|
||||
/// - `O(T)` where `T` is the number of tippers. decoding `Tipper` vec of length `T`, insert
|
||||
/// tip and check closing, `T` is charged as upper bound given by `ContainsLengthBound`.
|
||||
/// The actual cost depends on the implementation of `T::Tippers`.
|
||||
///
|
||||
/// Actually weight could be lower as it depends on how many tips are in `OpenTip` but it
|
||||
/// is weighted as if almost full i.e of length `T-1`.
|
||||
/// - DbReads: `Tippers`, `Tips`
|
||||
/// - DbWrites: `Tips`
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::tip(T::Tippers::max_len() as u32))]
|
||||
pub fn tip(
|
||||
@@ -416,13 +404,10 @@ pub mod pallet {
|
||||
/// - `hash`: The identity of the open tip for which a tip value is declared. This is formed
|
||||
/// as the hash of the tuple of the original tip `reason` and the beneficiary account ID.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(T)` where `T` is the number of tippers. decoding `Tipper` vec of length
|
||||
/// `T`. `T` is charged as upper bound given by `ContainsLengthBound`. The actual cost
|
||||
/// depends on the implementation of `T::Tippers`.
|
||||
/// - DbReads: `Tips`, `Tippers`, `tip finder`
|
||||
/// - DbWrites: `Reasons`, `Tips`, `Tippers`, `tip finder`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - : `O(T)` where `T` is the number of tippers. decoding `Tipper` vec of length `T`. `T`
|
||||
/// is charged as upper bound given by `ContainsLengthBound`. The actual cost depends on
|
||||
/// the implementation of `T::Tippers`.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::close_tip(T::Tippers::max_len() as u32))]
|
||||
pub fn close_tip(origin: OriginFor<T>, hash: T::Hash) -> DispatchResult {
|
||||
@@ -446,10 +431,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `TipSlashed` if successful.
|
||||
///
|
||||
/// # <weight>
|
||||
/// `T` is charged as upper bound given by `ContainsLengthBound`.
|
||||
/// The actual cost depends on the implementation of `T::Tippers`.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(<T as Config<I>>::WeightInfo::slash_tip(T::Tippers::max_len() as u32))]
|
||||
pub fn slash_tip(origin: OriginFor<T>, hash: T::Hash) -> DispatchResult {
|
||||
|
||||
@@ -184,10 +184,9 @@ pub mod pallet {
|
||||
impl<T: Config> Pallet<T> {
|
||||
/// Index and store data off chain. Minimum data size is 1 bytes, maximum is
|
||||
/// `MaxTransactionSize`. Data will be removed after `STORAGE_PERIOD` blocks, unless `renew`
|
||||
/// is called. # <weight>
|
||||
/// - n*log(n) of data size, as all data is pushed to an in-memory trie.
|
||||
/// Additionally contains a DB write.
|
||||
/// # </weight>
|
||||
/// is called.
|
||||
/// ## Complexity
|
||||
/// - O(n*log(n)) of data size, as all data is pushed to an in-memory trie.
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::store(data.len() as u32))]
|
||||
pub fn store(origin: OriginFor<T>, data: Vec<u8>) -> DispatchResult {
|
||||
@@ -234,9 +233,8 @@ pub mod pallet {
|
||||
/// previous `store` or `renew` call and transaction index within that block.
|
||||
/// Transaction index is emitted in the `Stored` or `Renewed` event.
|
||||
/// Applies same fees as `store`.
|
||||
/// # <weight>
|
||||
/// - Constant.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::renew())]
|
||||
pub fn renew(
|
||||
@@ -277,12 +275,10 @@ pub mod pallet {
|
||||
|
||||
/// Check storage proof for block number `block_number() - StoragePeriod`.
|
||||
/// If such block does not exist the proof is expected to be `None`.
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - Linear w.r.t the number of indexed transactions in the proved block for random
|
||||
/// probing.
|
||||
/// There's a DB read for each transaction.
|
||||
/// Here we assume a maximum of 100 probed transactions.
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight((T::WeightInfo::check_proof_max(), DispatchClass::Mandatory))]
|
||||
pub fn check_proof(
|
||||
|
||||
@@ -315,13 +315,8 @@ pub mod pallet {
|
||||
|
||||
#[pallet::hooks]
|
||||
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I> {
|
||||
/// # <weight>
|
||||
/// - Complexity: `O(A)` where `A` is the number of approvals
|
||||
/// - Db reads and writes: `Approvals`, `pot account data`
|
||||
/// - Db reads and writes per approval: `Proposals`, `proposer account data`, `beneficiary
|
||||
/// account data`
|
||||
/// - The weight is overestimated if some approvals got missed.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - `O(A)` where `A` is the number of approvals
|
||||
fn on_initialize(n: T::BlockNumber) -> Weight {
|
||||
let pot = Self::pot();
|
||||
let deactivated = Deactivated::<T, I>::get();
|
||||
@@ -350,11 +345,8 @@ pub mod pallet {
|
||||
/// is reserved and slashed if the proposal is rejected. It is returned once the
|
||||
/// proposal is awarded.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(1)
|
||||
/// - DbReads: `ProposalCount`, `origin account`
|
||||
/// - DbWrites: `ProposalCount`, `Proposals`, `origin account`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1)
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::propose_spend())]
|
||||
pub fn propose_spend(
|
||||
@@ -381,11 +373,8 @@ pub mod pallet {
|
||||
///
|
||||
/// May only be called from `T::RejectOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(1)
|
||||
/// - DbReads: `Proposals`, `rejected proposer account`
|
||||
/// - DbWrites: `Proposals`, `rejected proposer account`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1)
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight((T::WeightInfo::reject_proposal(), DispatchClass::Operational))]
|
||||
pub fn reject_proposal(
|
||||
@@ -412,11 +401,8 @@ pub mod pallet {
|
||||
///
|
||||
/// May only be called from `T::ApproveOrigin`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(1).
|
||||
/// - DbReads: `Proposals`, `Approvals`
|
||||
/// - DbWrite: `Approvals`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight((T::WeightInfo::approve_proposal(T::MaxApprovals::get()), DispatchClass::Operational))]
|
||||
pub fn approve_proposal(
|
||||
@@ -472,10 +458,8 @@ pub mod pallet {
|
||||
/// May only be called from `T::RejectOrigin`.
|
||||
/// - `proposal_id`: The index of a proposal
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(A) where `A` is the number of approvals
|
||||
/// - Db reads and writes: `Approvals`
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(A) where `A` is the number of approvals
|
||||
///
|
||||
/// Errors:
|
||||
/// - `ProposalNotApproved`: The `proposal_id` supplied was not found in the approval queue,
|
||||
|
||||
@@ -172,9 +172,8 @@ pub mod pallet {
|
||||
/// If origin is root then the calls are dispatched without checking origin filter. (This
|
||||
/// includes bypassing `frame_system::Config::BaseCallFilter`).
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(C) where C is the number of calls to be batched.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(C) where C is the number of calls to be batched.
|
||||
///
|
||||
/// This will return `Ok` in all circumstances. To determine the success of the batch, an
|
||||
/// event is deposited. If a call failed and the batch was interrupted, then the
|
||||
@@ -301,9 +300,8 @@ pub mod pallet {
|
||||
/// If origin is root then the calls are dispatched without checking origin filter. (This
|
||||
/// includes bypassing `frame_system::Config::BaseCallFilter`).
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(C) where C is the number of calls to be batched.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(C) where C is the number of calls to be batched.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight({
|
||||
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info()).collect::<Vec<_>>();
|
||||
@@ -374,12 +372,8 @@ pub mod pallet {
|
||||
///
|
||||
/// The dispatch origin for this call must be _Root_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - O(1).
|
||||
/// - Limited storage reads.
|
||||
/// - One DB write (event).
|
||||
/// - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight({
|
||||
let dispatch_info = call.get_dispatch_info();
|
||||
@@ -415,9 +409,8 @@ pub mod pallet {
|
||||
/// If origin is root then the calls are dispatch without checking origin filter. (This
|
||||
/// includes bypassing `frame_system::Config::BaseCallFilter`).
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Complexity: O(C) where C is the number of calls to be batched.
|
||||
/// # </weight>
|
||||
/// ## Complexity
|
||||
/// - O(C) where C is the number of calls to be batched.
|
||||
#[pallet::call_index(4)]
|
||||
#[pallet::weight({
|
||||
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info()).collect::<Vec<_>>();
|
||||
|
||||
@@ -297,12 +297,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - DbWeight: 2 Reads, 2 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, [Sender Account]
|
||||
/// - Writes: Vesting Storage, Balances Locks, [Sender Account]
|
||||
/// # </weight>
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::vest_locked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
|
||||
.max(T::WeightInfo::vest_unlocked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
|
||||
@@ -321,12 +317,8 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits either `VestingCompleted` or `VestingUpdated`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - DbWeight: 3 Reads, 3 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, Target Account
|
||||
/// - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
/// # </weight>
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::vest_other_locked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
|
||||
.max(T::WeightInfo::vest_other_unlocked(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES))
|
||||
@@ -348,12 +340,8 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE: This will unlock all schedules through the current block.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - DbWeight: 3 Reads, 3 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
/// - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
/// # </weight>
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(
|
||||
T::WeightInfo::vested_transfer(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
|
||||
@@ -380,12 +368,8 @@ pub mod pallet {
|
||||
///
|
||||
/// NOTE: This will unlock all schedules through the current block.
|
||||
///
|
||||
/// # <weight>
|
||||
/// ## Complexity
|
||||
/// - `O(1)`.
|
||||
/// - DbWeight: 4 Reads, 4 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, Target Account, Source Account
|
||||
/// - Writes: Vesting Storage, Balances Locks, Target Account, Source Account
|
||||
/// # </weight>
|
||||
#[pallet::call_index(3)]
|
||||
#[pallet::weight(
|
||||
T::WeightInfo::force_vested_transfer(MaxLocksOf::<T>::get(), T::MAX_VESTING_SCHEDULES)
|
||||
|
||||
Reference in New Issue
Block a user