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
+65
View File
@@ -829,6 +829,68 @@ pub mod weight {
}
}
pub trait WeightInfo {
fn bond(u: u32, ) -> Weight;
fn bond_extra(u: u32, ) -> Weight;
fn unbond(u: u32, ) -> Weight;
fn withdraw_unbonded_update(s: u32, ) -> Weight;
fn withdraw_unbonded_kill(s: u32, ) -> Weight;
fn validate(u: u32, ) -> Weight;
fn nominate(n: u32, ) -> Weight;
fn chill(u: u32, ) -> Weight;
fn set_payee(u: u32, ) -> Weight;
fn set_controller(u: u32, ) -> Weight;
fn set_validator_count(c: u32, ) -> Weight;
fn force_no_eras(i: u32, ) -> Weight;
fn force_new_era(i: u32, ) -> Weight;
fn force_new_era_always(i: u32, ) -> Weight;
fn set_invulnerables(v: u32, ) -> Weight;
fn force_unstake(s: u32, ) -> Weight;
fn cancel_deferred_slash(s: u32, ) -> Weight;
fn payout_stakers(n: u32, ) -> Weight;
fn payout_stakers_alive_controller(n: u32, ) -> Weight;
fn rebond(l: u32, ) -> Weight;
fn set_history_depth(e: u32, ) -> Weight;
fn reap_stash(s: u32, ) -> Weight;
fn new_era(v: u32, n: u32, ) -> Weight;
fn do_slash(l: u32, ) -> Weight;
fn payout_all(v: u32, n: u32, ) -> Weight;
fn submit_solution_initial(v: u32, n: u32, a: u32, w: u32, ) -> Weight;
fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight;
fn submit_solution_weaker(v: u32, n: u32, ) -> Weight;
}
impl WeightInfo for () {
fn bond(_u: u32, ) -> Weight { 1_000_000_000 }
fn bond_extra(_u: u32, ) -> Weight { 1_000_000_000 }
fn unbond(_u: u32, ) -> Weight { 1_000_000_000 }
fn withdraw_unbonded_update(_s: u32, ) -> Weight { 1_000_000_000 }
fn withdraw_unbonded_kill(_s: u32, ) -> Weight { 1_000_000_000 }
fn validate(_u: u32, ) -> Weight { 1_000_000_000 }
fn nominate(_n: u32, ) -> Weight { 1_000_000_000 }
fn chill(_u: u32, ) -> Weight { 1_000_000_000 }
fn set_payee(_u: u32, ) -> Weight { 1_000_000_000 }
fn set_controller(_u: u32, ) -> Weight { 1_000_000_000 }
fn set_validator_count(_c: u32, ) -> Weight { 1_000_000_000 }
fn force_no_eras(_i: u32, ) -> Weight { 1_000_000_000 }
fn force_new_era(_i: u32, ) -> Weight { 1_000_000_000 }
fn force_new_era_always(_i: u32, ) -> Weight { 1_000_000_000 }
fn set_invulnerables(_v: u32, ) -> Weight { 1_000_000_000 }
fn force_unstake(_s: u32, ) -> Weight { 1_000_000_000 }
fn cancel_deferred_slash(_s: u32, ) -> Weight { 1_000_000_000 }
fn payout_stakers(_n: u32, ) -> Weight { 1_000_000_000 }
fn payout_stakers_alive_controller(_n: u32, ) -> Weight { 1_000_000_000 }
fn rebond(_l: u32, ) -> Weight { 1_000_000_000 }
fn set_history_depth(_e: u32, ) -> Weight { 1_000_000_000 }
fn reap_stash(_s: u32, ) -> Weight { 1_000_000_000 }
fn new_era(_v: u32, _n: u32, ) -> Weight { 1_000_000_000 }
fn do_slash(_l: u32, ) -> Weight { 1_000_000_000 }
fn payout_all(_v: u32, _n: u32, ) -> Weight { 1_000_000_000 }
fn submit_solution_initial(_v: u32, _n: u32, _a: u32, _w: u32, ) -> Weight { 1_000_000_000 }
fn submit_solution_better(_v: u32, _n: u32, _a: u32, _w: u32, ) -> Weight { 1_000_000_000 }
fn submit_solution_weaker(_v: u32, _n: u32, ) -> Weight { 1_000_000_000 }
}
pub trait Trait: frame_system::Trait + SendTransactionTypes<Call<Self>> {
/// The staking balance.
type Currency: LockableCurrency<Self::AccountId, Moment=Self::BlockNumber>;
@@ -915,6 +977,9 @@ pub trait Trait: frame_system::Trait + SendTransactionTypes<Call<Self>> {
/// This is exposed so that it can be tuned for particular runtime, when
/// multiple pallets send unsigned transactions.
type UnsignedPriority: Get<TransactionPriority>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
/// Mode of era-forcing.
+5
View File
@@ -224,6 +224,7 @@ impl frame_system::Trait for Test {
type AccountData = pallet_balances::AccountData<Balance>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
impl pallet_balances::Trait for Test {
type Balance = Balance;
@@ -231,6 +232,7 @@ impl pallet_balances::Trait for Test {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
}
parameter_types! {
pub const Offset: BlockNumber = 0;
@@ -252,6 +254,7 @@ impl pallet_session::Trait for Test {
type ValidatorIdOf = crate::StashOf<Test>;
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type WeightInfo = ();
}
impl pallet_session::historical::Trait for Test {
@@ -271,6 +274,7 @@ impl pallet_timestamp::Trait for Test {
type Moment = u64;
type OnTimestampSet = ();
type MinimumPeriod = MinimumPeriod;
type WeightInfo = ();
}
pallet_staking_reward_curve::build! {
const I_NPOS: PiecewiseLinear<'static> = curve!(
@@ -326,6 +330,7 @@ impl Trait for Test {
type MinSolutionScoreBump = MinSolutionScoreBump;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type UnsignedPriority = UnsignedPriority;
type WeightInfo = ();
}
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Test where