mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Add WeightInfo to all pallets with benchmarks. (#6575)
* Start adding weight info * More weightinfo * finish weight info * more fixes * inital update of node runtime * fix the rest of the compilation * update balances * add docs * fix balances tests * Fix more tests * Fix compile * Fix pallet-evm tests
This commit is contained in:
@@ -43,7 +43,7 @@ use frame_support::{
|
||||
decl_module, decl_event, decl_error, decl_storage, Parameter, ensure, traits::{
|
||||
Get, ReservableCurrency, Currency, InstanceFilter,
|
||||
OriginTrait, IsType,
|
||||
}, weights::{GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}},
|
||||
}, weights::{Weight, GetDispatchInfo, constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}},
|
||||
dispatch::{PostDispatchInfo, IsSubType},
|
||||
};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
@@ -53,6 +53,24 @@ mod benchmarking;
|
||||
|
||||
type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trait>::AccountId>>::Balance;
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn proxy(p: u32, ) -> Weight;
|
||||
fn add_proxy(p: u32, ) -> Weight;
|
||||
fn remove_proxy(p: u32, ) -> Weight;
|
||||
fn remove_proxies(p: u32, ) -> Weight;
|
||||
fn anonymous(p: u32, ) -> Weight;
|
||||
fn kill_anonymous(p: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn proxy(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn add_proxy(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn remove_proxy(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn remove_proxies(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn anonymous(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn kill_anonymous(_p: u32, ) -> Weight { 1_000_000_000 }
|
||||
}
|
||||
|
||||
/// Configuration trait.
|
||||
pub trait Trait: frame_system::Trait {
|
||||
/// The overarching event type.
|
||||
@@ -87,6 +105,9 @@ pub trait Trait: frame_system::Trait {
|
||||
|
||||
/// The maximum amount of proxies allowed for a single account.
|
||||
type MaxProxies: Get<u16>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
|
||||
@@ -86,6 +86,7 @@ impl frame_system::Trait for Test {
|
||||
type AccountData = pallet_balances::AccountData<u64>;
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
@@ -96,10 +97,12 @@ impl pallet_balances::Trait for Test {
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
impl pallet_utility::Trait for Test {
|
||||
type Event = TestEvent;
|
||||
type Call = Call;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ProxyDepositBase: u64 = 1;
|
||||
@@ -144,6 +147,7 @@ impl Trait for Test {
|
||||
type ProxyDepositBase = ProxyDepositBase;
|
||||
type ProxyDepositFactor = ProxyDepositFactor;
|
||||
type MaxProxies = MaxProxies;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
type System = frame_system::Module<Test>;
|
||||
|
||||
Reference in New Issue
Block a user