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:
Shawn Tabrizi
2020-07-08 18:22:01 +02:00
committed by GitHub
parent 94cddee160
commit 2302898b8a
65 changed files with 632 additions and 7 deletions
+16
View File
@@ -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! {
+2
View File
@@ -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 {