-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(mainnet): include all benchmarks #478
base: main
Are you sure you want to change the base?
Changes from all commits
b8e691d
1fa8619
e152d82
5d76f6a
1c65204
98d8897
b42dffd
21b20f9
cf9b094
dba50a3
c340ad3
2042208
c74fbba
19855ca
6833aee
bc9d610
a9d4177
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use crate::{config::assets::TrustBackedAssetsInstance, Runtime}; | ||
|
||
/// Instance of `pallet_assets` used for benchmarks of trust backed assets. | ||
pub type TrustBackedAssets = pallet_assets::Pallet<Runtime, TrustBackedAssetsInstance>; | ||
|
||
frame_benchmarking::define_benchmarks!( | ||
// Ordered as per runtime | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔥 |
||
// System | ||
[frame_system, SystemBench::<Runtime>] | ||
[frame_system_extensions, SystemExtensionsBench::<Runtime>] | ||
[cumulus_pallet_parachain_system, ParachainSystem] | ||
[pallet_timestamp, Timestamp] | ||
// Monetary | ||
[pallet_balances, Balances] | ||
[pallet_transaction_payment, TransactionPayment] | ||
[pallet_treasury, Treasury] | ||
// Governance | ||
[pallet_sudo, Sudo] | ||
[pallet_collective, Council] | ||
[pallet_motion, Motion] | ||
// Collation support | ||
[pallet_collator_selection, CollatorSelection] | ||
[pallet_session, SessionBench::<Runtime>] | ||
// Scheduler | ||
[pallet_scheduler, Scheduler] | ||
// Preimage | ||
[pallet_preimage, Preimage] | ||
// XCM | ||
[cumulus_pallet_xcmp_queue, XcmpQueue] | ||
// TODO: intro xcm benchmarks | ||
//[pallet_xcm, PolkadotXcm::<Runtime>] | ||
[pallet_message_queue, MessageQueue] | ||
// Contracts | ||
[pallet_revive, Revive] | ||
// Proxy | ||
[pallet_proxy, Proxy] | ||
// Multisig | ||
[pallet_multisig, Multisig] | ||
// Utility | ||
[pallet_utility, Utility] | ||
// Assets | ||
[pallet_nfts, Nfts] | ||
[pallet_assets, TrustBackedAssets] | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
use pop_runtime_common::{HOURS, SLOT_DURATION}; | ||
|
||
use crate::{ | ||
parameter_types, AccountId, Aura, AuraId, Balances, CollatorSelection, ConstBool, ConstU32, | ||
ConstU64, EnsureRoot, PalletId, Runtime, RuntimeEvent, Session, SessionKeys, | ||
parameter_types, weights, AccountId, Aura, AuraId, Balances, CollatorSelection, ConstBool, | ||
ConstU32, ConstU64, EnsureRoot, PalletId, Runtime, RuntimeEvent, Session, SessionKeys, | ||
}; | ||
|
||
impl pallet_authorship::Config for Runtime { | ||
|
@@ -37,6 +37,10 @@ impl pallet_collator_selection::Config for Runtime { | |
type Currency = Balances; | ||
// Should be a multiple of session or things will get inconsistent. | ||
type KickThreshold = Period; | ||
#[cfg(feature = "runtime-benchmarks")] | ||
// If configured to `0`, benchmarks underflows. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
type MaxCandidates = ConstU32<10>; | ||
#[cfg(not(feature = "runtime-benchmarks"))] | ||
type MaxCandidates = ConstU32<0>; | ||
type MaxInvulnerables = ConstU32<20>; | ||
type MinEligibleCollators = ConstU32<3>; | ||
|
@@ -46,7 +50,7 @@ impl pallet_collator_selection::Config for Runtime { | |
type ValidatorId = AccountId; | ||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator; | ||
type ValidatorRegistration = Session; | ||
type WeightInfo = pallet_collator_selection::weights::SubstrateWeight<Runtime>; | ||
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>; | ||
} | ||
|
||
impl cumulus_pallet_aura_ext::Config for Runtime {} | ||
|
@@ -61,7 +65,7 @@ impl pallet_session::Config for Runtime { | |
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>; | ||
type ValidatorId = AccountId; | ||
type ValidatorIdOf = pallet_collator_selection::IdentityCollator; | ||
type WeightInfo = pallet_session::weights::SubstrateWeight<Runtime>; | ||
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>; | ||
} | ||
|
||
#[cfg(test)] | ||
|
@@ -154,8 +158,14 @@ mod tests { | |
|
||
#[test] | ||
fn candidates_disabled() { | ||
#[cfg(feature = "runtime-benchmarks")] | ||
assert_eq!( | ||
<<Runtime as pallet_collator_selection::Config>::MaxCandidates as Get<u32>>::get(), | ||
10 | ||
); | ||
// Disabled to start until sufficient distribution/value to allow candidates to provide | ||
// candidacy bond | ||
#[cfg(not(feature = "runtime-benchmarks"))] | ||
assert_eq!( | ||
<<Runtime as pallet_collator_selection::Config>::MaxCandidates as Get<u32>>::get(), | ||
0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Assets. | ||
mod assets; | ||
pub(crate) mod assets; | ||
// Collation. | ||
pub(crate) mod collation; | ||
/// Governance. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
use sp_runtime::traits::{AccountIdConversion, IdentityLookup}; | ||
|
||
use crate::{ | ||
parameter_types, AccountId, Balance, Balances, BlockNumber, ConstU32, ConstU8, | ||
parameter_types, weights, AccountId, Balance, Balances, BlockNumber, ConstU32, ConstU8, | ||
ConstantMultiplier, EnsureRoot, PalletId, ResolveTo, Runtime, RuntimeEvent, | ||
RuntimeFreezeReason, RuntimeHoldReason, SlowAdjustingFeeUpdate, System, VariantCountOf, DAYS, | ||
EXISTENTIAL_DEPOSIT, | ||
|
@@ -129,7 +129,7 @@ | |
type RuntimeEvent = RuntimeEvent; | ||
type RuntimeFreezeReason = RuntimeFreezeReason; | ||
type RuntimeHoldReason = RuntimeHoldReason; | ||
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>; | ||
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>; | ||
} | ||
|
||
parameter_types! { | ||
|
@@ -164,7 +164,7 @@ | |
type OnChargeTransaction = OnChargeTransaction; | ||
type OperationalFeeMultiplier = ConstU8<5>; | ||
type RuntimeEvent = RuntimeEvent; | ||
type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Runtime>; | ||
type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>; | ||
type WeightToFee = fee::WeightToFee; | ||
} | ||
|
||
|
@@ -180,8 +180,8 @@ | |
pub struct BenchmarkHelper; | ||
#[cfg(feature = "runtime-benchmarks")] | ||
impl pallet_treasury::ArgumentsFactory<(), AccountId> for BenchmarkHelper { | ||
fn create_asset_kind(_seed: u32) -> () { | ||
Check warning on line 183 in runtime/mainnet/src/config/monetary.rs
|
||
() | ||
Check warning on line 184 in runtime/mainnet/src/config/monetary.rs
|
||
} | ||
|
||
fn create_beneficiary(seed: [u8; 32]) -> AccountId { | ||
|
@@ -189,7 +189,7 @@ | |
Balances::force_set_balance( | ||
crate::RuntimeOrigin::root(), | ||
account_id.clone().into(), | ||
EXISTENTIAL_DEPOSIT, | ||
ExistentialDeposit::get(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align with mainnet ED. |
||
) | ||
.unwrap(); | ||
account_id | ||
|
@@ -216,7 +216,7 @@ | |
/// Never allow origins except via the proposals process. | ||
type SpendOrigin = NeverEnsureOrigin<Balance>; | ||
type SpendPeriod = SpendPeriod; | ||
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>; | ||
type WeightInfo = weights::pallet_treasury::WeightInfo<Runtime>; | ||
} | ||
|
||
#[cfg(test)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the configuration in our runtime, this check will never ensure origin. Hence, the benchamrk needed to be updated such that a possible runtime config won't break it.
I have configure this case to use
Weightless
. Maybe MAX weight could be a better option.Same with the rest of changes below.