coretime_rococo_runtime/
lib.rs

1// Copyright (C) Parity Technologies (UK) Ltd.
2// SPDX-License-Identifier: Apache-2.0
3
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// 	http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16#![cfg_attr(not(feature = "std"), no_std)]
17// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
18#![recursion_limit = "256"]
19
20// Make the WASM binary available.
21#[cfg(feature = "std")]
22include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
23
24/// Provides the `WASM_BINARY` build with `fast-runtime` feature enabled.
25///
26/// This is for example useful for local test chains.
27#[cfg(feature = "std")]
28pub mod fast_runtime_binary {
29	include!(concat!(env!("OUT_DIR"), "/fast_runtime_binary.rs"));
30}
31
32mod coretime;
33mod genesis_config_presets;
34mod weights;
35pub mod xcm_config;
36
37extern crate alloc;
38
39use alloc::{vec, vec::Vec};
40use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
41use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
42use cumulus_primitives_core::{AggregateMessageOrigin, ClaimQueueOffset, CoreSelector, ParaId};
43use frame_support::{
44	construct_runtime, derive_impl,
45	dispatch::DispatchClass,
46	genesis_builder_helper::{build_state, get_preset},
47	parameter_types,
48	traits::{
49		ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter, TransformOrigin,
50	},
51	weights::{ConstantMultiplier, Weight, WeightToFee as _},
52	PalletId,
53};
54use frame_system::{
55	limits::{BlockLength, BlockWeights},
56	EnsureRoot,
57};
58use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
59use parachains_common::{
60	impls::DealWithFees,
61	message_queue::{NarrowOriginToSibling, ParaIdToSibling},
62	AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature,
63	AVERAGE_ON_INITIALIZE_RATIO, NORMAL_DISPATCH_RATIO,
64};
65use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
66use sp_api::impl_runtime_apis;
67use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
68#[cfg(any(feature = "std", test))]
69pub use sp_runtime::BuildStorage;
70use sp_runtime::{
71	generic, impl_opaque_keys,
72	traits::{BlakeTwo256, Block as BlockT, BlockNumberProvider},
73	transaction_validity::{TransactionSource, TransactionValidity},
74	ApplyExtrinsicResult, DispatchError, MultiAddress, Perbill, RuntimeDebug,
75};
76#[cfg(feature = "std")]
77use sp_version::NativeVersion;
78use sp_version::RuntimeVersion;
79use testnet_parachains_constants::rococo::{consensus::*, currency::*, fee::WeightToFee, time::*};
80use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
81use xcm::{prelude::*, Version as XcmVersion};
82use xcm_config::{
83	FellowshipLocation, GovernanceLocation, RocRelayLocation, XcmOriginToTransactDispatchOrigin,
84};
85use xcm_runtime_apis::{
86	dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
87	fees::Error as XcmPaymentApiError,
88};
89
90/// The address format for describing accounts.
91pub type Address = MultiAddress<AccountId, ()>;
92
93/// Block type as expected by this runtime.
94pub type Block = generic::Block<Header, UncheckedExtrinsic>;
95
96/// A Block signed with a Justification
97pub type SignedBlock = generic::SignedBlock<Block>;
98
99/// BlockId type as expected by this runtime.
100pub type BlockId = generic::BlockId<Block>;
101
102/// The TransactionExtension to the basic transaction logic.
103pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim<
104	Runtime,
105	(
106		frame_system::CheckNonZeroSender<Runtime>,
107		frame_system::CheckSpecVersion<Runtime>,
108		frame_system::CheckTxVersion<Runtime>,
109		frame_system::CheckGenesis<Runtime>,
110		frame_system::CheckEra<Runtime>,
111		frame_system::CheckNonce<Runtime>,
112		frame_system::CheckWeight<Runtime>,
113		pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
114		frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
115	),
116>;
117
118/// Unchecked extrinsic type as expected by this runtime.
119pub type UncheckedExtrinsic =
120	generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
121
122/// Migrations to apply on runtime upgrade.
123pub type Migrations = (
124	pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
125	cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
126	cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
127	pallet_broker::migration::MigrateV0ToV1<Runtime>,
128	pallet_broker::migration::MigrateV1ToV2<Runtime>,
129	pallet_broker::migration::MigrateV2ToV3<Runtime>,
130	pallet_broker::migration::MigrateV3ToV4<Runtime, BrokerMigrationV4BlockConversion>,
131	pallet_session::migrations::v1::MigrateV0ToV1<
132		Runtime,
133		pallet_session::migrations::v1::InitOffenceSeverity<Runtime>,
134	>,
135	// permanent
136	pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
137	cumulus_pallet_aura_ext::migration::MigrateV0ToV1<Runtime>,
138);
139
140/// Executive: handles dispatch to the various modules.
141pub type Executive = frame_executive::Executive<
142	Runtime,
143	Block,
144	frame_system::ChainContext<Runtime>,
145	Runtime,
146	AllPalletsWithSystem,
147	Migrations,
148>;
149
150impl_opaque_keys! {
151	pub struct SessionKeys {
152		pub aura: Aura,
153	}
154}
155
156#[sp_version::runtime_version]
157pub const VERSION: RuntimeVersion = RuntimeVersion {
158	spec_name: alloc::borrow::Cow::Borrowed("coretime-rococo"),
159	impl_name: alloc::borrow::Cow::Borrowed("coretime-rococo"),
160	authoring_version: 1,
161	spec_version: 1_018_001,
162	impl_version: 0,
163	apis: RUNTIME_API_VERSIONS,
164	transaction_version: 2,
165	system_version: 1,
166};
167
168/// The version information used to identify this runtime when compiled natively.
169#[cfg(feature = "std")]
170pub fn native_version() -> NativeVersion {
171	NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
172}
173
174parameter_types! {
175	pub const Version: RuntimeVersion = VERSION;
176	pub RuntimeBlockLength: BlockLength =
177		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
178	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
179		.base_block(BlockExecutionWeight::get())
180		.for_class(DispatchClass::all(), |weights| {
181			weights.base_extrinsic = ExtrinsicBaseWeight::get();
182		})
183		.for_class(DispatchClass::Normal, |weights| {
184			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
185		})
186		.for_class(DispatchClass::Operational, |weights| {
187			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
188			// Operational transactions have some extra reserved space, so that they
189			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
190			weights.reserved = Some(
191				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
192			);
193		})
194		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
195		.build_or_panic();
196	pub const SS58Prefix: u8 = 42;
197}
198
199// Configure FRAME pallets to include in runtime.
200#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)]
201impl frame_system::Config for Runtime {
202	/// The identifier used to distinguish between accounts.
203	type AccountId = AccountId;
204	/// The nonce type for storing how many extrinsics an account has signed.
205	type Nonce = Nonce;
206	/// The type for hashing blocks and tries.
207	type Hash = Hash;
208	/// The block type.
209	type Block = Block;
210	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
211	type BlockHashCount = BlockHashCount;
212	/// Runtime version.
213	type Version = Version;
214	/// The data to be stored in an account.
215	type AccountData = pallet_balances::AccountData<Balance>;
216	/// The weight of database operations that the runtime can invoke.
217	type DbWeight = RocksDbWeight;
218	/// Weight information for the extrinsics of this pallet.
219	type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
220	/// Weight information for the extensions of this pallet.
221	type ExtensionsWeightInfo = weights::frame_system_extensions::WeightInfo<Runtime>;
222	/// Block & extrinsics weights: base values and limits.
223	type BlockWeights = RuntimeBlockWeights;
224	/// The maximum length of a block (in bytes).
225	type BlockLength = RuntimeBlockLength;
226	type SS58Prefix = SS58Prefix;
227	/// The action to take on a Runtime Upgrade
228	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
229	type MaxConsumers = ConstU32<16>;
230}
231
232impl cumulus_pallet_weight_reclaim::Config for Runtime {
233	type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo<Runtime>;
234}
235
236impl pallet_timestamp::Config for Runtime {
237	/// A timestamp: milliseconds since the unix epoch.
238	type Moment = u64;
239	type OnTimestampSet = Aura;
240	type MinimumPeriod = ConstU64<0>;
241	type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
242}
243
244impl pallet_authorship::Config for Runtime {
245	type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
246	type EventHandler = (CollatorSelection,);
247}
248
249parameter_types! {
250	pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
251}
252
253impl pallet_balances::Config for Runtime {
254	type Balance = Balance;
255	type DustRemoval = ();
256	type RuntimeEvent = RuntimeEvent;
257	type ExistentialDeposit = ExistentialDeposit;
258	type AccountStore = System;
259	type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
260	type MaxLocks = ConstU32<50>;
261	type MaxReserves = ConstU32<50>;
262	type ReserveIdentifier = [u8; 8];
263	type RuntimeHoldReason = RuntimeHoldReason;
264	type RuntimeFreezeReason = RuntimeFreezeReason;
265	type FreezeIdentifier = ();
266	type MaxFreezes = ConstU32<0>;
267	type DoneSlashHandler = ();
268}
269
270parameter_types! {
271	/// Relay Chain `TransactionByteFee` / 10
272	pub const TransactionByteFee: Balance = MILLICENTS;
273}
274
275impl pallet_transaction_payment::Config for Runtime {
276	type RuntimeEvent = RuntimeEvent;
277	type OnChargeTransaction =
278		pallet_transaction_payment::FungibleAdapter<Balances, DealWithFees<Runtime>>;
279	type OperationalFeeMultiplier = ConstU8<5>;
280	type WeightToFee = WeightToFee;
281	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
282	type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
283	type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
284}
285
286parameter_types! {
287	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
288	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
289	pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
290}
291
292impl cumulus_pallet_parachain_system::Config for Runtime {
293	type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
294	type RuntimeEvent = RuntimeEvent;
295	type OnSystemEvent = ();
296	type SelfParaId = parachain_info::Pallet<Runtime>;
297	type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
298	type OutboundXcmpMessageSource = XcmpQueue;
299	type ReservedDmpWeight = ReservedDmpWeight;
300	type XcmpMessageHandler = XcmpQueue;
301	type ReservedXcmpWeight = ReservedXcmpWeight;
302	type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
303	type ConsensusHook = ConsensusHook;
304	type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector<Runtime>;
305}
306
307type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
308	Runtime,
309	RELAY_CHAIN_SLOT_DURATION_MILLIS,
310	BLOCK_PROCESSING_VELOCITY,
311	UNINCLUDED_SEGMENT_CAPACITY,
312>;
313
314parameter_types! {
315	pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
316}
317
318impl pallet_message_queue::Config for Runtime {
319	type RuntimeEvent = RuntimeEvent;
320	type WeightInfo = weights::pallet_message_queue::WeightInfo<Runtime>;
321	#[cfg(feature = "runtime-benchmarks")]
322	type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<
323		cumulus_primitives_core::AggregateMessageOrigin,
324	>;
325	#[cfg(not(feature = "runtime-benchmarks"))]
326	type MessageProcessor = xcm_builder::ProcessXcmMessage<
327		AggregateMessageOrigin,
328		xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
329		RuntimeCall,
330	>;
331	type Size = u32;
332	// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin:
333	type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
334	type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
335	type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>;
336	type MaxStale = sp_core::ConstU32<8>;
337	type ServiceWeight = MessageQueueServiceWeight;
338	type IdleMaxServiceWeight = MessageQueueServiceWeight;
339}
340
341impl parachain_info::Config for Runtime {}
342
343impl cumulus_pallet_aura_ext::Config for Runtime {}
344
345parameter_types! {
346	/// Fellows pluralistic body.
347	pub const FellowsBodyId: BodyId = BodyId::Technical;
348}
349
350/// Privileged origin that represents Root or Fellows pluralistic body.
351pub type RootOrFellows = EitherOfDiverse<
352	EnsureRoot<AccountId>,
353	EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
354>;
355
356parameter_types! {
357	/// The asset ID for the asset that we use to pay for message delivery fees.
358	pub FeeAssetId: AssetId = AssetId(RocRelayLocation::get());
359	/// The base fee for the message delivery fees.
360	pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3);
361}
362
363pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
364	FeeAssetId,
365	BaseDeliveryFee,
366	TransactionByteFee,
367	XcmpQueue,
368>;
369
370impl cumulus_pallet_xcmp_queue::Config for Runtime {
371	type RuntimeEvent = RuntimeEvent;
372	type ChannelInfo = ParachainSystem;
373	type VersionWrapper = PolkadotXcm;
374	type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
375	type MaxInboundSuspended = ConstU32<1_000>;
376	type MaxActiveOutboundChannels = ConstU32<128>;
377	// Most on-chain HRMP channels are configured to use 102400 bytes of max message size, so we
378	// need to set the page size larger than that until we reduce the channel size on-chain.
379	type MaxPageSize = ConstU32<{ 103 * 1024 }>;
380	type ControllerOrigin = RootOrFellows;
381	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
382	type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
383	type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
384}
385
386impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
387	// This must be the same as the `ChannelInfo` from the `Config`:
388	type ChannelList = ParachainSystem;
389}
390
391pub const PERIOD: u32 = 6 * HOURS;
392pub const OFFSET: u32 = 0;
393
394impl pallet_session::Config for Runtime {
395	type RuntimeEvent = RuntimeEvent;
396	type ValidatorId = <Self as frame_system::Config>::AccountId;
397	// we don't have stash and controller, thus we don't need the convert as well.
398	type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
399	type ShouldEndSession = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
400	type NextSessionRotation = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
401	type SessionManager = CollatorSelection;
402	// Essentially just Aura, but let's be pedantic.
403	type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
404	type Keys = SessionKeys;
405	type DisablingStrategy = ();
406	type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
407}
408
409impl pallet_aura::Config for Runtime {
410	type AuthorityId = AuraId;
411	type DisabledValidators = ();
412	type MaxAuthorities = ConstU32<100_000>;
413	type AllowMultipleBlocksPerSlot = ConstBool<true>;
414	type SlotDuration = ConstU64<SLOT_DURATION>;
415}
416
417parameter_types! {
418	pub const PotId: PalletId = PalletId(*b"PotStake");
419	pub const SessionLength: BlockNumber = 6 * HOURS;
420	/// StakingAdmin pluralistic body.
421	pub const StakingAdminBodyId: BodyId = BodyId::Defense;
422}
423
424/// We allow Root and the `StakingAdmin` to execute privileged collator selection operations.
425pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
426	EnsureRoot<AccountId>,
427	EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
428>;
429
430impl pallet_collator_selection::Config for Runtime {
431	type RuntimeEvent = RuntimeEvent;
432	type Currency = Balances;
433	type UpdateOrigin = CollatorSelectionUpdateOrigin;
434	type PotId = PotId;
435	type MaxCandidates = ConstU32<100>;
436	type MinEligibleCollators = ConstU32<4>;
437	type MaxInvulnerables = ConstU32<20>;
438	// should be a multiple of session or things will get inconsistent
439	type KickThreshold = ConstU32<PERIOD>;
440	type ValidatorId = <Self as frame_system::Config>::AccountId;
441	type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
442	type ValidatorRegistration = Session;
443	type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
444}
445
446parameter_types! {
447	/// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
448	pub const DepositBase: Balance = deposit(1, 88);
449	/// Additional storage item size of 32 bytes.
450	pub const DepositFactor: Balance = deposit(0, 32);
451}
452
453impl pallet_multisig::Config for Runtime {
454	type RuntimeEvent = RuntimeEvent;
455	type RuntimeCall = RuntimeCall;
456	type Currency = Balances;
457	type DepositBase = DepositBase;
458	type DepositFactor = DepositFactor;
459	type MaxSignatories = ConstU32<100>;
460	type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
461	type BlockNumberProvider = frame_system::Pallet<Runtime>;
462}
463
464/// The type used to represent the kinds of proxying allowed.
465#[derive(
466	Copy,
467	Clone,
468	Eq,
469	PartialEq,
470	Ord,
471	PartialOrd,
472	Encode,
473	Decode,
474	DecodeWithMemTracking,
475	RuntimeDebug,
476	MaxEncodedLen,
477	scale_info::TypeInfo,
478)]
479pub enum ProxyType {
480	/// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
481	Any,
482	/// Can execute any call that does not transfer funds or assets.
483	NonTransfer,
484	/// Proxy with the ability to reject time-delay proxy announcements.
485	CancelProxy,
486	/// Proxy for all Broker pallet calls.
487	Broker,
488	/// Proxy for renewing coretime.
489	CoretimeRenewer,
490	/// Proxy able to purchase on-demand coretime credits.
491	OnDemandPurchaser,
492	/// Collator selection proxy. Can execute calls related to collator selection mechanism.
493	Collator,
494}
495impl Default for ProxyType {
496	fn default() -> Self {
497		Self::Any
498	}
499}
500
501impl InstanceFilter<RuntimeCall> for ProxyType {
502	fn filter(&self, c: &RuntimeCall) -> bool {
503		match self {
504			ProxyType::Any => true,
505			ProxyType::NonTransfer => !matches!(
506				c,
507				RuntimeCall::Balances { .. } |
508				// `purchase`, `renew`, `transfer` and `purchase_credit` are pretty self explanatory.
509				RuntimeCall::Broker(pallet_broker::Call::purchase { .. }) |
510				RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
511				RuntimeCall::Broker(pallet_broker::Call::transfer { .. }) |
512				RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
513				// `pool` doesn't transfer, but it defines the account to be paid for contributions
514				RuntimeCall::Broker(pallet_broker::Call::pool { .. }) |
515				// `assign` is essentially a transfer of a region NFT
516				RuntimeCall::Broker(pallet_broker::Call::assign { .. })
517			),
518			ProxyType::CancelProxy => matches!(
519				c,
520				RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
521					RuntimeCall::Utility { .. } |
522					RuntimeCall::Multisig { .. }
523			),
524			ProxyType::Broker => {
525				matches!(
526					c,
527					RuntimeCall::Broker { .. } |
528						RuntimeCall::Utility { .. } |
529						RuntimeCall::Multisig { .. }
530				)
531			},
532			ProxyType::CoretimeRenewer => {
533				matches!(
534					c,
535					RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
536						RuntimeCall::Utility { .. } |
537						RuntimeCall::Multisig { .. }
538				)
539			},
540			ProxyType::OnDemandPurchaser => {
541				matches!(
542					c,
543					RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
544						RuntimeCall::Utility { .. } |
545						RuntimeCall::Multisig { .. }
546				)
547			},
548			ProxyType::Collator => matches!(
549				c,
550				RuntimeCall::CollatorSelection { .. } |
551					RuntimeCall::Utility { .. } |
552					RuntimeCall::Multisig { .. }
553			),
554		}
555	}
556
557	fn is_superset(&self, o: &Self) -> bool {
558		match (self, o) {
559			(x, y) if x == y => true,
560			(ProxyType::Any, _) => true,
561			(_, ProxyType::Any) => false,
562			(ProxyType::Broker, ProxyType::CoretimeRenewer) => true,
563			(ProxyType::Broker, ProxyType::OnDemandPurchaser) => true,
564			(ProxyType::NonTransfer, ProxyType::Collator) => true,
565			_ => false,
566		}
567	}
568}
569
570parameter_types! {
571	// One storage item; key size 32, value size 8; .
572	pub const ProxyDepositBase: Balance = deposit(1, 40);
573	// Additional storage item size of 33 bytes.
574	pub const ProxyDepositFactor: Balance = deposit(0, 33);
575	pub const MaxProxies: u16 = 32;
576	// One storage item; key size 32, value size 16
577	pub const AnnouncementDepositBase: Balance = deposit(1, 48);
578	pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
579	pub const MaxPending: u16 = 32;
580}
581
582impl pallet_proxy::Config for Runtime {
583	type RuntimeEvent = RuntimeEvent;
584	type RuntimeCall = RuntimeCall;
585	type Currency = Balances;
586	type ProxyType = ProxyType;
587	type ProxyDepositBase = ProxyDepositBase;
588	type ProxyDepositFactor = ProxyDepositFactor;
589	type MaxProxies = MaxProxies;
590	type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
591	type MaxPending = MaxPending;
592	type CallHasher = BlakeTwo256;
593	type AnnouncementDepositBase = AnnouncementDepositBase;
594	type AnnouncementDepositFactor = AnnouncementDepositFactor;
595	type BlockNumberProvider = frame_system::Pallet<Runtime>;
596}
597
598impl pallet_utility::Config for Runtime {
599	type RuntimeEvent = RuntimeEvent;
600	type RuntimeCall = RuntimeCall;
601	type PalletsOrigin = OriginCaller;
602	type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
603}
604
605impl pallet_sudo::Config for Runtime {
606	type RuntimeCall = RuntimeCall;
607	type RuntimeEvent = RuntimeEvent;
608	type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
609}
610
611pub struct BrokerMigrationV4BlockConversion;
612
613impl pallet_broker::migration::v4::BlockToRelayHeightConversion<Runtime>
614	for BrokerMigrationV4BlockConversion
615{
616	fn convert_block_number_to_relay_height(input_block_number: u32) -> u32 {
617		let relay_height = pallet_broker::RCBlockNumberProviderOf::<
618			<Runtime as pallet_broker::Config>::Coretime,
619		>::current_block_number();
620		let parachain_block_number = frame_system::Pallet::<Runtime>::block_number();
621		let offset = relay_height - parachain_block_number * 2;
622		offset + input_block_number * 2
623	}
624
625	fn convert_block_length_to_relay_length(input_block_length: u32) -> u32 {
626		input_block_length * 2
627	}
628}
629
630// Create the runtime by composing the FRAME pallets that were previously configured.
631construct_runtime!(
632	pub enum Runtime
633	{
634		// System support stuff.
635		System: frame_system = 0,
636		ParachainSystem: cumulus_pallet_parachain_system = 1,
637		Timestamp: pallet_timestamp = 3,
638		ParachainInfo: parachain_info = 4,
639		WeightReclaim: cumulus_pallet_weight_reclaim = 5,
640
641		// Monetary stuff.
642		Balances: pallet_balances = 10,
643		TransactionPayment: pallet_transaction_payment = 11,
644
645		// Collator support. The order of these 5 are important and shall not change.
646		Authorship: pallet_authorship = 20,
647		CollatorSelection: pallet_collator_selection = 21,
648		Session: pallet_session = 22,
649		Aura: pallet_aura = 23,
650		AuraExt: cumulus_pallet_aura_ext = 24,
651
652		// XCM & related
653		XcmpQueue: cumulus_pallet_xcmp_queue = 30,
654		PolkadotXcm: pallet_xcm = 31,
655		CumulusXcm: cumulus_pallet_xcm = 32,
656		MessageQueue: pallet_message_queue = 34,
657
658		// Handy utilities.
659		Utility: pallet_utility = 40,
660		Multisig: pallet_multisig = 41,
661		Proxy: pallet_proxy = 42,
662
663		// The main stage.
664		Broker: pallet_broker = 50,
665
666		// Sudo
667		Sudo: pallet_sudo = 100,
668	}
669);
670
671#[cfg(feature = "runtime-benchmarks")]
672mod benches {
673	frame_benchmarking::define_benchmarks!(
674		[frame_system, SystemBench::<Runtime>]
675		[cumulus_pallet_parachain_system, ParachainSystem]
676		[pallet_timestamp, Timestamp]
677		[pallet_balances, Balances]
678		[pallet_broker, Broker]
679		[pallet_collator_selection, CollatorSelection]
680		[pallet_session, SessionBench::<Runtime>]
681		[cumulus_pallet_xcmp_queue, XcmpQueue]
682		[pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
683		[pallet_message_queue, MessageQueue]
684		[pallet_multisig, Multisig]
685		[pallet_proxy, Proxy]
686		[pallet_utility, Utility]
687		// NOTE: Make sure you point to the individual modules below.
688		[pallet_xcm_benchmarks::fungible, XcmBalances]
689		[pallet_xcm_benchmarks::generic, XcmGeneric]
690		[cumulus_pallet_weight_reclaim, WeightReclaim]
691	);
692}
693
694impl_runtime_apis! {
695	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
696		fn slot_duration() -> sp_consensus_aura::SlotDuration {
697			sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
698		}
699
700		fn authorities() -> Vec<AuraId> {
701			pallet_aura::Authorities::<Runtime>::get().into_inner()
702		}
703	}
704
705	impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
706		fn can_build_upon(
707			included_hash: <Block as BlockT>::Hash,
708			slot: cumulus_primitives_aura::Slot,
709		) -> bool {
710			ConsensusHook::can_build_upon(included_hash, slot)
711		}
712	}
713
714	impl sp_api::Core<Block> for Runtime {
715		fn version() -> RuntimeVersion {
716			VERSION
717		}
718
719		fn execute_block(block: Block) {
720			Executive::execute_block(block)
721		}
722
723		fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
724			Executive::initialize_block(header)
725		}
726	}
727
728	impl sp_api::Metadata<Block> for Runtime {
729		fn metadata() -> OpaqueMetadata {
730			OpaqueMetadata::new(Runtime::metadata().into())
731		}
732
733		fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
734			Runtime::metadata_at_version(version)
735		}
736
737		fn metadata_versions() -> alloc::vec::Vec<u32> {
738			Runtime::metadata_versions()
739		}
740	}
741
742	impl sp_block_builder::BlockBuilder<Block> for Runtime {
743		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
744			Executive::apply_extrinsic(extrinsic)
745		}
746
747		fn finalize_block() -> <Block as BlockT>::Header {
748			Executive::finalize_block()
749		}
750
751		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
752			data.create_extrinsics()
753		}
754
755		fn check_inherents(
756			block: Block,
757			data: sp_inherents::InherentData,
758		) -> sp_inherents::CheckInherentsResult {
759			data.check_extrinsics(&block)
760		}
761	}
762
763	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
764		fn validate_transaction(
765			source: TransactionSource,
766			tx: <Block as BlockT>::Extrinsic,
767			block_hash: <Block as BlockT>::Hash,
768		) -> TransactionValidity {
769			Executive::validate_transaction(source, tx, block_hash)
770		}
771	}
772
773	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
774		fn offchain_worker(header: &<Block as BlockT>::Header) {
775			Executive::offchain_worker(header)
776		}
777	}
778
779	impl sp_session::SessionKeys<Block> for Runtime {
780		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
781			SessionKeys::generate(seed)
782		}
783
784		fn decode_session_keys(
785			encoded: Vec<u8>,
786		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
787			SessionKeys::decode_into_raw_public_keys(&encoded)
788		}
789	}
790
791	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
792		fn account_nonce(account: AccountId) -> Nonce {
793			System::account_nonce(account)
794		}
795	}
796
797	impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
798		fn sale_price() -> Result<Balance, DispatchError> {
799			Broker::current_price()
800		}
801	}
802
803	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
804		fn query_info(
805			uxt: <Block as BlockT>::Extrinsic,
806			len: u32,
807		) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
808			TransactionPayment::query_info(uxt, len)
809		}
810		fn query_fee_details(
811			uxt: <Block as BlockT>::Extrinsic,
812			len: u32,
813		) -> pallet_transaction_payment::FeeDetails<Balance> {
814			TransactionPayment::query_fee_details(uxt, len)
815		}
816		fn query_weight_to_fee(weight: Weight) -> Balance {
817			TransactionPayment::weight_to_fee(weight)
818		}
819		fn query_length_to_fee(length: u32) -> Balance {
820			TransactionPayment::length_to_fee(length)
821		}
822	}
823
824	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
825		for Runtime
826	{
827		fn query_call_info(
828			call: RuntimeCall,
829			len: u32,
830		) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
831			TransactionPayment::query_call_info(call, len)
832		}
833		fn query_call_fee_details(
834			call: RuntimeCall,
835			len: u32,
836		) -> pallet_transaction_payment::FeeDetails<Balance> {
837			TransactionPayment::query_call_fee_details(call, len)
838		}
839		fn query_weight_to_fee(weight: Weight) -> Balance {
840			TransactionPayment::weight_to_fee(weight)
841		}
842		fn query_length_to_fee(length: u32) -> Balance {
843			TransactionPayment::length_to_fee(length)
844		}
845	}
846
847	impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
848		fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
849			let acceptable_assets = vec![AssetId(xcm_config::RocRelayLocation::get())];
850			PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
851		}
852
853		fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
854			let latest_asset_id: Result<AssetId, ()> = asset.clone().try_into();
855			match latest_asset_id {
856				Ok(asset_id) if asset_id.0 == xcm_config::RocRelayLocation::get() => {
857					// for native token
858					Ok(WeightToFee::weight_to_fee(&weight))
859				},
860				Ok(asset_id) => {
861					log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - unhandled asset_id: {asset_id:?}!");
862					Err(XcmPaymentApiError::AssetNotFound)
863				},
864				Err(_) => {
865					log::trace!(target: "xcm::xcm_runtime_apis", "query_weight_to_asset_fee - failed to convert asset: {asset:?}!");
866					Err(XcmPaymentApiError::VersionedConversionFailed)
867				}
868			}
869		}
870
871		fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
872			PolkadotXcm::query_xcm_weight(message)
873		}
874
875		fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>) -> Result<VersionedAssets, XcmPaymentApiError> {
876			PolkadotXcm::query_delivery_fees(destination, message)
877		}
878	}
879
880	impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
881		fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
882			PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
883		}
884
885		fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
886			PolkadotXcm::dry_run_xcm::<Runtime, xcm_config::XcmRouter, RuntimeCall, xcm_config::XcmConfig>(origin_location, xcm)
887		}
888	}
889
890	impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
891		fn convert_location(location: VersionedLocation) -> Result<
892			AccountId,
893			xcm_runtime_apis::conversions::Error
894		> {
895			xcm_runtime_apis::conversions::LocationToAccountHelper::<
896				AccountId,
897				xcm_config::LocationToAccountId,
898			>::convert_location(location)
899		}
900	}
901
902	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
903		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
904			ParachainSystem::collect_collation_info(header)
905		}
906	}
907
908	impl cumulus_primitives_core::GetCoreSelectorApi<Block> for Runtime {
909		fn core_selector() -> (CoreSelector, ClaimQueueOffset) {
910			ParachainSystem::core_selector()
911		}
912	}
913
914	#[cfg(feature = "try-runtime")]
915	impl frame_try_runtime::TryRuntime<Block> for Runtime {
916		fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
917			let weight = Executive::try_runtime_upgrade(checks).unwrap();
918			(weight, RuntimeBlockWeights::get().max_block)
919		}
920
921		fn execute_block(
922			block: Block,
923			state_root_check: bool,
924			signature_check: bool,
925			select: frame_try_runtime::TryStateSelect,
926		) -> Weight {
927			// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
928			// have a backtrace here.
929			Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
930		}
931	}
932
933	#[cfg(feature = "runtime-benchmarks")]
934	impl frame_benchmarking::Benchmark<Block> for Runtime {
935		fn benchmark_metadata(extra: bool) -> (
936			Vec<frame_benchmarking::BenchmarkList>,
937			Vec<frame_support::traits::StorageInfo>,
938		) {
939			use frame_benchmarking::BenchmarkList;
940			use frame_support::traits::StorageInfoTrait;
941			use frame_system_benchmarking::Pallet as SystemBench;
942			use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
943			use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
944
945			// This is defined once again in dispatch_benchmark, because list_benchmarks!
946			// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
947			// are referenced in that call.
948			type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
949			type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
950
951			let mut list = Vec::<BenchmarkList>::new();
952			list_benchmarks!(list, extra);
953
954			let storage_info = AllPalletsWithSystem::storage_info();
955			(list, storage_info)
956		}
957
958		#[allow(non_local_definitions)]
959		fn dispatch_benchmark(
960			config: frame_benchmarking::BenchmarkConfig
961		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
962			use frame_benchmarking::{BenchmarkBatch, BenchmarkError};
963			use sp_storage::TrackedStorageKey;
964
965			use frame_system_benchmarking::Pallet as SystemBench;
966			impl frame_system_benchmarking::Config for Runtime {
967				fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> Result<(), BenchmarkError> {
968					ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
969					Ok(())
970				}
971
972				fn verify_set_code() {
973					System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
974				}
975			}
976
977			use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
978			impl cumulus_pallet_session_benchmarking::Config for Runtime {}
979
980			use xcm::latest::prelude::*;
981			use xcm_config::RocRelayLocation;
982
983			use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
984			impl pallet_xcm::benchmarking::Config for Runtime {
985				type DeliveryHelper = (
986					cumulus_primitives_utility::ToParentDeliveryHelper<
987						xcm_config::XcmConfig,
988						ExistentialDepositAsset,
989						xcm_config::PriceForParentDelivery,
990					>,
991					polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
992						xcm_config::XcmConfig,
993						ExistentialDepositAsset,
994						PriceForSiblingParachainDelivery,
995						RandomParaId,
996						ParachainSystem,
997					>
998				);
999
1000				fn reachable_dest() -> Option<Location> {
1001					Some(Parent.into())
1002				}
1003
1004				fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
1005					// Relay/native token can be teleported between AH and Relay.
1006					Some((
1007						Asset {
1008							fun: Fungible(ExistentialDeposit::get()),
1009							id: AssetId(Parent.into())
1010						},
1011						Parent.into(),
1012					))
1013				}
1014
1015				fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
1016					// Coretime chain can reserve transfer regions to some random parachain.
1017
1018					// Properties of a mock region:
1019					let core = 0;
1020					let begin = 0;
1021					let end = 42;
1022
1023					let region_id = pallet_broker::Pallet::<Runtime>::issue(core, begin, pallet_broker::CoreMask::complete(), end, None, None);
1024					Some((
1025						Asset {
1026							fun: NonFungible(Index(region_id.into())),
1027							id: AssetId(xcm_config::BrokerPalletLocation::get())
1028						},
1029						ParentThen(Parachain(RandomParaId::get().into()).into()).into(),
1030					))
1031				}
1032
1033				fn get_asset() -> Asset {
1034					Asset {
1035						id: AssetId(Location::parent()),
1036						fun: Fungible(ExistentialDeposit::get()),
1037					}
1038				}
1039			}
1040
1041			parameter_types! {
1042				pub ExistentialDepositAsset: Option<Asset> = Some((
1043					RocRelayLocation::get(),
1044					ExistentialDeposit::get()
1045				).into());
1046				pub const RandomParaId: ParaId = ParaId::new(43211234);
1047			}
1048
1049			impl pallet_xcm_benchmarks::Config for Runtime {
1050				type XcmConfig = xcm_config::XcmConfig;
1051				type DeliveryHelper = (
1052					cumulus_primitives_utility::ToParentDeliveryHelper<
1053						xcm_config::XcmConfig,
1054						ExistentialDepositAsset,
1055						xcm_config::PriceForParentDelivery,
1056					>,
1057					polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1058						xcm_config::XcmConfig,
1059						ExistentialDepositAsset,
1060						PriceForSiblingParachainDelivery,
1061						RandomParaId,
1062						ParachainSystem,
1063					>
1064				);
1065				type AccountIdConverter = xcm_config::LocationToAccountId;
1066				fn valid_destination() -> Result<Location, BenchmarkError> {
1067					Ok(RocRelayLocation::get())
1068				}
1069				fn worst_case_holding(_depositable_count: u32) -> Assets {
1070					// just concrete assets according to relay chain.
1071					let assets: Vec<Asset> = vec![
1072						Asset {
1073							id: AssetId(RocRelayLocation::get()),
1074							fun: Fungible(1_000_000 * UNITS),
1075						}
1076					];
1077					assets.into()
1078				}
1079			}
1080
1081			parameter_types! {
1082				pub const TrustedTeleporter: Option<(Location, Asset)> = Some((
1083					RocRelayLocation::get(),
1084					Asset { fun: Fungible(UNITS), id: AssetId(RocRelayLocation::get()) },
1085				));
1086				pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
1087				pub const TrustedReserve: Option<(Location, Asset)> = None;
1088			}
1089
1090			impl pallet_xcm_benchmarks::fungible::Config for Runtime {
1091				type TransactAsset = Balances;
1092
1093				type CheckedAccount = CheckedAccount;
1094				type TrustedTeleporter = TrustedTeleporter;
1095				type TrustedReserve = TrustedReserve;
1096
1097				fn get_asset() -> Asset {
1098					Asset {
1099						id: AssetId(RocRelayLocation::get()),
1100						fun: Fungible(UNITS),
1101					}
1102				}
1103			}
1104
1105			impl pallet_xcm_benchmarks::generic::Config for Runtime {
1106				type RuntimeCall = RuntimeCall;
1107				type TransactAsset = Balances;
1108
1109				fn worst_case_response() -> (u64, Response) {
1110					(0u64, Response::Version(Default::default()))
1111				}
1112
1113				fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
1114					Err(BenchmarkError::Skip)
1115				}
1116
1117				fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
1118					Err(BenchmarkError::Skip)
1119				}
1120
1121				fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
1122					Ok((RocRelayLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
1123				}
1124
1125				fn subscribe_origin() -> Result<Location, BenchmarkError> {
1126					Ok(RocRelayLocation::get())
1127				}
1128
1129				fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
1130					let origin = RocRelayLocation::get();
1131					let assets: Assets = (AssetId(RocRelayLocation::get()), 1_000 * UNITS).into();
1132					let ticket = Location { parents: 0, interior: Here };
1133					Ok((origin, ticket, assets))
1134				}
1135
1136				fn fee_asset() -> Result<Asset, BenchmarkError> {
1137					Ok(Asset {
1138						id: AssetId(RocRelayLocation::get()),
1139						fun: Fungible(1_000_000 * UNITS),
1140					})
1141				}
1142
1143				fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
1144					Err(BenchmarkError::Skip)
1145				}
1146
1147				fn export_message_origin_and_destination(
1148				) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
1149					Err(BenchmarkError::Skip)
1150				}
1151
1152				fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
1153					Err(BenchmarkError::Skip)
1154				}
1155			}
1156
1157			type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1158			type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1159
1160			use frame_support::traits::WhitelistedStorageKeys;
1161			let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
1162
1163			let mut batches = Vec::<BenchmarkBatch>::new();
1164			let params = (&config, &whitelist);
1165			add_benchmarks!(params, batches);
1166
1167			Ok(batches)
1168		}
1169	}
1170
1171	impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
1172		fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
1173			build_state::<RuntimeGenesisConfig>(config)
1174		}
1175
1176		fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
1177			get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
1178		}
1179
1180		fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
1181			genesis_config_presets::preset_names()
1182		}
1183	}
1184
1185	impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
1186		fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1187			PolkadotXcm::is_trusted_reserve(asset, location)
1188		}
1189		fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1190			PolkadotXcm::is_trusted_teleporter(asset, location)
1191		}
1192	}
1193}
1194
1195cumulus_pallet_parachain_system::register_validate_block! {
1196	Runtime = Runtime,
1197	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
1198}