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
+15
View File
@@ -115,6 +115,16 @@ use sp_timestamp::{
OnTimestampSet,
};
pub trait WeightInfo {
fn set(t: u32, ) -> Weight;
fn on_finalize(t: u32, ) -> Weight;
}
impl WeightInfo for () {
fn set(_t: u32, ) -> Weight { 1_000_000_000 }
fn on_finalize(_t: u32, ) -> Weight { 1_000_000_000 }
}
/// The module configuration trait
pub trait Trait: frame_system::Trait {
/// Type used for expressing timestamp.
@@ -129,6 +139,9 @@ pub trait Trait: frame_system::Trait {
/// work with this to determine a sensible block time. e.g. For Aura, it will be double this
/// period on default settings.
type MinimumPeriod: Get<Self::Moment>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
decl_module! {
@@ -338,6 +351,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
parameter_types! {
pub const MinimumPeriod: u64 = 5;
@@ -346,6 +360,7 @@ mod tests {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
type Timestamp = Module<Test>;