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
+39 -1
View File
@@ -137,6 +137,38 @@ pub struct DefunctVoter<AccountId> {
pub candidate_count: u32
}
pub trait WeightInfo {
fn vote(u: u32, ) -> Weight;
fn vote_update(u: u32, ) -> Weight;
fn remove_voter(u: u32, ) -> Weight;
fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight;
fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight;
fn submit_candidacy(c: u32, ) -> Weight;
fn renounce_candidacy_candidate(c: u32, ) -> Weight;
fn renounce_candidacy_member_runner_up(u: u32, ) -> Weight;
fn remove_member_without_replacement(c: u32, ) -> Weight;
fn remove_member_with_replacement(u: u32, ) -> Weight;
fn remove_member_wrong_refund(u: u32, ) -> Weight;
fn on_initialize(c: u32, ) -> Weight;
fn phragmen(c: u32, v: u32, e: u32, ) -> Weight;
}
impl WeightInfo for () {
fn vote(_u: u32, ) -> Weight { 1_000_000_000 }
fn vote_update(_u: u32, ) -> Weight { 1_000_000_000 }
fn remove_voter(_u: u32, ) -> Weight { 1_000_000_000 }
fn report_defunct_voter_correct(_c: u32, _v: u32, ) -> Weight { 1_000_000_000 }
fn report_defunct_voter_incorrect(_c: u32, _v: u32, ) -> Weight { 1_000_000_000 }
fn submit_candidacy(_c: u32, ) -> Weight { 1_000_000_000 }
fn renounce_candidacy_candidate(_c: u32, ) -> Weight { 1_000_000_000 }
fn renounce_candidacy_member_runner_up(_u: u32, ) -> Weight { 1_000_000_000 }
fn remove_member_without_replacement(_c: u32, ) -> Weight { 1_000_000_000 }
fn remove_member_with_replacement(_u: u32, ) -> Weight { 1_000_000_000 }
fn remove_member_wrong_refund(_u: u32, ) -> Weight { 1_000_000_000 }
fn on_initialize(_c: u32, ) -> Weight { 1_000_000_000 }
fn phragmen(_c: u32, _v: u32, _e: u32, ) -> Weight { 1_000_000_000 }
}
pub trait Trait: frame_system::Trait {
/// The overarching event type.c
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
@@ -184,6 +216,9 @@ pub trait Trait: frame_system::Trait {
/// round will happen. If set to zero, no elections are ever triggered and the module will
/// be in passive mode.
type TermDuration: Get<Self::BlockNumber>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
decl_storage! {
@@ -1093,6 +1128,7 @@ mod tests {
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
parameter_types! {
@@ -1105,7 +1141,8 @@ mod tests {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Module<Test>;
}
type WeightInfo = ();
}
parameter_types! {
pub const CandidacyBond: u64 = 3;
@@ -1213,6 +1250,7 @@ mod tests {
type LoserCandidate = ();
type KickedMember = ();
type BadReport = ();
type WeightInfo = ();
}
pub type Block = sp_runtime::generic::Block<Header, UncheckedExtrinsic>;