Skip to content

Commit 64440be

Browse files
authored
Store dispatch info of calls locally in weight calculation (#7849)
* utility * sudo * more * recovery * better formatting
1 parent d3a7529 commit 64440be

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/lib.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,16 @@ decl_module! {
352352
/// - The weight of the `call` + 10,000.
353353
/// - One storage lookup to check account is recovered by `who`. O(1)
354354
/// # </weight>
355-
#[weight = (
356-
call.get_dispatch_info().weight
357-
.saturating_add(10_000)
358-
// AccountData for inner call origin accountdata.
359-
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
360-
call.get_dispatch_info().class
361-
)]
355+
#[weight = {
356+
let dispatch_info = call.get_dispatch_info();
357+
(
358+
dispatch_info.weight
359+
.saturating_add(10_000)
360+
// AccountData for inner call origin accountdata.
361+
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
362+
dispatch_info.class,
363+
)
364+
}]
362365
fn as_recovered(origin,
363366
account: T::AccountId,
364367
call: Box<<T as Config>::Call>

0 commit comments

Comments
 (0)