referrerpolicy=no-referrer-when-downgrade

penpal_runtime/
xcm_config.rs

1// This file is part of Cumulus.
2// SPDX-License-Identifier: Unlicense
3
4// This is free and unencumbered software released into the public domain.
5
6// Anyone is free to copy, modify, publish, use, compile, sell, or
7// distribute this software, either in source code form or as a compiled
8// binary, for any purpose, commercial or non-commercial, and by any
9// means.
10
11// In jurisdictions that recognize copyright laws, the author or authors
12// of this software dedicate any and all copyright interest in the
13// software to the public domain. We make this dedication for the benefit
14// of the public at large and to the detriment of our heirs and
15// successors. We intend this dedication to be an overt act of
16// relinquishment in perpetuity of all present and future rights to this
17// software under copyright law.
18
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25// OTHER DEALINGS IN THE SOFTWARE.
26
27// For more information, please refer to <http://unlicense.org/>
28
29//! Holds the XCM specific configuration that would otherwise be in lib.rs
30//!
31//! This configuration dictates how the Penpal chain will communicate with other chains.
32//!
33//! One of the main uses of the penpal chain will be to be a benefactor of reserve asset transfers
34//! with Asset Hub as the reserve. At present no derivative tokens are minted on receipt of a
35//! `ReserveAssetTransferDeposited` message but that will but the intension will be to support this
36//! soon.
37use super::{
38	AccountId, AllPalletsWithSystem, AssetId as AssetIdPalletAssets, Assets, Authorship, Balance,
39	Balances, CollatorSelection, ForeignAssets, ForeignAssetsInstance, NonZeroIssuance,
40	ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent,
41	RuntimeHoldReason, RuntimeOrigin, WeightToFee, XcmpQueue,
42};
43use crate::{BaseDeliveryFee, FeeAssetId, TransactionByteFee};
44use assets_common::TrustBackedAssetsAsLocation;
45use core::marker::PhantomData;
46use frame_support::{
47	parameter_types,
48	traits::{
49		fungible::HoldConsideration, tokens::imbalance::ResolveAssetTo, ConstU32, Contains,
50		ContainsPair, Equals, Everything, EverythingBut, Get, LinearStoragePrice, Nothing,
51		PalletInfoAccess,
52	},
53	weights::Weight,
54};
55use frame_system::EnsureRoot;
56use pallet_xcm::{AuthorizedAliasers, XcmPassthrough};
57use parachains_common::{
58	xcm_config::{AssetFeeAsExistentialDepositMultiplier, ConcreteAssetFromSystem},
59	TREASURY_PALLET_ID,
60};
61use polkadot_parachain_primitives::primitives::Sibling;
62use polkadot_runtime_common::{impls::ToAuthor, xcm_sender::ExponentialPrice};
63use sp_runtime::traits::{AccountIdConversion, ConvertInto, Identity, TryConvertInto};
64use testnet_parachains_constants::westend::currency::deposit;
65use xcm::latest::{prelude::*, WESTEND_GENESIS_HASH};
66use xcm_builder::{
67	AccountId32Aliases, AliasChildLocation, AliasOriginRootUsingFilter,
68	AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
69	AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
70	AsPrefixedGeneralIndex, ConvertedConcreteId, DescribeAllTerminal, DescribeFamily,
71	DescribeTerminus, EnsureXcmOrigin, ExternalConsensusLocationsConverterFor, FixedWeightBounds,
72	FrameTransactionalProcessor, FungibleAdapter, FungiblesAdapter, HashedDescription, IsConcrete,
73	LocalMint, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
74	SendXcmFeeToAccount, SiblingParachainAsNative, SiblingParachainConvertsVia,
75	SignedAccountId32AsNative, SignedToAccountId32, SingleAssetExchangeAdapter,
76	SovereignSignedViaLocation, StartsWith, TakeWeightCredit, TrailingSetTopicAsId,
77	UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
78};
79use xcm_executor::{traits::JustTry, XcmExecutor};
80
81parameter_types! {
82	pub const RelayLocation: Location = Location::parent();
83	// Local native currency which is stored in `pallet_balances`
84	pub const PenpalNativeCurrency: Location = Location::here();
85	// The Penpal runtime is utilized for testing with various environment setups.
86	// This storage item allows us to customize the `NetworkId` where Penpal is deployed.
87	// By default, it is set to `Westend Network` and can be changed using `System::set_storage`.
88	pub storage RelayNetworkId: NetworkId = NetworkId::ByGenesis(WESTEND_GENESIS_HASH);
89	pub RelayNetwork: Option<NetworkId> = Some(RelayNetworkId::get());
90	pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
91	pub UniversalLocation: InteriorLocation = [
92		GlobalConsensus(RelayNetworkId::get()),
93		Parachain(ParachainInfo::parachain_id().into())
94	].into();
95	pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
96	pub StakingPot: AccountId = CollatorSelection::account_id();
97	pub TrustBackedAssetsPalletIndex: u8 = <Assets as PalletInfoAccess>::index() as u8;
98	pub TrustBackedAssetsPalletLocation: Location =
99		PalletInstance(TrustBackedAssetsPalletIndex::get()).into();
100}
101
102/// Type for specifying how a `Location` can be converted into an `AccountId`. This is used
103/// when determining ownership of accounts for asset transacting and when attempting to use XCM
104/// `Transact` in order to determine the dispatch Origin.
105pub type LocationToAccountId = (
106	// The parent (Relay-chain) origin converts to the parent `AccountId`.
107	ParentIsPreset<AccountId>,
108	// Sibling parachain origins convert to AccountId via the `ParaId::into`.
109	SiblingParachainConvertsVia<Sibling, AccountId>,
110	// Straight up local `AccountId32` origins just alias directly to `AccountId`.
111	AccountId32Aliases<RelayNetwork, AccountId>,
112	// Foreign locations alias into accounts according to a hash of their standard description.
113	HashedDescription<AccountId, (DescribeTerminus, DescribeFamily<DescribeAllTerminal>)>,
114	// Different global consensus locations sovereign accounts.
115	ExternalConsensusLocationsConverterFor<UniversalLocation, AccountId>,
116);
117
118/// Means for transacting assets on this chain.
119pub type FungibleTransactor = FungibleAdapter<
120	// Use this currency:
121	Balances,
122	// Use this currency when it is a fungible asset matching the given location or name:
123	IsConcrete<PenpalNativeCurrency>,
124	// Do a simple punn to convert an AccountId32 Location into a native chain account ID:
125	LocationToAccountId,
126	// Our chain's account ID type (we can't get away without mentioning it explicitly):
127	AccountId,
128	// We don't track any teleports.
129	(),
130>;
131
132/// Means for transacting assets besides the native currency on this chain.
133pub type FungiblesTransactor = FungiblesAdapter<
134	// Use this fungibles implementation:
135	Assets,
136	// Use this currency when it is a fungible asset matching the given location or name:
137	(
138		ConvertedConcreteId<
139			AssetIdPalletAssets,
140			Balance,
141			AsPrefixedGeneralIndex<AssetsPalletLocation, AssetIdPalletAssets, JustTry>,
142			JustTry,
143		>,
144		ConvertedConcreteId<
145			AssetIdPalletAssets,
146			Balance,
147			AsPrefixedGeneralIndex<
148				SystemAssetHubAssetsPalletLocation,
149				AssetIdPalletAssets,
150				JustTry,
151			>,
152			JustTry,
153		>,
154	),
155	// Convert an XCM Location into a local account id:
156	LocationToAccountId,
157	// Our chain's account ID type (we can't get away without mentioning it explicitly):
158	AccountId,
159	// We only want to allow teleports of known assets. We use non-zero issuance as an indication
160	// that this asset is known.
161	LocalMint<NonZeroIssuance<AccountId, Assets>>,
162	// The account to use for tracking teleports.
163	CheckingAccount,
164>;
165
166// Using the latest `Location`, we don't need to worry about migrations for Penpal.
167pub type ForeignAssetsAssetId = Location;
168pub type ForeignAssetsConvertedConcreteId = xcm_builder::MatchedConvertedConcreteId<
169	Location,
170	Balance,
171	EverythingBut<(
172		// Here we rely on fact that something like this works:
173		// assert!(Location::new(1,
174		// [Parachain(100)]).starts_with(&Location::parent()));
175		// assert!([Parachain(100)].into().starts_with(&Here));
176		StartsWith<assets_common::matching::LocalLocationPattern>,
177	)>,
178	Identity,
179	TryConvertInto,
180>;
181
182/// Means for transacting foreign assets from different global consensus.
183pub type ForeignFungiblesTransactor = FungiblesAdapter<
184	// Use this fungibles implementation:
185	ForeignAssets,
186	// Use this currency when it is a fungible asset matching the given location or name:
187	ForeignAssetsConvertedConcreteId,
188	// Convert an XCM Location into a local account id:
189	LocationToAccountId,
190	// Our chain's account ID type (we can't get away without mentioning it explicitly):
191	AccountId,
192	// We don't need to check teleports here.
193	NoChecking,
194	// The account to use for tracking teleports.
195	CheckingAccount,
196>;
197
198/// Means for transacting assets on this chain.
199pub type AssetTransactors = (FungibleTransactor, ForeignFungiblesTransactor, FungiblesTransactor);
200
201/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
202/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can
203/// biases the kind of local `Origin` it will become.
204pub type XcmOriginToTransactDispatchOrigin = (
205	// Sovereign account converter; this attempts to derive an `AccountId` from the origin location
206	// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
207	// foreign chains who want to have a local sovereign account on this chain which they control.
208	SovereignSignedViaLocation<LocationToAccountId, RuntimeOrigin>,
209	// Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when
210	// recognized.
211	RelayChainAsNative<RelayChainOrigin, RuntimeOrigin>,
212	// Native converter for sibling Parachains; will convert to a `SiblingPara` origin when
213	// recognized.
214	SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
215	// Superuser converter for the Relay-chain (Parent) location. This will allow it to issue a
216	// transaction from the Root origin.
217	ParentAsSuperuser<RuntimeOrigin>,
218	// Native signed account converter; this just converts an `AccountId32` origin into a normal
219	// `RuntimeOrigin::Signed` origin of the same 32-byte value.
220	SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
221	// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
222	XcmPassthrough<RuntimeOrigin>,
223);
224
225parameter_types! {
226	pub const RootLocation: Location = Location::here();
227	// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
228	pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
229	pub const MaxInstructions: u32 = 100;
230	pub const MaxAssetsIntoHolding: u32 = 64;
231	pub XcmAssetFeesReceiver: Option<AccountId> = Authorship::author();
232}
233
234pub struct ParentOrParentsExecutivePlurality;
235impl Contains<Location> for ParentOrParentsExecutivePlurality {
236	fn contains(location: &Location) -> bool {
237		matches!(location.unpack(), (1, []) | (1, [Plurality { id: BodyId::Executive, .. }]))
238	}
239}
240
241pub type Barrier = TrailingSetTopicAsId<(
242	TakeWeightCredit,
243	// Expected responses are OK.
244	AllowKnownQueryResponses<PolkadotXcm>,
245	// Allow XCMs with some computed origins to pass through.
246	WithComputedOrigin<
247		(
248			// If the message is one that immediately attempts to pay for execution, then
249			// allow it.
250			AllowTopLevelPaidExecutionFrom<Everything>,
251			// Parent and its pluralities (i.e. governance bodies) get free execution.
252			AllowExplicitUnpaidExecutionFrom<(ParentOrParentsExecutivePlurality,)>,
253			// Subscriptions for version tracking are OK.
254			AllowSubscriptionsFrom<Everything>,
255			// HRMP notifications from the relay chain are OK.
256			AllowHrmpNotificationsFromRelayChain,
257		),
258		UniversalLocation,
259		ConstU32<8>,
260	>,
261)>;
262
263/// Type alias to conveniently refer to `frame_system`'s `Config::AccountId`.
264pub type AccountIdOf<R> = <R as frame_system::Config>::AccountId;
265
266/// Asset filter that allows all assets from a certain location matching asset id.
267pub struct AssetPrefixFrom<Prefix, Origin>(PhantomData<(Prefix, Origin)>);
268impl<Prefix, Origin> ContainsPair<Asset, Location> for AssetPrefixFrom<Prefix, Origin>
269where
270	Prefix: Get<Location>,
271	Origin: Get<Location>,
272{
273	fn contains(asset: &Asset, origin: &Location) -> bool {
274		let loc = Origin::get();
275		&loc == origin &&
276			matches!(asset, Asset { id: AssetId(asset_loc), fun: Fungible(_a) }
277			if asset_loc.starts_with(&Prefix::get()))
278	}
279}
280
281type AssetsFrom<T> = AssetPrefixFrom<T, T>;
282
283// This asset can be added to AH as Asset and reserved transfer between Penpal and AH
284pub const RESERVABLE_ASSET_ID: u32 = 1;
285// This asset can be added to AH as ForeignAsset and teleported between Penpal and AH
286pub const TELEPORTABLE_ASSET_ID: u32 = 2;
287
288pub const ASSETS_PALLET_ID: u8 = 50;
289pub const ASSET_HUB_ID: u32 = 1000;
290
291pub const USDT_ASSET_ID: u128 = 1984;
292
293parameter_types! {
294	/// The location that this chain recognizes as the Relay network's Asset Hub.
295	pub SystemAssetHubLocation: Location = Location::new(1, [Parachain(ASSET_HUB_ID)]);
296	// the Relay Chain's Asset Hub's Assets pallet index
297	pub SystemAssetHubAssetsPalletLocation: Location =
298		Location::new(1, [Parachain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID)]);
299	pub AssetsPalletLocation: Location =
300		Location::new(0, [PalletInstance(ASSETS_PALLET_ID)]);
301	pub CheckingAccount: AccountId = PolkadotXcm::check_account();
302	pub LocalTeleportableToAssetHub: Location = Location::new(
303		0,
304		[PalletInstance(ASSETS_PALLET_ID), GeneralIndex(TELEPORTABLE_ASSET_ID.into())]
305	);
306	pub LocalReservableFromAssetHub: Location = Location::new(
307		1,
308		[Parachain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID), GeneralIndex(RESERVABLE_ASSET_ID.into())]
309	);
310	pub UsdtFromAssetHub: Location = Location::new(
311		1,
312		[Parachain(ASSET_HUB_ID), PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ASSET_ID)],
313	);
314
315	/// The Penpal runtime is utilized for testing with various environment setups.
316	/// This storage item provides the opportunity to customize testing scenarios
317	/// by configuring the trusted asset from the `SystemAssetHub`.
318	///
319	/// By default, it is configured as a `SystemAssetHubLocation` and can be modified using `System::set_storage`.
320	pub storage CustomizableAssetFromSystemAssetHub: Location = SystemAssetHubLocation::get();
321
322	pub const NativeAssetId: AssetId = AssetId(Location::here());
323	pub const NativeAssetFilter: AssetFilter = Wild(AllOf { fun: WildFungible, id: NativeAssetId::get() });
324	pub AssetHubTrustedTeleporter: (AssetFilter, Location) = (NativeAssetFilter::get(), SystemAssetHubLocation::get());
325}
326
327/// Accepts asset with ID `AssetLocation` and is coming from `Origin` chain.
328pub struct AssetFromChain<AssetLocation, Origin>(PhantomData<(AssetLocation, Origin)>);
329impl<AssetLocation: Get<Location>, Origin: Get<Location>> ContainsPair<Asset, Location>
330	for AssetFromChain<AssetLocation, Origin>
331{
332	fn contains(asset: &Asset, origin: &Location) -> bool {
333		tracing::trace!(target: "xcm::contains", ?asset, ?origin, "AssetFromChain");
334		*origin == Origin::get() &&
335			matches!(asset.id.clone(), AssetId(id) if id == AssetLocation::get())
336	}
337}
338
339pub type TrustedReserves = (
340	NativeAsset,
341	ConcreteAssetFromSystem<RelayLocation>,
342	AssetsFrom<SystemAssetHubLocation>,
343	AssetPrefixFrom<CustomizableAssetFromSystemAssetHub, SystemAssetHubLocation>,
344);
345
346pub type TrustedTeleporters = (
347	AssetFromChain<LocalTeleportableToAssetHub, SystemAssetHubLocation>,
348	// This is used in the `IsTeleporter` configuration, meaning it accepts
349	// native tokens teleported from Asset Hub.
350	xcm_builder::Case<AssetHubTrustedTeleporter>,
351);
352
353/// Defines origin aliasing rules for this chain.
354///
355/// - Allow any origin to alias into a child sub-location (equivalent to DescendOrigin),
356/// - Allow AssetHub root to alias into anything,
357/// - Allow origins explicitly authorized by the alias target location.
358pub type TrustedAliasers = (
359	AliasChildLocation,
360	AliasOriginRootUsingFilter<SystemAssetHubLocation, Everything>,
361	AuthorizedAliasers<Runtime>,
362);
363
364pub type WaivedLocations = Equals<RootLocation>;
365/// `AssetId`/`Balance` converter for `TrustBackedAssets`.
366pub type TrustBackedAssetsConvertedConcreteId =
367	assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;
368
369/// Asset converter for pool assets.
370/// Used to convert assets in pools to the asset required for fee payment.
371/// The pool must be between the first asset and the one required for fee payment.
372/// This type allows paying fees with any asset in a pool with the asset required for fee payment.
373pub type PoolAssetsExchanger = SingleAssetExchangeAdapter<
374	crate::AssetConversion,
375	crate::NativeAndAssets,
376	(
377		TrustBackedAssetsAsLocation<
378			TrustBackedAssetsPalletLocation,
379			Balance,
380			xcm::latest::Location,
381		>,
382		ForeignAssetsConvertedConcreteId,
383	),
384	AccountId,
385>;
386
387pub struct XcmConfig;
388impl xcm_executor::Config for XcmConfig {
389	type RuntimeCall = RuntimeCall;
390	type XcmSender = XcmRouter;
391	type XcmEventEmitter = PolkadotXcm;
392	// How to withdraw and deposit an asset.
393	type AssetTransactor = AssetTransactors;
394	type OriginConverter = XcmOriginToTransactDispatchOrigin;
395	type IsReserve = TrustedReserves;
396	// no teleport trust established with other chains
397	type IsTeleporter = TrustedTeleporters;
398	type UniversalLocation = UniversalLocation;
399	type Barrier = Barrier;
400	type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
401	type Trader = (
402		UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>,
403		// Allow native asset to pay the execution fee
404		UsingComponents<WeightToFee, PenpalNativeCurrency, AccountId, Balances, ToAuthor<Runtime>>,
405		cumulus_primitives_utility::SwapFirstAssetTrader<
406			RelayLocation,
407			crate::AssetConversion,
408			WeightToFee,
409			crate::NativeAndAssets,
410			(
411				TrustBackedAssetsAsLocation<
412					TrustBackedAssetsPalletLocation,
413					Balance,
414					xcm::latest::Location,
415				>,
416				ForeignAssetsConvertedConcreteId,
417			),
418			ResolveAssetTo<StakingPot, crate::NativeAndAssets>,
419			AccountId,
420		>,
421	);
422	type ResponseHandler = PolkadotXcm;
423	type AssetTrap = PolkadotXcm;
424	type AssetClaims = PolkadotXcm;
425	type SubscriptionService = PolkadotXcm;
426	type PalletInstancesInfo = AllPalletsWithSystem;
427	type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
428	type AssetLocker = ();
429	type AssetExchanger = PoolAssetsExchanger;
430	type FeeManager = XcmFeeManagerFromComponents<
431		WaivedLocations,
432		SendXcmFeeToAccount<Self::AssetTransactor, TreasuryAccount>,
433	>;
434	type MessageExporter = ();
435	type UniversalAliases = Nothing;
436	type CallDispatcher = RuntimeCall;
437	type SafeCallFilter = Everything;
438	type Aliasers = TrustedAliasers;
439	type TransactionalProcessor = FrameTransactionalProcessor;
440	type HrmpNewChannelOpenRequestHandler = ();
441	type HrmpChannelAcceptedHandler = ();
442	type HrmpChannelClosingHandler = ();
443	type XcmRecorder = PolkadotXcm;
444}
445
446/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance.
447pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger =
448	AssetFeeAsExistentialDepositMultiplier<
449		Runtime,
450		WeightToFee,
451		pallet_assets::BalanceToAssetBalance<Balances, Runtime, ConvertInto, ForeignAssetsInstance>,
452		ForeignAssetsInstance,
453	>;
454
455/// Converts a local signed origin into an XCM location. Forms the basis for local origins
456/// sending/executing XCMs.
457pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
458
459pub type PriceForParentDelivery =
460	ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, ParachainSystem>;
461
462/// The means for routing XCM messages which are not for local execution into the right message
463/// queues.
464pub type XcmRouter = WithUniqueTopic<(
465	// Two routers - use UMP to communicate with the relay chain:
466	cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm, PriceForParentDelivery>,
467	// ..and XCMP to communicate with the sibling chains.
468	XcmpQueue,
469)>;
470
471parameter_types! {
472	pub const DepositPerItem: Balance = deposit(1, 0);
473	pub const DepositPerByte: Balance = deposit(0, 1);
474	pub const AuthorizeAliasHoldReason: RuntimeHoldReason = RuntimeHoldReason::PolkadotXcm(pallet_xcm::HoldReason::AuthorizeAlias);
475}
476
477impl pallet_xcm::Config for Runtime {
478	type RuntimeEvent = RuntimeEvent;
479	type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
480	type XcmRouter = XcmRouter;
481	type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
482	type XcmExecuteFilter = Everything;
483	type XcmExecutor = XcmExecutor<XcmConfig>;
484	type XcmTeleportFilter = Everything;
485	type XcmReserveTransferFilter = Everything;
486	type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
487	type UniversalLocation = UniversalLocation;
488	type RuntimeOrigin = RuntimeOrigin;
489	type RuntimeCall = RuntimeCall;
490
491	const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
492	// ^ Override for AdvertisedXcmVersion default
493	type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
494	type Currency = Balances;
495	type CurrencyMatcher = ();
496	type TrustedLockers = ();
497	type SovereignAccountOf = LocationToAccountId;
498	type MaxLockers = ConstU32<8>;
499	type WeightInfo = pallet_xcm::TestWeightInfo;
500	type AdminOrigin = EnsureRoot<AccountId>;
501	type MaxRemoteLockConsumers = ConstU32<0>;
502	type RemoteLockConsumerIdentifier = ();
503	// xcm_executor::Config::Aliasers also uses pallet_xcm::AuthorizedAliasers.
504	type AuthorizedAliasConsideration = HoldConsideration<
505		AccountId,
506		Balances,
507		AuthorizeAliasHoldReason,
508		LinearStoragePrice<DepositPerItem, DepositPerByte, Balance>,
509	>;
510}
511
512impl cumulus_pallet_xcm::Config for Runtime {
513	type RuntimeEvent = RuntimeEvent;
514	type XcmExecutor = XcmExecutor<XcmConfig>;
515}
516
517/// Simple conversion of `u32` into an `AssetId` for use in benchmarking.
518pub struct XcmBenchmarkHelper;
519#[cfg(feature = "runtime-benchmarks")]
520impl pallet_assets::BenchmarkHelper<ForeignAssetsAssetId> for XcmBenchmarkHelper {
521	fn create_asset_id_parameter(id: u32) -> ForeignAssetsAssetId {
522		Location::new(1, [Parachain(id)])
523	}
524}