mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 08:45:41 +00:00
Fix weight for inner call with new origin (#7196)
* fix weight for inner call with new origin * fix
This commit is contained in:
committed by
GitHub
parent
a56f90fa9a
commit
6182878933
@@ -63,7 +63,7 @@ use frame_support::{
|
||||
traits::{Get, schedule::{self, DispatchTime}, OriginTrait, EnsureOrigin, IsType},
|
||||
weights::{GetDispatchInfo, Weight},
|
||||
};
|
||||
use frame_system::{self as system};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn schedule(s: u32, ) -> Weight;
|
||||
@@ -351,6 +351,16 @@ decl_module! {
|
||||
*cumulative_weight = cumulative_weight
|
||||
.saturating_add(s.call.get_dispatch_info().weight);
|
||||
|
||||
let origin = <<T as Trait>::Origin as From<T::PalletsOrigin>>::from(
|
||||
s.origin.clone()
|
||||
).into();
|
||||
|
||||
if ensure_signed(origin).is_ok() {
|
||||
// AccountData for inner call origin accountdata.
|
||||
*cumulative_weight = cumulative_weight
|
||||
.saturating_add(T::DbWeight::get().reads_writes(1, 1));
|
||||
}
|
||||
|
||||
if s.maybe_id.is_some() {
|
||||
// Remove/Modify Lookup
|
||||
*cumulative_weight = cumulative_weight.saturating_add(T::DbWeight::get().writes(1));
|
||||
|
||||
Reference in New Issue
Block a user