Skip to content

Commit 3076287

Browse files
authored
Fix weight for inner call with new origin (#7196)
* fix weight for inner call with new origin * fix
1 parent 9247195 commit 3076287

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ use frame_support::{
9595
};
9696
use frame_support::{
9797
weights::{Weight, GetDispatchInfo, Pays},
98-
traits::UnfilteredDispatchable,
98+
traits::{UnfilteredDispatchable, Get},
9999
dispatch::DispatchResultWithPostInfo,
100100
};
101101
use frame_system::ensure_signed;
@@ -197,7 +197,13 @@ decl_module! {
197197
/// - One DB write (event).
198198
/// - Weight of derivative `call` execution + 10,000.
199199
/// # </weight>
200-
#[weight = (call.get_dispatch_info().weight + 10_000, call.get_dispatch_info().class)]
200+
#[weight = (
201+
call.get_dispatch_info().weight
202+
.saturating_add(10_000)
203+
// AccountData for inner call origin accountdata.
204+
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
205+
call.get_dispatch_info().class
206+
)]
201207
fn sudo_as(origin,
202208
who: <T::Lookup as StaticLookup>::Source,
203209
call: Box<<T as Trait>::Call>

0 commit comments

Comments
 (0)