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:
Alexander Popiak
2020-08-28 10:46:43 +02:00
committed by GitHub
parent 37d0e00d83
commit ff1e8150e1
6 changed files with 402 additions and 277 deletions
+8 -4
View File
@@ -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<