mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 09:45:41 +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:
@@ -66,6 +66,7 @@ impl frame_system::Trait for Test {
|
||||
type BlockExecutionWeight = ();
|
||||
type ExtrinsicBaseWeight = ();
|
||||
type MaximumExtrinsicWeight = ();
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 10;
|
||||
@@ -76,6 +77,7 @@ impl pallet_balances::Trait for Test {
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -85,6 +87,7 @@ impl pallet_timestamp::Trait for Test {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
impl pallet_session::historical::Trait for Test {
|
||||
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
|
||||
@@ -127,6 +130,7 @@ impl pallet_session::Trait for Test {
|
||||
type ValidatorId = AccountId;
|
||||
type ValidatorIdOf = pallet_staking::StashOf<Test>;
|
||||
type DisabledValidatorsThreshold = ();
|
||||
type WeightInfo = ();
|
||||
}
|
||||
pallet_staking_reward_curve::build! {
|
||||
const I_NPOS: sp_runtime::curve::PiecewiseLinear<'static> = curve!(
|
||||
@@ -178,6 +182,7 @@ impl pallet_staking::Trait for Test {
|
||||
type UnsignedPriority = ();
|
||||
type MaxIterations = ();
|
||||
type MinSolutionScoreBump = ();
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_im_online::Trait for Test {
|
||||
@@ -186,6 +191,7 @@ impl pallet_im_online::Trait for Test {
|
||||
type SessionDuration = Period;
|
||||
type ReportUnresponsiveness = Offences;
|
||||
type UnsignedPriority = ();
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -197,6 +203,7 @@ impl pallet_offences::Trait for Test {
|
||||
type IdentificationTuple = pallet_session::historical::IdentificationTuple<Self>;
|
||||
type OnOffenceHandler = Staking;
|
||||
type WeightSoftLimit = OffencesWeightSoftLimit;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
impl<T> frame_system::offchain::SendTransactionTypes<T> for Test where Call: From<T> {
|
||||
|
||||
@@ -51,6 +51,20 @@ pub type DeferredOffenceOf<T> = (
|
||||
SessionIndex,
|
||||
);
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn report_offence_im_online(r: u32, o: u32, n: u32, ) -> Weight;
|
||||
fn report_offence_grandpa(r: u32, n: u32, ) -> Weight;
|
||||
fn report_offence_babe(r: u32, n: u32, ) -> Weight;
|
||||
fn on_initialize(d: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn report_offence_im_online(_r: u32, _o: u32, _n: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn report_offence_grandpa(_r: u32, _n: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn report_offence_babe(_r: u32, _n: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn on_initialize(_d: u32, ) -> Weight { 1_000_000_000 }
|
||||
}
|
||||
|
||||
/// Offences trait
|
||||
pub trait Trait: frame_system::Trait {
|
||||
/// The overarching event type.
|
||||
@@ -63,6 +77,8 @@ pub trait Trait: frame_system::Trait {
|
||||
/// `on_initialize`.
|
||||
/// Note it's going to be exceeded before we stop adding to it, so it has to be set conservatively.
|
||||
type WeightSoftLimit: Get<Weight>;
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
|
||||
@@ -120,6 +120,7 @@ impl frame_system::Trait for Runtime {
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -131,6 +132,7 @@ impl Trait for Runtime {
|
||||
type IdentificationTuple = u64;
|
||||
type OnOffenceHandler = OnOffenceHandler;
|
||||
type WeightSoftLimit = OffencesWeightSoftLimit;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
mod offences {
|
||||
|
||||
Reference in New Issue
Block a user