Document weight for asset, system and timestamp pallets (#5593)

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
Alexander Popiak
2020-04-24 12:00:07 +02:00
committed by GitHub
parent 8ac2bac58d
commit 61f383a116
3 changed files with 86 additions and 0 deletions
+10
View File
@@ -148,6 +148,12 @@ decl_module! {
/// `MinimumPeriod`.
///
/// The dispatch origin for this call must be `Inherent`.
///
/// # <weight>
/// - `O(T)` where `T` complexity of `on_timestamp_set`
/// - 2 storage mutations (codec `O(1)`).
/// - 1 event handler `on_timestamp_set` `O(T)`.
/// # </weight>
#[weight = (MINIMUM_WEIGHT, DispatchClass::Mandatory)]
fn set(origin, #[compact] now: T::Moment) {
ensure_none(origin)?;
@@ -162,6 +168,10 @@ decl_module! {
<T::OnTimestampSet as OnTimestampSet<_>>::on_timestamp_set(now);
}
/// # <weight>
/// - `O(1)`
/// - 1 storage deletion (codec `O(1)`).
/// # </weight>
fn on_finalize() {
assert!(<Self as Store>::DidUpdate::take(), "Timestamp must be updated once in the block");
}