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
+30
View File
@@ -76,6 +76,30 @@ pub type MemberCount = u32;
/// + This pallet assumes that dependents keep to the limit without enforcing it.
pub const MAX_MEMBERS: MemberCount = 100;
pub trait WeightInfo {
fn set_members(m: u32, n: u32, p: u32, ) -> Weight;
fn execute(m: u32, b: u32, ) -> Weight;
fn propose_execute(m: u32, b: u32, ) -> Weight;
fn propose_proposed(m: u32, p: u32, b: u32, ) -> Weight;
fn vote(m: u32, ) -> Weight;
fn close_early_disapproved(m: u32, p: u32, b: u32, ) -> Weight;
fn close_early_approved(m: u32, p: u32, b: u32, ) -> Weight;
fn close_disapproved(m: u32, p: u32, b: u32, ) -> Weight;
fn close_approved(m: u32, p: u32, b: u32, ) -> Weight;
}
impl WeightInfo for () {
fn set_members(_m: u32, _n: u32, _p: u32, ) -> Weight { 1_000_000_000 }
fn execute(_m: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn propose_execute(_m: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn propose_proposed(_m: u32, _p: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn vote(_m: u32, ) -> Weight { 1_000_000_000 }
fn close_early_disapproved(_m: u32, _p: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn close_early_approved(_m: u32, _p: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn close_disapproved(_m: u32, _p: u32, _b: u32, ) -> Weight { 1_000_000_000 }
fn close_approved(_m: u32, _p: u32, _b: u32, ) -> Weight { 1_000_000_000 }
}
pub trait Trait<I: Instance=DefaultInstance>: frame_system::Trait {
/// The outer origin type.
type Origin: From<RawOrigin<Self::AccountId, I>>;
@@ -94,6 +118,9 @@ pub trait Trait<I: Instance=DefaultInstance>: frame_system::Trait {
/// Maximum number of proposals allowed to be active in parallel.
type MaxProposals: Get<u32>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
/// Origin for the collective module.
@@ -1039,6 +1066,7 @@ mod tests {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl Trait<Instance1> for Test {
type Origin = Origin;
@@ -1046,6 +1074,7 @@ mod tests {
type Event = Event;
type MotionDuration = MotionDuration;
type MaxProposals = MaxProposals;
type WeightInfo = ();
}
impl Trait for Test {
type Origin = Origin;
@@ -1053,6 +1082,7 @@ mod tests {
type Event = Event;
type MotionDuration = MotionDuration;
type MaxProposals = MaxProposals;
type WeightInfo = ();
}
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;