mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +00:00
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:
@@ -115,6 +115,16 @@ use sp_timestamp::{
|
||||
OnTimestampSet,
|
||||
};
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn set(t: u32, ) -> Weight;
|
||||
fn on_finalize(t: u32, ) -> Weight;
|
||||
}
|
||||
|
||||
impl WeightInfo for () {
|
||||
fn set(_t: u32, ) -> Weight { 1_000_000_000 }
|
||||
fn on_finalize(_t: u32, ) -> Weight { 1_000_000_000 }
|
||||
}
|
||||
|
||||
/// The module configuration trait
|
||||
pub trait Trait: frame_system::Trait {
|
||||
/// Type used for expressing timestamp.
|
||||
@@ -129,6 +139,9 @@ pub trait Trait: frame_system::Trait {
|
||||
/// work with this to determine a sensible block time. e.g. For Aura, it will be double this
|
||||
/// period on default settings.
|
||||
type MinimumPeriod: Get<Self::Moment>;
|
||||
|
||||
/// Weight information for extrinsics in this pallet.
|
||||
type WeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
@@ -338,6 +351,7 @@ mod tests {
|
||||
type AccountData = ();
|
||||
type OnNewAccount = ();
|
||||
type OnKilledAccount = ();
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = 5;
|
||||
@@ -346,6 +360,7 @@ mod tests {
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = ();
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
type Timestamp = Module<Test>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user