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

Runtime: Success value and reachable location for Polkadot Collectives benchmarks #2784

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,15 @@ impl pallet_ranked_collective::Config<FellowshipCollectiveInstance> for Runtime
type WeightInfo = weights::pallet_ranked_collective::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
// Promotions and the induction of new members are serviced by `FellowshipCore` pallet instance.
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<{ ranks::DAN_9 }>>;
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
type PromoteOrigin = EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have this behind #[cfg(feature = "runtime-benchmarks")] and have DAN_9 if the feature is not enabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this was pulled out into a type def then that type could also be referenced in the DemoteOrigin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked this way for simplicity, both ways looks ok to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added a separate promote origin for benches, please approve if looks good

// Demotion is by any of:
// - Root can demote arbitrarily.
// - the FellowshipAdmin origin (i.e. token holder referendum);
//
// The maximum value of `u16` set as a success value for the root to ensure the benchmarks will pass.
type DemoteOrigin = EitherOf<
EnsureRootWithSuccess<Self::AccountId, ConstU16<{ ranks::DAN_9 }>>,
EnsureRootWithSuccess<Self::AccountId, ConstU16<65535>>,
MapSuccess<
EnsureXcm<IsVoiceOfBody<GovernanceLocation, FellowshipAdminBodyId>>,
Replace<ConstU16<{ ranks::DAN_9 }>>,
Expand Down Expand Up @@ -182,8 +185,18 @@ pub type FellowshipSalaryInstance = pallet_salary::Instance1;

use xcm::prelude::*;

#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub AssetHub: MultiLocation = (Parent, Parachain(1000)).into();
}

#[cfg(feature = "runtime-benchmarks")]
muharem marked this conversation as resolved.
Show resolved Hide resolved
parameter_types! {
// The reachable location within the benchmark environment.
pub AssetHub: MultiLocation = Parent.into();
}

parameter_types! {
pub AssetHubUsdtId: AssetId = (PalletInstance(50), GeneralIndex(1984)).into();
pub UsdtAsset: LocatableAssetId = LocatableAssetId {
location: AssetHub::get(),
Expand Down