mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
add generated weight info for pallet-collective (#6789)
* add benchmark for disapprove_proposal * use generated WeightInfo for pallet-collective weights * order collective benchmark params alphabetically to get a consistent ordering * address review comments * remove default impl of WeightInfo for () * remove comments about weight changes * add default weights * Apply suggestions from code review Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * whitelist voter account in benchmark * update weights * MaxMembers configurable * remove base weight comment * add weight to technical collective * another DB whitelist optimization Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -509,6 +509,7 @@ impl pallet_democracy::Trait for Runtime {
|
||||
parameter_types! {
|
||||
pub const CouncilMotionDuration: BlockNumber = 5 * DAYS;
|
||||
pub const CouncilMaxProposals: u32 = 100;
|
||||
pub const CouncilMaxMembers: u32 = 100;
|
||||
}
|
||||
|
||||
type CouncilCollective = pallet_collective::Instance1;
|
||||
@@ -518,7 +519,8 @@ impl pallet_collective::Trait<CouncilCollective> for Runtime {
|
||||
type Event = Event;
|
||||
type MotionDuration = CouncilMotionDuration;
|
||||
type MaxProposals = CouncilMaxProposals;
|
||||
type WeightInfo = ();
|
||||
type MaxMembers = CouncilMaxMembers;
|
||||
type WeightInfo = weights::pallet_collective::WeightInfo;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
@@ -530,8 +532,8 @@ parameter_types! {
|
||||
pub const ElectionsPhragmenModuleId: LockIdentifier = *b"phrelect";
|
||||
}
|
||||
|
||||
// Make sure that there are no more than `MAX_MEMBERS` members elected via elections-phragmen.
|
||||
const_assert!(DesiredMembers::get() <= pallet_collective::MAX_MEMBERS);
|
||||
// Make sure that there are no more than `MaxMembers` members elected via elections-phragmen.
|
||||
const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get());
|
||||
|
||||
impl pallet_elections_phragmen::Trait for Runtime {
|
||||
type Event = Event;
|
||||
@@ -556,6 +558,7 @@ impl pallet_elections_phragmen::Trait for Runtime {
|
||||
parameter_types! {
|
||||
pub const TechnicalMotionDuration: BlockNumber = 5 * DAYS;
|
||||
pub const TechnicalMaxProposals: u32 = 100;
|
||||
pub const TechnicalMaxMembers: u32 = 100;
|
||||
}
|
||||
|
||||
type TechnicalCollective = pallet_collective::Instance2;
|
||||
@@ -565,7 +568,8 @@ impl pallet_collective::Trait<TechnicalCollective> for Runtime {
|
||||
type Event = Event;
|
||||
type MotionDuration = TechnicalMotionDuration;
|
||||
type MaxProposals = TechnicalMaxProposals;
|
||||
type WeightInfo = ();
|
||||
type MaxMembers = TechnicalMaxMembers;
|
||||
type WeightInfo = weights::pallet_collective::WeightInfo;
|
||||
}
|
||||
|
||||
type EnsureRootOrHalfCouncil = EnsureOneOf<
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
pub mod frame_system;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collective;
|
||||
pub mod pallet_democracy;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_timestamp;
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright (C) 2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
pub struct WeightInfo;
|
||||
impl pallet_collective::WeightInfo for WeightInfo {
|
||||
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((21040000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((173000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add((31595000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight)))
|
||||
}
|
||||
fn execute(b: u32, m: u32, ) -> Weight {
|
||||
(43359000 as Weight)
|
||||
.saturating_add((4000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add((123000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
}
|
||||
fn propose_execute(b: u32, m: u32, ) -> Weight {
|
||||
(54134000 as Weight)
|
||||
.saturating_add((4000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add((239000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
}
|
||||
fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight {
|
||||
(90650000 as Weight)
|
||||
.saturating_add((5000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add((152000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((970000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn vote(m: u32, ) -> Weight {
|
||||
(74460000 as Weight)
|
||||
.saturating_add((290000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn close_early_disapproved(m: u32, p: u32, ) -> Weight {
|
||||
(86360000 as Weight)
|
||||
.saturating_add((232000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((954000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight {
|
||||
(123653000 as Weight)
|
||||
.saturating_add((1000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add((287000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((920000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn close_disapproved(m: u32, p: u32, ) -> Weight {
|
||||
(95395000 as Weight)
|
||||
.saturating_add((236000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((965000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn close_approved(b: u32, m: u32, p: u32, ) -> Weight {
|
||||
(135284000 as Weight)
|
||||
.saturating_add((4000 as Weight).saturating_mul(b as Weight))
|
||||
.saturating_add((218000 as Weight).saturating_mul(m as Weight))
|
||||
.saturating_add((951000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn disapprove_proposal(p: u32, ) -> Weight {
|
||||
(50500000 as Weight)
|
||||
.saturating_add((966000 as Weight).saturating_mul(p as Weight))
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user