diff --git a/substrate/frame/assets/src/lib.rs b/substrate/frame/assets/src/lib.rs
index 60a9ab87a7..9d31cceb7e 100644
--- a/substrate/frame/assets/src/lib.rs
+++ b/substrate/frame/assets/src/lib.rs
@@ -158,6 +158,13 @@ decl_module! {
/// Issue a new class of fungible assets. There are, and will only ever be, `total`
/// such assets and they'll all belong to the `origin` initially. It will have an
/// identifier `AssetId` instance: this will be specified in the `Issued` event.
+ ///
+ /// #
+ /// - `O(1)`
+ /// - 1 storage mutation (codec `O(1)`).
+ /// - 2 storage writes (condec `O(1)`).
+ /// - 1 event.
+ /// #
#[weight = MINIMUM_WEIGHT]
fn issue(origin, #[compact] total: T::Balance) {
let origin = ensure_signed(origin)?;
@@ -172,6 +179,13 @@ decl_module! {
}
/// Move some assets from one holder to another.
+ ///
+ /// #
+ /// - `O(1)`
+ /// - 1 static lookup
+ /// - 2 storage mutations (codec `O(1)`).
+ /// - 1 event.
+ /// #
#[weight = MINIMUM_WEIGHT]
fn transfer(origin,
#[compact] id: T::AssetId,
@@ -191,6 +205,13 @@ decl_module! {
}
/// Destroy any assets of `id` owned by `origin`.
+ ///
+ /// #
+ /// - `O(1)`
+ /// - 1 storage mutation (codec `O(1)`).
+ /// - 1 storage deletion (codec `O(1)`).
+ /// - 1 event.
+ /// #
#[weight = MINIMUM_WEIGHT]
fn destroy(origin, #[compact] id: T::AssetId) {
let origin = ensure_signed(origin)?;
diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs
index 83733bb6c9..b3ac7e8f95 100644
--- a/substrate/frame/system/src/lib.rs
+++ b/substrate/frame/system/src/lib.rs
@@ -494,12 +494,21 @@ decl_module! {
}
/// Make some on-chain remark.
+ ///
+ /// #
+ /// - `O(1)`
+ /// #
#[weight = MINIMUM_WEIGHT]
fn remark(origin, _remark: Vec) {
ensure_signed(origin)?;
}
/// Set the number of pages in the WebAssembly environment's heap.
+ ///
+ /// #
+ /// - `O(1)`
+ /// - 1 storage write.
+ /// #
#[weight = (MINIMUM_WEIGHT, DispatchClass::Operational)]
fn set_heap_pages(origin, pages: u64) {
ensure_root(origin)?;
@@ -507,6 +516,13 @@ decl_module! {
}
/// Set the new runtime code.
+ ///
+ /// #
+ /// - `O(C + S)` where `C` length of `code` and `S` complexity of `can_set_code`
+ /// - 1 storage write (codec `O(C)`).
+ /// - 1 call to `can_set_code`: `O(S)` (calls `sp_io::misc::runtime_version` which is expensive).
+ /// - 1 event.
+ /// #
#[weight = (200_000_000, DispatchClass::Operational)]
pub fn set_code(origin, code: Vec) {
Self::can_set_code(origin, &code)?;
@@ -516,6 +532,12 @@ decl_module! {
}
/// Set the new runtime code without doing any checks of the given `code`.
+ ///
+ /// #
+ /// - `O(C)` where `C` length of `code`
+ /// - 1 storage write (codec `O(C)`).
+ /// - 1 event.
+ /// #
#[weight = (200_000_000, DispatchClass::Operational)]
pub fn set_code_without_checks(origin, code: Vec) {
ensure_root(origin)?;
@@ -524,6 +546,12 @@ decl_module! {
}
/// Set the new changes trie configuration.
+ ///
+ /// #
+ /// - `O(D)` where `D` length of `Digest`
+ /// - 1 storage write or delete (codec `O(1)`).
+ /// - 1 call to `deposit_log`: `O(D)` (which depends on the length of `Digest`)
+ /// #
#[weight = (20_000_000, DispatchClass::Operational)]
pub fn set_changes_trie_config(origin, changes_trie_config: Option) {
ensure_root(origin)?;
@@ -542,6 +570,11 @@ decl_module! {
}
/// Set some items of storage.
+ ///
+ /// #
+ /// - `O(I)` where `I` length of `items`
+ /// - `I` storage writes (`O(1)`).
+ /// #
#[weight = (MINIMUM_WEIGHT, DispatchClass::Operational)]
fn set_storage(origin, items: Vec) {
ensure_root(origin)?;
@@ -551,6 +584,11 @@ decl_module! {
}
/// Kill some items from storage.
+ ///
+ /// #
+ /// - `O(VK)` where `V` length of `keys` and `K` length of one key
+ /// - `V` storage deletions.
+ /// #
#[weight = (MINIMUM_WEIGHT, DispatchClass::Operational)]
fn kill_storage(origin, keys: Vec) {
ensure_root(origin)?;
@@ -560,6 +598,11 @@ decl_module! {
}
/// Kill all storage items with a key that starts with the given prefix.
+ ///
+ /// #
+ /// - `O(P)` where `P` amount of keys with prefix `prefix`
+ /// - `P` storage deletions.
+ /// #
#[weight = (MINIMUM_WEIGHT, DispatchClass::Operational)]
fn kill_prefix(origin, prefix: Key) {
ensure_root(origin)?;
@@ -568,6 +611,13 @@ decl_module! {
/// Kill the sending account, assuming there are no references outstanding and the composite
/// data is equal to its default value.
+ ///
+ /// #
+ /// - `O(K)` with `K` being complexity of `on_killed_account`
+ /// - 1 storage read and deletion.
+ /// - 1 call to `on_killed_account` callback with unknown complexity `K`
+ /// - 1 event.
+ /// #
#[weight = (25_000_000, DispatchClass::Operational)]
fn suicide(origin) {
let who = ensure_signed(origin)?;
@@ -924,6 +974,11 @@ impl Module {
}
/// Deposits a log and ensures it matches the block's log data.
+ ///
+ /// #
+ /// - `O(D)` where `D` length of `Digest`
+ /// - 1 storage mutation (codec `O(D)`).
+ /// #
pub fn deposit_log(item: DigestItemOf) {
let mut l = >::get();
l.push(item);
diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs
index cffe172c13..704343fd16 100644
--- a/substrate/frame/timestamp/src/lib.rs
+++ b/substrate/frame/timestamp/src/lib.rs
@@ -148,6 +148,12 @@ decl_module! {
/// `MinimumPeriod`.
///
/// The dispatch origin for this call must be `Inherent`.
+ ///
+ /// #
+ /// - `O(T)` where `T` complexity of `on_timestamp_set`
+ /// - 2 storage mutations (codec `O(1)`).
+ /// - 1 event handler `on_timestamp_set` `O(T)`.
+ /// #
#[weight = (MINIMUM_WEIGHT, DispatchClass::Mandatory)]
fn set(origin, #[compact] now: T::Moment) {
ensure_none(origin)?;
@@ -162,6 +168,10 @@ decl_module! {
>::on_timestamp_set(now);
}
+ /// #
+ /// - `O(1)`
+ /// - 1 storage deletion (codec `O(1)`).
+ /// #
fn on_finalize() {
assert!(::DidUpdate::take(), "Timestamp must be updated once in the block");
}