Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add benchmarking for parachain runtime configuration pallet #3862

Merged
17 commits merged into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8];
}

impl configuration::Config for Test {}
impl configuration::Config for Test {
type WeightInfo = configuration::weights::WeightInfo<Test>;
}

impl shared::Config for Test {}

Expand Down
14 changes: 8 additions & 6 deletions runtime/common/src/paras_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ pub mod pallet {
///
/// ## Events
/// The `Registered` event is emitted in case of success.
#[pallet::weight(T::WeightInfo::register())]
#[pallet::weight(<T as Config>::WeightInfo::register())]
pub fn register(
origin: OriginFor<T>,
id: ParaId,
Expand All @@ -231,7 +231,7 @@ pub mod pallet {
///
/// The deposit taken can be specified for this registration. Any `ParaId`
/// can be registered, including sub-1000 IDs which are System Parachains.
#[pallet::weight(T::WeightInfo::force_register())]
#[pallet::weight(<T as Config>::WeightInfo::force_register())]
pub fn force_register(
origin: OriginFor<T>,
who: T::AccountId,
Expand All @@ -247,7 +247,7 @@ pub mod pallet {
/// Deregister a Para Id, freeing all data and returning any deposit.
///
/// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread.
#[pallet::weight(T::WeightInfo::deregister())]
#[pallet::weight(<T as Config>::WeightInfo::deregister())]
pub fn deregister(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?;
Self::do_deregister(id)
Expand All @@ -264,7 +264,7 @@ pub mod pallet {
/// `ParaId` to be a long-term identifier of a notional "parachain". However, their
/// scheduling info (i.e. whether they're a parathread or parachain), auction information
/// and the auction deposit are switched.
#[pallet::weight(T::WeightInfo::swap())]
#[pallet::weight(<T as Config>::WeightInfo::swap())]
pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?;

Expand Down Expand Up @@ -325,7 +325,7 @@ pub mod pallet {
///
/// ## Events
/// The `Reserved` event is emitted in case of success, which provides the ID reserved for use.
#[pallet::weight(T::WeightInfo::reserve())]
#[pallet::weight(<T as Config>::WeightInfo::reserve())]
pub fn reserve(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
let id = NextFreeParaId::<T>::get().max(LOWEST_PUBLIC_ID);
Expand Down Expand Up @@ -659,7 +659,9 @@ mod tests {
type Event = Event;
}

impl configuration::Config for Test {}
impl configuration::Config for Test {
type WeightInfo = configuration::weights::WeightInfo<Test>;
}

parameter_types! {
pub const ParaDeposit: Balance = 10;
Expand Down
6 changes: 5 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,9 @@ impl pallet_proxy::Config for Runtime {

impl parachains_origin::Config for Runtime {}

impl parachains_configuration::Config for Runtime {}
impl parachains_configuration::Config for Runtime {
type WeightInfo = parachains_configuration::weights::WeightInfo<Runtime>;
}

impl parachains_shared::Config for Runtime {}

Expand Down Expand Up @@ -1954,6 +1956,7 @@ sp_api::impl_runtime_apis! {
list_benchmark!(list, extra, runtime_common::claims, Claims);
list_benchmark!(list, extra, runtime_common::slots, Slots);
list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar);
list_benchmark!(list, extra, runtime_parachains::configuration, Configuration);
// Substrate
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_bounties, Bounties);
Expand Down Expand Up @@ -2027,6 +2030,7 @@ sp_api::impl_runtime_apis! {
add_benchmark!(params, batches, runtime_common::claims, Claims);
add_benchmark!(params, batches, runtime_common::slots, Slots);
add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar);
add_benchmark!(params, batches, runtime_parachains::configuration, Configuration);
// Substrate
add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_bounties, Bounties);
Expand Down
4 changes: 2 additions & 2 deletions runtime/parachains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate",
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }

xcm = { package = "xcm", path = "../../xcm", default-features = false }
xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false }
Expand Down
Loading