Skip to content

Commit 25d2394

Browse files
authored
Store dispatch info of calls locally in weight calculation (#7849)
* utility * sudo * more * recovery * better formatting
1 parent 8b10bed commit 25d2394

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,16 @@ decl_module! {
223223
/// - DB Weight: None
224224
/// - Plus Call Weight
225225
/// # </weight>
226-
#[weight = (
227-
T::WeightInfo::as_multi_threshold_1(call.using_encoded(|c| c.len() as u32))
228-
.saturating_add(call.get_dispatch_info().weight)
229-
// AccountData for inner call origin accountdata.
230-
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
231-
call.get_dispatch_info().class,
232-
)]
226+
#[weight = {
227+
let dispatch_info = call.get_dispatch_info();
228+
(
229+
T::WeightInfo::as_multi_threshold_1(call.using_encoded(|c| c.len() as u32))
230+
.saturating_add(dispatch_info.weight)
231+
// AccountData for inner call origin accountdata.
232+
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
233+
dispatch_info.class,
234+
)
235+
}]
233236
fn as_multi_threshold_1(origin,
234237
other_signatories: Vec<T::AccountId>,
235238
call: Box<<T as Config>::Call>,

0 commit comments

Comments
 (0)