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
+29
View File
@@ -64,6 +64,32 @@ type BalanceOf<T> = <<T as Trait>::Currency as Currency<<T as frame_system::Trai
/// Just a bunch of bytes, but they should decode to a valid `Call`.
pub type OpaqueCall = Vec<u8>;
pub trait WeightInfo {
fn as_multi_threshold_1(z: u32, ) -> Weight;
fn as_multi_create(s: u32, z: u32, ) -> Weight;
fn as_multi_create_store(s: u32, z: u32, ) -> Weight;
fn as_multi_approve(s: u32, z: u32, ) -> Weight;
fn as_multi_complete(s: u32, z: u32, ) -> Weight;
fn approve_as_multi_create(s: u32, z: u32, ) -> Weight;
fn approve_as_multi_approve(s: u32, z: u32, ) -> Weight;
fn approve_as_multi_complete(s: u32, z: u32, ) -> Weight;
fn cancel_as_multi(s: u32, z: u32, ) -> Weight;
fn cancel_as_multi_store(s: u32, z: u32, ) -> Weight;
}
impl WeightInfo for () {
fn as_multi_threshold_1(_z: u32, ) -> Weight { 1_000_000_000 }
fn as_multi_create(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn as_multi_create_store(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn as_multi_approve(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn as_multi_complete(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn approve_as_multi_create(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn approve_as_multi_approve(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn approve_as_multi_complete(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn cancel_as_multi(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
fn cancel_as_multi_store(_s: u32, _z: u32, ) -> Weight { 1_000_000_000 }
}
/// Configuration trait.
pub trait Trait: frame_system::Trait {
/// The overarching event type.
@@ -91,6 +117,9 @@ pub trait Trait: frame_system::Trait {
/// The maximum amount of signatories allowed in the multisig.
type MaxSignatories: Get<u16>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
/// A global extrinsic index, formed as the extrinsic index within a block, together with that
+3
View File
@@ -84,6 +84,7 @@ impl frame_system::Trait for Test {
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
}
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
@@ -94,6 +95,7 @@ impl pallet_balances::Trait for Test {
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type WeightInfo = ();
}
parameter_types! {
pub const DepositBase: u64 = 1;
@@ -118,6 +120,7 @@ impl Trait for Test {
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = MaxSignatories;
type WeightInfo = ();
}
type System = frame_system::Module<Test>;
type Balances = pallet_balances::Module<Test>;