mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 21:01:05 +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:
@@ -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