Skip to content

Commit 3bd3efc

Browse files
authored
chore: fix benchmarking (#702)
# Fixes [#3591](KILTprotocol/ticket#3591) This PR fixes the benchmarking logic. Instead of piping the output into a specific file, the default value is used, which is the pallet name itself. This change is necessary for pallets with multiple instances in the runtime. While running the benchmarks, some extrinsics failed due to insufficient funds of the submitter. I'm not sure of the underlying issue, but the tests are still passing. Simply increasing the funds should resolve it.
1 parent f14719f commit 3bd3efc

12 files changed

+1107
-190
lines changed

pallets/parachain-staking/src/benchmarking.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ benchmarks! {
438438
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, amount);
439439

440440
// increase stake so we can unstake, because current stake is minimum
441-
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15)));
441+
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(17)));
442442
assert_ok!(Pallet::<T>::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), T::CurrencyBalance::from(u as u64)));
443443
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, amount + T::CurrencyBalance::from(u as u64));
444444

@@ -474,7 +474,7 @@ benchmarks! {
474474
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, T::MinDelegatorStake::get());
475475

476476
// increase stake so we can unstake, because current stake is minimum
477-
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15)));
477+
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(17)));
478478
assert_ok!(Pallet::<T>::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), amount + amount));
479479
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, T::MinDelegatorStake::get() + amount + amount);
480480

@@ -511,7 +511,7 @@ benchmarks! {
511511
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, T::MinDelegatorStake::get());
512512

513513
// increase stake so we can unstake, because current stake is minimum
514-
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(15)));
514+
T::Currency::set_balance(&delegator, T::CurrencyBalance::from(10u128.pow(17)));
515515
assert_ok!(Pallet::<T>::delegator_stake_more(RawOrigin::Signed(delegator.clone()).into(), amount + amount));
516516
assert_eq!(DelegatorState::<T>::get(&delegator).unwrap().amount, T::MinDelegatorStake::get() + amount + amount);
517517

@@ -533,7 +533,7 @@ benchmarks! {
533533
let u in 1 .. (T::MaxUnstakeRequests::get() - 1);
534534

535535
let candidate = account("collator", 0u32, COLLATOR_ACCOUNT_SEED);
536-
let free_balance = T::CurrencyBalance::from(10u128.pow(15));
536+
let free_balance = T::CurrencyBalance::from(10u128.pow(20));
537537
let stake = T::MinCollatorCandidateStake::get();
538538
T::Currency::set_balance(&candidate, free_balance);
539539
assert_ok!(Pallet::<T>::join_candidates(

runtimes/peregrine/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl pallet_collective::Config<CouncilCollective> for Runtime {
517517
type MaxProposals = constants::governance::CouncilMaxProposals;
518518
type MaxMembers = constants::governance::CouncilMaxMembers;
519519
type DefaultVote = pallet_collective::PrimeDefaultVote;
520-
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
520+
type WeightInfo = weights::pallet_collective_council::WeightInfo<Runtime>;
521521
type SetMembersOrigin = EnsureRoot<AccountId>;
522522
}
523523

@@ -531,7 +531,7 @@ impl pallet_collective::Config<TechnicalCollective> for Runtime {
531531
type MaxProposals = constants::governance::TechnicalMaxProposals;
532532
type MaxMembers = constants::governance::TechnicalMaxMembers;
533533
type DefaultVote = pallet_collective::PrimeDefaultVote;
534-
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
534+
type WeightInfo = weights::pallet_collective_technical_committee::WeightInfo<Runtime>;
535535
type SetMembersOrigin = EnsureRoot<AccountId>;
536536
}
537537

runtimes/peregrine/src/weights/pallet_dmp_queue.rs runtimes/peregrine/src/weights/cumulus_pallet_dmp_queue.rs

+15-13
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,25 @@
1919
//! Autogenerated weights for `cumulus_pallet_dmp_queue`
2020
//!
2121
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0
22-
//! DATE: 2024-06-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
22+
//! DATE: 2024-08-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
2323
//! WORST CASE MAP SIZE: `1000000`
2424
//! HOSTNAME: `eyrie-7`, CPU: `Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz`
2525
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
2626
2727
// Executed Command:
28-
// ./target/debug/kilt-parachain
28+
// ./target/release/kilt-parachain
2929
// benchmark
3030
// pallet
3131
// --template=.maintain/runtime-weight-template.hbs
3232
// --header=HEADER-GPL
3333
// --wasm-execution=compiled
34+
// --heap-pages=4096
35+
// --steps=50
36+
// --repeat=20
3437
// --chain=dev
35-
// --pallet
36-
// cumulus-pallet-dmp-queue
38+
// --pallet=cumulus-pallet-dmp-queue
3739
// --extrinsic=*
38-
// --output=./spend.rs
40+
// --output=./runtimes/peregrine/src/weights/cumulus_pallet_dmp_queue.rs
3941

4042
#![cfg_attr(rustfmt, rustfmt_skip)]
4143
#![allow(unused_parens)]
@@ -63,8 +65,8 @@ impl<T: frame_system::Config> cumulus_pallet_dmp_queue::WeightInfo for WeightInf
6365
// Proof Size summary in bytes:
6466
// Measured: `65764`
6567
// Estimated: `69229`
66-
// Minimum execution time: 698_233_000 picoseconds.
67-
Weight::from_parts(701_118_000, 0)
68+
// Minimum execution time: 131_132_000 picoseconds.
69+
Weight::from_parts(132_136_000, 0)
6870
.saturating_add(Weight::from_parts(0, 69229))
6971
.saturating_add(T::DbWeight::get().reads(5))
7072
.saturating_add(T::DbWeight::get().writes(5))
@@ -79,8 +81,8 @@ impl<T: frame_system::Config> cumulus_pallet_dmp_queue::WeightInfo for WeightInf
7981
// Proof Size summary in bytes:
8082
// Measured: `65660`
8183
// Estimated: `69125`
82-
// Minimum execution time: 487_148_000 picoseconds.
83-
Weight::from_parts(511_739_000, 0)
84+
// Minimum execution time: 65_674_000 picoseconds.
85+
Weight::from_parts(66_685_000, 0)
8486
.saturating_add(Weight::from_parts(0, 69125))
8587
.saturating_add(T::DbWeight::get().reads(3))
8688
.saturating_add(T::DbWeight::get().writes(2))
@@ -103,8 +105,8 @@ impl<T: frame_system::Config> cumulus_pallet_dmp_queue::WeightInfo for WeightInf
103105
// Proof Size summary in bytes:
104106
// Measured: `65794`
105107
// Estimated: `69259`
106-
// Minimum execution time: 753_994_000 picoseconds.
107-
Weight::from_parts(757_367_000, 0)
108+
// Minimum execution time: 126_289_000 picoseconds.
109+
Weight::from_parts(127_492_000, 0)
108110
.saturating_add(Weight::from_parts(0, 69259))
109111
.saturating_add(T::DbWeight::get().reads(6))
110112
.saturating_add(T::DbWeight::get().writes(6))
@@ -121,8 +123,8 @@ impl<T: frame_system::Config> cumulus_pallet_dmp_queue::WeightInfo for WeightInf
121123
// Proof Size summary in bytes:
122124
// Measured: `65690`
123125
// Estimated: `69155`
124-
// Minimum execution time: 532_680_000 picoseconds.
125-
Weight::from_parts(539_061_000, 0)
126+
// Minimum execution time: 59_799_000 picoseconds.
127+
Weight::from_parts(60_416_000, 0)
126128
.saturating_add(Weight::from_parts(0, 69155))
127129
.saturating_add(T::DbWeight::get().reads(4))
128130
.saturating_add(T::DbWeight::get().writes(3))

runtimes/peregrine/src/weights/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@
1919

2020
pub mod attestation;
2121
pub mod ctype;
22+
pub mod cumulus_pallet_dmp_queue;
2223
pub mod cumulus_pallet_parachain_system;
2324
pub mod delegation;
2425
pub mod did;
2526
pub mod frame_system;
2627
pub mod pallet_asset_switch;
2728
pub mod pallet_assets;
2829
pub mod pallet_balances;
29-
pub mod pallet_collective;
30+
pub mod pallet_collective_council;
31+
pub mod pallet_collective_technical_committee;
3032
pub mod pallet_democracy;
3133
pub mod pallet_deposit_storage;
3234
pub mod pallet_did_lookup;
3335
pub mod pallet_dip_provider;
34-
pub mod pallet_dmp_queue;
3536
pub mod pallet_indices;
3637
pub mod pallet_inflation;
3738
pub mod pallet_membership;

0 commit comments

Comments
 (0)