Store dispatch info of calls locally in weight calculation (#7849)

* utility

* sudo

* more

* recovery

* better formatting
This commit is contained in:
Shawn Tabrizi
2021-01-08 12:04:46 -04:00
committed by GitHub
parent a4032b1dfb
commit 1d73b011a9
4 changed files with 66 additions and 47 deletions
+10 -7
View File
@@ -352,13 +352,16 @@ decl_module! {
/// - The weight of the `call` + 10,000.
/// - One storage lookup to check account is recovered by `who`. O(1)
/// # </weight>
#[weight = (
call.get_dispatch_info().weight
.saturating_add(10_000)
// AccountData for inner call origin accountdata.
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
call.get_dispatch_info().class
)]
#[weight = {
let dispatch_info = call.get_dispatch_info();
(
dispatch_info.weight
.saturating_add(10_000)
// AccountData for inner call origin accountdata.
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
dispatch_info.class,
)
}]
fn as_recovered(origin,
account: T::AccountId,
call: Box<<T as Config>::Call>