From 25d2394d57684c031f8bea3007dbff850d6271d6 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Fri, 8 Jan 2021 12:04:46 -0400 Subject: [PATCH] Store dispatch info of calls locally in weight calculation (#7849) * utility * sudo * more * recovery * better formatting --- src/lib.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f58fe54..a015f29 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -223,13 +223,16 @@ decl_module! { /// - DB Weight: None /// - Plus Call Weight /// # - #[weight = ( - T::WeightInfo::as_multi_threshold_1(call.using_encoded(|c| c.len() as u32)) - .saturating_add(call.get_dispatch_info().weight) - // 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(); + ( + T::WeightInfo::as_multi_threshold_1(call.using_encoded(|c| c.len() as u32)) + .saturating_add(dispatch_info.weight) + // AccountData for inner call origin accountdata. + .saturating_add(T::DbWeight::get().reads_writes(1, 1)), + dispatch_info.class, + ) + }] fn as_multi_threshold_1(origin, other_signatories: Vec, call: Box<::Call>,