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
@@ -226,6 +226,18 @@ pub struct Heartbeat<BlockNumber>
pub validators_len: u32,
}
pub trait WeightInfo {
fn heartbeat(k: u32, e: u32, ) -> Weight;
fn validate_unsigned(k: u32, e: u32, ) -> Weight;
fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight;
}
impl WeightInfo for () {
fn heartbeat(_k: u32, _e: u32, ) -> Weight { 1_000_000_000 }
fn validate_unsigned(_k: u32, _e: u32, ) -> Weight { 1_000_000_000 }
fn validate_unsigned_and_then_heartbeat(_k: u32, _e: u32, ) -> Weight { 1_000_000_000 }
}
pub trait Trait: SendTransactionTypes<Call<Self>> + pallet_session::historical::Trait {
/// The identifier type for an authority.
type AuthorityId: Member + Parameter + RuntimeAppPublic + Default + Ord;
@@ -254,6 +266,9 @@ pub trait Trait: SendTransactionTypes<Call<Self>> + pallet_session::historical::
/// 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;
}
decl_event!(
+3
View File
@@ -134,6 +134,7 @@ impl frame_system::Trait for Runtime {
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
parameter_types! {
@@ -155,6 +156,7 @@ impl pallet_session::Trait for Runtime {
type Event = ();
type DisabledValidatorsThreshold = DisabledValidatorsThreshold;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type WeightInfo = ();
}
impl pallet_session::historical::Trait for Runtime {
@@ -183,6 +185,7 @@ impl Trait for Runtime {
type ReportUnresponsiveness = OffenceHandler;
type SessionDuration = Period;
type UnsignedPriority = UnsignedPriority;
type WeightInfo = ();
}
impl<LocalCall> frame_system::offchain::SendTransactionTypes<LocalCall> for Runtime where