Skip to content

Commit df27d55

Browse files
snowmeadRomarQ
andauthored
Add pallet-collective instances benchmarks to all runtimes (#3208)
* Add pallet-collective instance benchmarks to all runtimes. Run benches script now uses frame-omni-bencher and outputs to a folder instead of a file to support pallet instances. * Install frame-omni-bencher in check-benchmarks workflow * Install frame-omni-bencher from polkadot-sdk release * Create link file to frame-omni-bencher to run from scripts folder * Update scripts/run-benches-for-runtime.sh * Update .github/workflows/check-benchmarks.yml Co-authored-by: Rodrigo Quelhas <[email protected]> --------- Co-authored-by: Rodrigo Quelhas <[email protected]>
1 parent a738b0f commit df27d55

20 files changed

+1801
-935
lines changed

.github/workflows/check-benchmarks.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
schedule:
66
- cron: "0 5 * * 0" # Runs every Sunday at 5:00 AM UTC
77
- cron: "0 5 * * 3" # Runs every Wednesday at 5:00 AM UTC
8+
9+
env:
10+
FRAME_OMNI_BENCHER_RELEASE_VERSION: polkadot-stable2412
811

912
jobs:
1013
set-tags:
@@ -59,6 +62,12 @@ jobs:
5962
rustup override unset
6063
rustup show
6164
rustup target add wasm32-unknown-unknown
65+
- name: Install frame-omni-bencher
66+
shell: bash
67+
run: |
68+
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/$FRAME_OMNI_BENCHER_RELEASE_VERSION/frame-omni-bencher -o frame-omni-bencher
69+
chmod +x ./frame-omni-bencher
70+
./frame-omni-bencher --version
6271
- name: Run benchmarks
6372
shell: bash
6473
run: |

runtime/moonbase/src/governance/councils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl pallet_collective::Config<TreasuryCouncilInstance> for Runtime {
3939
/// The maximum number of treasury council members.
4040
type MaxMembers = ConstU32<9>;
4141
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
42-
type WeightInfo = moonbase_weights::pallet_collective::WeightInfo<Runtime>;
42+
type WeightInfo = moonbase_weights::pallet_collective_treasury_council::WeightInfo<Runtime>;
4343
type SetMembersOrigin = referenda::GeneralAdminOrRoot;
4444
type MaxProposalWeight = MaxProposalWeight;
4545
}
@@ -56,7 +56,7 @@ impl pallet_collective::Config<OpenTechCommitteeInstance> for Runtime {
5656
/// The maximum number of technical committee members.
5757
type MaxMembers = ConstU32<100>;
5858
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
59-
type WeightInfo = moonbase_weights::pallet_collective::WeightInfo<Runtime>;
59+
type WeightInfo = moonbase_weights::pallet_collective_open_tech_committee::WeightInfo<Runtime>;
6060
type SetMembersOrigin = referenda::GeneralAdminOrRoot;
6161
type MaxProposalWeight = MaxProposalWeight;
6262
}

runtime/moonbase/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,12 @@ use moonbeam_runtime_common::deal_with_fees::{
14621462

14631463
#[cfg(feature = "runtime-benchmarks")]
14641464
mod benches {
1465+
// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435
1466+
#[allow(unused_imports)]
1467+
use pallet_collective as pallet_collective_treasury_council;
1468+
#[allow(unused_imports)]
1469+
use pallet_collective as pallet_collective_open_tech_committee;
1470+
14651471
frame_support::parameter_types! {
14661472
pub const MaxBalance: crate::Balance = crate::Balance::max_value();
14671473
}
@@ -1501,6 +1507,8 @@ mod benches {
15011507
[pallet_precompile_benchmarks, PrecompileBenchmarks]
15021508
[pallet_parameters, Parameters]
15031509
[pallet_xcm_weight_trader, XcmWeightTrader]
1510+
[pallet_collective_treasury_council, TreasuryCouncilCollective]
1511+
[pallet_collective_open_tech_committee, OpenTechCommitteeCollective]
15041512
);
15051513
}
15061514

runtime/moonbase/src/weights/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub mod pallet_author_inherent;
2525
pub mod pallet_author_mapping;
2626
pub mod pallet_author_slot_filter;
2727
pub mod pallet_balances;
28-
pub mod pallet_collective;
28+
pub mod pallet_collective_open_tech_committee;
29+
pub mod pallet_collective_treasury_council;
2930
pub mod pallet_conviction_voting;
3031
pub mod pallet_crowdloan_rewards;
3132
pub mod pallet_evm;

runtime/moonbase/src/weights/pallet_collective.rs

Lines changed: 0 additions & 308 deletions
This file was deleted.

runtime/moonbase/src/weights/pallet_collective_open_tech_committee.rs

Lines changed: 289 additions & 0 deletions
Large diffs are not rendered by default.

runtime/moonbase/src/weights/pallet_collective_treasury_council.rs

Lines changed: 291 additions & 0 deletions
Large diffs are not rendered by default.

runtime/moonbeam/src/governance/councils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl pallet_collective::Config<TreasuryCouncilInstance> for Runtime {
3838
/// The maximum number of treasury council members.
3939
type MaxMembers = ConstU32<9>;
4040
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
41-
type WeightInfo = moonbeam_weights::pallet_collective::WeightInfo<Runtime>;
41+
type WeightInfo = moonbeam_weights::pallet_collective_treasury_council::WeightInfo<Runtime>;
4242
type SetMembersOrigin = referenda::GeneralAdminOrRoot;
4343
type MaxProposalWeight = MaxProposalWeight;
4444
}
@@ -55,7 +55,7 @@ impl pallet_collective::Config<OpenTechCommitteeInstance> for Runtime {
5555
/// The maximum number of technical committee members.
5656
type MaxMembers = ConstU32<100>;
5757
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
58-
type WeightInfo = moonbeam_weights::pallet_collective::WeightInfo<Runtime>;
58+
type WeightInfo = moonbeam_weights::pallet_collective_open_tech_committee::WeightInfo<Runtime>;
5959
type SetMembersOrigin = referenda::GeneralAdminOrRoot;
6060
type MaxProposalWeight = MaxProposalWeight;
6161
}

runtime/moonbeam/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,12 @@ use moonbeam_runtime_common::deal_with_fees::{
14571457

14581458
#[cfg(feature = "runtime-benchmarks")]
14591459
mod benches {
1460+
// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435
1461+
#[allow(unused_imports)]
1462+
use pallet_collective as pallet_collective_treasury_council;
1463+
#[allow(unused_imports)]
1464+
use pallet_collective as pallet_collective_open_tech_committee;
1465+
14601466
frame_support::parameter_types! {
14611467
pub const MaxBalance: crate::Balance = crate::Balance::max_value();
14621468
}
@@ -1495,6 +1501,8 @@ mod benches {
14951501
[pallet_precompile_benchmarks, PrecompileBenchmarks]
14961502
[pallet_parameters, Parameters]
14971503
[pallet_xcm_weight_trader, XcmWeightTrader]
1504+
[pallet_collective_treasury_council, TreasuryCouncilCollective]
1505+
[pallet_collective_open_tech_committee, OpenTechCommitteeCollective]
14981506
);
14991507
}
15001508

runtime/moonbeam/src/weights/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ pub mod pallet_author_inherent;
2525
pub mod pallet_author_mapping;
2626
pub mod pallet_author_slot_filter;
2727
pub mod pallet_balances;
28-
pub mod pallet_collective;
28+
pub mod pallet_collective_open_tech_committee;
29+
pub mod pallet_collective_treasury_council;
2930
pub mod pallet_conviction_voting;
3031
pub mod pallet_crowdloan_rewards;
3132
pub mod pallet_evm;

0 commit comments

Comments
 (0)