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
+21
View File
@@ -64,6 +64,22 @@ use frame_support::{
};
use frame_system::{self as system};
pub trait WeightInfo {
fn schedule(s: u32, ) -> Weight;
fn cancel(s: u32, ) -> Weight;
fn schedule_named(s: u32, ) -> Weight;
fn cancel_named(s: u32, ) -> Weight;
fn on_initialize(s: u32, ) -> Weight;
}
impl WeightInfo for () {
fn schedule(_s: u32, ) -> Weight { 1_000_000_000 }
fn cancel(_s: u32, ) -> Weight { 1_000_000_000 }
fn schedule_named(_s: u32, ) -> Weight { 1_000_000_000 }
fn cancel_named(_s: u32, ) -> Weight { 1_000_000_000 }
fn on_initialize(_s: u32, ) -> Weight { 1_000_000_000 }
}
/// Our pallet's configuration trait. All our types and constants go in here. If the
/// pallet is dependent on specific other pallets, then their configuration traits
/// should be added to our implied traits list.
@@ -89,6 +105,9 @@ pub trait Trait: system::Trait {
/// Required origin to schedule or cancel calls.
type ScheduleOrigin: EnsureOrigin<<Self as system::Trait>::Origin>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
/// Just a simple index for naming period tasks.
@@ -655,6 +674,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl logger::Trait for Test {
type Event = ();
@@ -673,6 +693,7 @@ mod tests {
type Call = Call;
type MaximumWeight = MaximumSchedulerWeight;
type ScheduleOrigin = EnsureOneOf<u64, EnsureRoot<u64>, EnsureSignedBy<One, u64>>;
type WeightInfo = ();
}
type System = system::Module<Test>;
type Logger = logger::Module<Test>;