Fix weight for inner call with new origin (#7196)

* fix weight for inner call with new origin

* fix
This commit is contained in:
Guillaume Thiolliere
2020-10-01 10:24:34 +02:00
committed by GitHub
parent a56f90fa9a
commit 6182878933
6 changed files with 39 additions and 10 deletions
+4 -2
View File
@@ -61,7 +61,7 @@ use sp_core::TypeId;
use sp_io::hashing::blake2_256;
use frame_support::{decl_module, decl_event, decl_storage, Parameter};
use frame_support::{
traits::{OriginTrait, UnfilteredDispatchable},
traits::{OriginTrait, UnfilteredDispatchable, Get},
weights::{Weight, GetDispatchInfo, DispatchClass}, dispatch::PostDispatchInfo,
};
use frame_system::{ensure_signed, ensure_root};
@@ -185,7 +185,9 @@ decl_module! {
/// The dispatch origin for this call must be _Signed_.
#[weight = (
T::WeightInfo::as_derivative()
.saturating_add(call.get_dispatch_info().weight),
.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,
)]
fn as_derivative(origin, index: u16, call: Box<<T as Trait>::Call>) -> DispatchResult {