referrerpolicy=no-referrer-when-downgrade

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},
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::AuthorizeCall<Runtime>,
107		frame_system::CheckNonZeroSender<Runtime>,
108		frame_system::CheckSpecVersion<Runtime>,
109		frame_system::CheckTxVersion<Runtime>,
110		frame_system::CheckGenesis<Runtime>,
111		frame_system::CheckEra<Runtime>,
112		frame_system::CheckNonce<Runtime>,
113		frame_system::CheckWeight<Runtime>,
114		pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
115		frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
116	),
117>;
118
119/// Unchecked extrinsic type as expected by this runtime.
120pub type UncheckedExtrinsic =
121	generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
122
123/// Migrations to apply on runtime upgrade.
124pub type Migrations = (
125	pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
126	cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
127	cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
128	pallet_broker::migration::MigrateV0ToV1<Runtime>,
129	pallet_broker::migration::MigrateV1ToV2<Runtime>,
130	pallet_broker::migration::MigrateV2ToV3<Runtime>,
131	pallet_broker::migration::MigrateV3ToV4<Runtime, BrokerMigrationV4BlockConversion>,
132	pallet_session::migrations::v1::MigrateV0ToV1<
133		Runtime,
134		pallet_session::migrations::v1::InitOffenceSeverity<Runtime>,
135	>,
136	// permanent
137	pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
138	cumulus_pallet_aura_ext::migration::MigrateV0ToV1<Runtime>,
139);
140
141/// Executive: handles dispatch to the various modules.
142pub type Executive = frame_executive::Executive<
143	Runtime,
144	Block,
145	frame_system::ChainContext<Runtime>,
146	Runtime,
147	AllPalletsWithSystem,
148	Migrations,
149>;
150
151impl_opaque_keys! {
152	pub struct SessionKeys {
153		pub aura: Aura,
154	}
155}
156
157#[sp_version::runtime_version]
158pub const VERSION: RuntimeVersion = RuntimeVersion {
159	spec_name: alloc::borrow::Cow::Borrowed("coretime-rococo"),
160	impl_name: alloc::borrow::Cow::Borrowed("coretime-rococo"),
161	authoring_version: 1,
162	spec_version: 1_018_001,
163	impl_version: 0,
164	apis: RUNTIME_API_VERSIONS,
165	transaction_version: 2,
166	system_version: 1,
167};
168
169/// The version information used to identify this runtime when compiled natively.
170#[cfg(feature = "std")]
171pub fn native_version() -> NativeVersion {
172	NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
173}
174
175parameter_types! {
176	pub const Version: RuntimeVersion = VERSION;
177	pub RuntimeBlockLength: BlockLength =
178		BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
179	pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
180		.base_block(BlockExecutionWeight::get())
181		.for_class(DispatchClass::all(), |weights| {
182			weights.base_extrinsic = ExtrinsicBaseWeight::get();
183		})
184		.for_class(DispatchClass::Normal, |weights| {
185			weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
186		})
187		.for_class(DispatchClass::Operational, |weights| {
188			weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
189			// Operational transactions have some extra reserved space, so that they
190			// are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
191			weights.reserved = Some(
192				MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
193			);
194		})
195		.avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
196		.build_or_panic();
197	pub const SS58Prefix: u8 = 42;
198}
199
200// Configure FRAME pallets to include in runtime.
201#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)]
202impl frame_system::Config for Runtime {
203	/// The identifier used to distinguish between accounts.
204	type AccountId = AccountId;
205	/// The nonce type for storing how many extrinsics an account has signed.
206	type Nonce = Nonce;
207	/// The type for hashing blocks and tries.
208	type Hash = Hash;
209	/// The block type.
210	type Block = Block;
211	/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
212	type BlockHashCount = BlockHashCount;
213	/// Runtime version.
214	type Version = Version;
215	/// The data to be stored in an account.
216	type AccountData = pallet_balances::AccountData<Balance>;
217	/// The weight of database operations that the runtime can invoke.
218	type DbWeight = RocksDbWeight;
219	/// Weight information for the extrinsics of this pallet.
220	type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
221	/// Weight information for the extensions of this pallet.
222	type ExtensionsWeightInfo = weights::frame_system_extensions::WeightInfo<Runtime>;
223	/// Block & extrinsics weights: base values and limits.
224	type BlockWeights = RuntimeBlockWeights;
225	/// The maximum length of a block (in bytes).
226	type BlockLength = RuntimeBlockLength;
227	type SS58Prefix = SS58Prefix;
228	/// The action to take on a Runtime Upgrade
229	type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
230	type MaxConsumers = ConstU32<16>;
231}
232
233impl cumulus_pallet_weight_reclaim::Config for Runtime {
234	type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo<Runtime>;
235}
236
237impl pallet_timestamp::Config for Runtime {
238	/// A timestamp: milliseconds since the unix epoch.
239	type Moment = u64;
240	type OnTimestampSet = Aura;
241	type MinimumPeriod = ConstU64<0>;
242	type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
243}
244
245impl pallet_authorship::Config for Runtime {
246	type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
247	type EventHandler = (CollatorSelection,);
248}
249
250parameter_types! {
251	pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
252}
253
254impl pallet_balances::Config for Runtime {
255	type Balance = Balance;
256	type DustRemoval = ();
257	type RuntimeEvent = RuntimeEvent;
258	type ExistentialDeposit = ExistentialDeposit;
259	type AccountStore = System;
260	type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
261	type MaxLocks = ConstU32<50>;
262	type MaxReserves = ConstU32<50>;
263	type ReserveIdentifier = [u8; 8];
264	type RuntimeHoldReason = RuntimeHoldReason;
265	type RuntimeFreezeReason = RuntimeFreezeReason;
266	type FreezeIdentifier = ();
267	type MaxFreezes = ConstU32<0>;
268	type DoneSlashHandler = ();
269}
270
271parameter_types! {
272	/// Relay Chain `TransactionByteFee` / 10
273	pub const TransactionByteFee: Balance = MILLICENTS;
274}
275
276impl pallet_transaction_payment::Config for Runtime {
277	type RuntimeEvent = RuntimeEvent;
278	type OnChargeTransaction =
279		pallet_transaction_payment::FungibleAdapter<Balances, DealWithFees<Runtime>>;
280	type OperationalFeeMultiplier = ConstU8<5>;
281	type WeightToFee = WeightToFee;
282	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
283	type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
284	type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
285}
286
287parameter_types! {
288	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
289	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
290	pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
291}
292
293impl cumulus_pallet_parachain_system::Config for Runtime {
294	type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
295	type RuntimeEvent = RuntimeEvent;
296	type OnSystemEvent = ();
297	type SelfParaId = parachain_info::Pallet<Runtime>;
298	type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
299	type OutboundXcmpMessageSource = XcmpQueue;
300	type ReservedDmpWeight = ReservedDmpWeight;
301	type XcmpMessageHandler = XcmpQueue;
302	type ReservedXcmpWeight = ReservedXcmpWeight;
303	type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
304	type ConsensusHook = ConsensusHook;
305	type SelectCore = cumulus_pallet_parachain_system::DefaultCoreSelector<Runtime>;
306	type RelayParentOffset = ConstU32<0>;
307}
308
309type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
310	Runtime,
311	RELAY_CHAIN_SLOT_DURATION_MILLIS,
312	BLOCK_PROCESSING_VELOCITY,
313	UNINCLUDED_SEGMENT_CAPACITY,
314>;
315
316parameter_types! {
317	pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
318}
319
320impl pallet_message_queue::Config for Runtime {
321	type RuntimeEvent = RuntimeEvent;
322	type WeightInfo = weights::pallet_message_queue::WeightInfo<Runtime>;
323	#[cfg(feature = "runtime-benchmarks")]
324	type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<
325		cumulus_primitives_core::AggregateMessageOrigin,
326	>;
327	#[cfg(not(feature = "runtime-benchmarks"))]
328	type MessageProcessor = xcm_builder::ProcessXcmMessage<
329		AggregateMessageOrigin,
330		xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
331		RuntimeCall,
332	>;
333	type Size = u32;
334	// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)` origin:
335	type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
336	type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
337	type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>;
338	type MaxStale = sp_core::ConstU32<8>;
339	type ServiceWeight = MessageQueueServiceWeight;
340	type IdleMaxServiceWeight = MessageQueueServiceWeight;
341}
342
343impl parachain_info::Config for Runtime {}
344
345impl cumulus_pallet_aura_ext::Config for Runtime {}
346
347parameter_types! {
348	/// Fellows pluralistic body.
349	pub const FellowsBodyId: BodyId = BodyId::Technical;
350}
351
352/// Privileged origin that represents Root or Fellows pluralistic body.
353pub type RootOrFellows = EitherOfDiverse<
354	EnsureRoot<AccountId>,
355	EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
356>;
357
358parameter_types! {
359	/// The asset ID for the asset that we use to pay for message delivery fees.
360	pub FeeAssetId: AssetId = AssetId(RocRelayLocation::get());
361	/// The base fee for the message delivery fees.
362	pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3);
363}
364
365pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
366	FeeAssetId,
367	BaseDeliveryFee,
368	TransactionByteFee,
369	XcmpQueue,
370>;
371
372impl cumulus_pallet_xcmp_queue::Config for Runtime {
373	type RuntimeEvent = RuntimeEvent;
374	type ChannelInfo = ParachainSystem;
375	type VersionWrapper = PolkadotXcm;
376	type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
377	type MaxInboundSuspended = ConstU32<1_000>;
378	type MaxActiveOutboundChannels = ConstU32<128>;
379	// Most on-chain HRMP channels are configured to use 102400 bytes of max message size, so we
380	// need to set the page size larger than that until we reduce the channel size on-chain.
381	type MaxPageSize = ConstU32<{ 103 * 1024 }>;
382	type ControllerOrigin = RootOrFellows;
383	type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
384	type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
385	type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
386}
387
388impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
389	// This must be the same as the `ChannelInfo` from the `Config`:
390	type ChannelList = ParachainSystem;
391}
392
393pub const PERIOD: u32 = 6 * HOURS;
394pub const OFFSET: u32 = 0;
395
396impl pallet_session::Config for Runtime {
397	type RuntimeEvent = RuntimeEvent;
398	type ValidatorId = <Self as frame_system::Config>::AccountId;
399	// we don't have stash and controller, thus we don't need the convert as well.
400	type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
401	type ShouldEndSession = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
402	type NextSessionRotation = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
403	type SessionManager = CollatorSelection;
404	// Essentially just Aura, but let's be pedantic.
405	type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
406	type Keys = SessionKeys;
407	type DisablingStrategy = ();
408	type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
409	type Currency = Balances;
410	type KeyDeposit = ();
411}
412
413impl pallet_aura::Config for Runtime {
414	type AuthorityId = AuraId;
415	type DisabledValidators = ();
416	type MaxAuthorities = ConstU32<100_000>;
417	type AllowMultipleBlocksPerSlot = ConstBool<true>;
418	type SlotDuration = ConstU64<SLOT_DURATION>;
419}
420
421parameter_types! {
422	pub const PotId: PalletId = PalletId(*b"PotStake");
423	pub const SessionLength: BlockNumber = 6 * HOURS;
424	/// StakingAdmin pluralistic body.
425	pub const StakingAdminBodyId: BodyId = BodyId::Defense;
426}
427
428/// We allow Root and the `StakingAdmin` to execute privileged collator selection operations.
429pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
430	EnsureRoot<AccountId>,
431	EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
432>;
433
434impl pallet_collator_selection::Config for Runtime {
435	type RuntimeEvent = RuntimeEvent;
436	type Currency = Balances;
437	type UpdateOrigin = CollatorSelectionUpdateOrigin;
438	type PotId = PotId;
439	type MaxCandidates = ConstU32<100>;
440	type MinEligibleCollators = ConstU32<4>;
441	type MaxInvulnerables = ConstU32<20>;
442	// should be a multiple of session or things will get inconsistent
443	type KickThreshold = ConstU32<PERIOD>;
444	type ValidatorId = <Self as frame_system::Config>::AccountId;
445	type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
446	type ValidatorRegistration = Session;
447	type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
448}
449
450parameter_types! {
451	/// One storage item; key size is 32; value is size 4+4+16+32 bytes = 56 bytes.
452	pub const DepositBase: Balance = deposit(1, 88);
453	/// Additional storage item size of 32 bytes.
454	pub const DepositFactor: Balance = deposit(0, 32);
455}
456
457impl pallet_multisig::Config for Runtime {
458	type RuntimeEvent = RuntimeEvent;
459	type RuntimeCall = RuntimeCall;
460	type Currency = Balances;
461	type DepositBase = DepositBase;
462	type DepositFactor = DepositFactor;
463	type MaxSignatories = ConstU32<100>;
464	type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
465	type BlockNumberProvider = frame_system::Pallet<Runtime>;
466}
467
468/// The type used to represent the kinds of proxying allowed.
469#[derive(
470	Copy,
471	Clone,
472	Eq,
473	PartialEq,
474	Ord,
475	PartialOrd,
476	Encode,
477	Decode,
478	DecodeWithMemTracking,
479	RuntimeDebug,
480	MaxEncodedLen,
481	scale_info::TypeInfo,
482)]
483pub enum ProxyType {
484	/// Fully permissioned proxy. Can execute any call on behalf of _proxied_.
485	Any,
486	/// Can execute any call that does not transfer funds or assets.
487	NonTransfer,
488	/// Proxy with the ability to reject time-delay proxy announcements.
489	CancelProxy,
490	/// Proxy for all Broker pallet calls.
491	Broker,
492	/// Proxy for renewing coretime.
493	CoretimeRenewer,
494	/// Proxy able to purchase on-demand coretime credits.
495	OnDemandPurchaser,
496	/// Collator selection proxy. Can execute calls related to collator selection mechanism.
497	Collator,
498}
499impl Default for ProxyType {
500	fn default() -> Self {
501		Self::Any
502	}
503}
504
505impl InstanceFilter<RuntimeCall> for ProxyType {
506	fn filter(&self, c: &RuntimeCall) -> bool {
507		match self {
508			ProxyType::Any => true,
509			ProxyType::NonTransfer => !matches!(
510				c,
511				RuntimeCall::Balances { .. } |
512				// `purchase`, `renew`, `transfer` and `purchase_credit` are pretty self explanatory.
513				RuntimeCall::Broker(pallet_broker::Call::purchase { .. }) |
514				RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
515				RuntimeCall::Broker(pallet_broker::Call::transfer { .. }) |
516				RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
517				// `pool` doesn't transfer, but it defines the account to be paid for contributions
518				RuntimeCall::Broker(pallet_broker::Call::pool { .. }) |
519				// `assign` is essentially a transfer of a region NFT
520				RuntimeCall::Broker(pallet_broker::Call::assign { .. })
521			),
522			ProxyType::CancelProxy => matches!(
523				c,
524				RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
525					RuntimeCall::Utility { .. } |
526					RuntimeCall::Multisig { .. }
527			),
528			ProxyType::Broker => {
529				matches!(
530					c,
531					RuntimeCall::Broker { .. } |
532						RuntimeCall::Utility { .. } |
533						RuntimeCall::Multisig { .. }
534				)
535			},
536			ProxyType::CoretimeRenewer => {
537				matches!(
538					c,
539					RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
540						RuntimeCall::Utility { .. } |
541						RuntimeCall::Multisig { .. }
542				)
543			},
544			ProxyType::OnDemandPurchaser => {
545				matches!(
546					c,
547					RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
548						RuntimeCall::Utility { .. } |
549						RuntimeCall::Multisig { .. }
550				)
551			},
552			ProxyType::Collator => matches!(
553				c,
554				RuntimeCall::CollatorSelection { .. } |
555					RuntimeCall::Utility { .. } |
556					RuntimeCall::Multisig { .. }
557			),
558		}
559	}
560
561	fn is_superset(&self, o: &Self) -> bool {
562		match (self, o) {
563			(x, y) if x == y => true,
564			(ProxyType::Any, _) => true,
565			(_, ProxyType::Any) => false,
566			(ProxyType::Broker, ProxyType::CoretimeRenewer) => true,
567			(ProxyType::Broker, ProxyType::OnDemandPurchaser) => true,
568			(ProxyType::NonTransfer, ProxyType::Collator) => true,
569			_ => false,
570		}
571	}
572}
573
574parameter_types! {
575	// One storage item; key size 32, value size 8; .
576	pub const ProxyDepositBase: Balance = deposit(1, 40);
577	// Additional storage item size of 33 bytes.
578	pub const ProxyDepositFactor: Balance = deposit(0, 33);
579	pub const MaxProxies: u16 = 32;
580	// One storage item; key size 32, value size 16
581	pub const AnnouncementDepositBase: Balance = deposit(1, 48);
582	pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
583	pub const MaxPending: u16 = 32;
584}
585
586impl pallet_proxy::Config for Runtime {
587	type RuntimeEvent = RuntimeEvent;
588	type RuntimeCall = RuntimeCall;
589	type Currency = Balances;
590	type ProxyType = ProxyType;
591	type ProxyDepositBase = ProxyDepositBase;
592	type ProxyDepositFactor = ProxyDepositFactor;
593	type MaxProxies = MaxProxies;
594	type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
595	type MaxPending = MaxPending;
596	type CallHasher = BlakeTwo256;
597	type AnnouncementDepositBase = AnnouncementDepositBase;
598	type AnnouncementDepositFactor = AnnouncementDepositFactor;
599	type BlockNumberProvider = frame_system::Pallet<Runtime>;
600}
601
602impl pallet_utility::Config for Runtime {
603	type RuntimeEvent = RuntimeEvent;
604	type RuntimeCall = RuntimeCall;
605	type PalletsOrigin = OriginCaller;
606	type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
607}
608
609impl pallet_sudo::Config for Runtime {
610	type RuntimeCall = RuntimeCall;
611	type RuntimeEvent = RuntimeEvent;
612	type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
613}
614
615pub struct BrokerMigrationV4BlockConversion;
616
617impl pallet_broker::migration::v4::BlockToRelayHeightConversion<Runtime>
618	for BrokerMigrationV4BlockConversion
619{
620	fn convert_block_number_to_relay_height(input_block_number: u32) -> u32 {
621		let relay_height = pallet_broker::RCBlockNumberProviderOf::<
622			<Runtime as pallet_broker::Config>::Coretime,
623		>::current_block_number();
624		let parachain_block_number = frame_system::Pallet::<Runtime>::block_number();
625		let offset = relay_height - parachain_block_number * 2;
626		offset + input_block_number * 2
627	}
628
629	fn convert_block_length_to_relay_length(input_block_length: u32) -> u32 {
630		input_block_length * 2
631	}
632}
633
634// Create the runtime by composing the FRAME pallets that were previously configured.
635construct_runtime!(
636	pub enum Runtime
637	{
638		// System support stuff.
639		System: frame_system = 0,
640		ParachainSystem: cumulus_pallet_parachain_system = 1,
641		Timestamp: pallet_timestamp = 3,
642		ParachainInfo: parachain_info = 4,
643		WeightReclaim: cumulus_pallet_weight_reclaim = 5,
644
645		// Monetary stuff.
646		Balances: pallet_balances = 10,
647		TransactionPayment: pallet_transaction_payment = 11,
648
649		// Collator support. The order of these 5 are important and shall not change.
650		Authorship: pallet_authorship = 20,
651		CollatorSelection: pallet_collator_selection = 21,
652		Session: pallet_session = 22,
653		Aura: pallet_aura = 23,
654		AuraExt: cumulus_pallet_aura_ext = 24,
655
656		// XCM & related
657		XcmpQueue: cumulus_pallet_xcmp_queue = 30,
658		PolkadotXcm: pallet_xcm = 31,
659		CumulusXcm: cumulus_pallet_xcm = 32,
660		MessageQueue: pallet_message_queue = 34,
661
662		// Handy utilities.
663		Utility: pallet_utility = 40,
664		Multisig: pallet_multisig = 41,
665		Proxy: pallet_proxy = 42,
666
667		// The main stage.
668		Broker: pallet_broker = 50,
669
670		// Sudo
671		Sudo: pallet_sudo = 100,
672	}
673);
674
675#[cfg(feature = "runtime-benchmarks")]
676mod benches {
677	frame_benchmarking::define_benchmarks!(
678		[frame_system, SystemBench::<Runtime>]
679		[cumulus_pallet_parachain_system, ParachainSystem]
680		[pallet_timestamp, Timestamp]
681		[pallet_balances, Balances]
682		[pallet_broker, Broker]
683		[pallet_collator_selection, CollatorSelection]
684		[pallet_session, SessionBench::<Runtime>]
685		[cumulus_pallet_xcmp_queue, XcmpQueue]
686		[pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
687		[pallet_message_queue, MessageQueue]
688		[pallet_multisig, Multisig]
689		[pallet_proxy, Proxy]
690		[pallet_utility, Utility]
691		// NOTE: Make sure you point to the individual modules below.
692		[pallet_xcm_benchmarks::fungible, XcmBalances]
693		[pallet_xcm_benchmarks::generic, XcmGeneric]
694		[cumulus_pallet_weight_reclaim, WeightReclaim]
695	);
696}
697
698impl_runtime_apis! {
699	impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
700		fn slot_duration() -> sp_consensus_aura::SlotDuration {
701			sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
702		}
703
704		fn authorities() -> Vec<AuraId> {
705			pallet_aura::Authorities::<Runtime>::get().into_inner()
706		}
707	}
708
709	impl cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
710		fn relay_parent_offset() -> u32 {
711			0
712		}
713	}
714
715	impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
716		fn can_build_upon(
717			included_hash: <Block as BlockT>::Hash,
718			slot: cumulus_primitives_aura::Slot,
719		) -> bool {
720			ConsensusHook::can_build_upon(included_hash, slot)
721		}
722	}
723
724	impl sp_api::Core<Block> for Runtime {
725		fn version() -> RuntimeVersion {
726			VERSION
727		}
728
729		fn execute_block(block: Block) {
730			Executive::execute_block(block)
731		}
732
733		fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
734			Executive::initialize_block(header)
735		}
736	}
737
738	impl sp_api::Metadata<Block> for Runtime {
739		fn metadata() -> OpaqueMetadata {
740			OpaqueMetadata::new(Runtime::metadata().into())
741		}
742
743		fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
744			Runtime::metadata_at_version(version)
745		}
746
747		fn metadata_versions() -> alloc::vec::Vec<u32> {
748			Runtime::metadata_versions()
749		}
750	}
751
752	impl sp_block_builder::BlockBuilder<Block> for Runtime {
753		fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
754			Executive::apply_extrinsic(extrinsic)
755		}
756
757		fn finalize_block() -> <Block as BlockT>::Header {
758			Executive::finalize_block()
759		}
760
761		fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
762			data.create_extrinsics()
763		}
764
765		fn check_inherents(
766			block: Block,
767			data: sp_inherents::InherentData,
768		) -> sp_inherents::CheckInherentsResult {
769			data.check_extrinsics(&block)
770		}
771	}
772
773	impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
774		fn validate_transaction(
775			source: TransactionSource,
776			tx: <Block as BlockT>::Extrinsic,
777			block_hash: <Block as BlockT>::Hash,
778		) -> TransactionValidity {
779			Executive::validate_transaction(source, tx, block_hash)
780		}
781	}
782
783	impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
784		fn offchain_worker(header: &<Block as BlockT>::Header) {
785			Executive::offchain_worker(header)
786		}
787	}
788
789	impl sp_session::SessionKeys<Block> for Runtime {
790		fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
791			SessionKeys::generate(seed)
792		}
793
794		fn decode_session_keys(
795			encoded: Vec<u8>,
796		) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
797			SessionKeys::decode_into_raw_public_keys(&encoded)
798		}
799	}
800
801	impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
802		fn account_nonce(account: AccountId) -> Nonce {
803			System::account_nonce(account)
804		}
805	}
806
807	impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
808		fn sale_price() -> Result<Balance, DispatchError> {
809			Broker::current_price()
810		}
811	}
812
813	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
814		fn query_info(
815			uxt: <Block as BlockT>::Extrinsic,
816			len: u32,
817		) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
818			TransactionPayment::query_info(uxt, len)
819		}
820		fn query_fee_details(
821			uxt: <Block as BlockT>::Extrinsic,
822			len: u32,
823		) -> pallet_transaction_payment::FeeDetails<Balance> {
824			TransactionPayment::query_fee_details(uxt, len)
825		}
826		fn query_weight_to_fee(weight: Weight) -> Balance {
827			TransactionPayment::weight_to_fee(weight)
828		}
829		fn query_length_to_fee(length: u32) -> Balance {
830			TransactionPayment::length_to_fee(length)
831		}
832	}
833
834	impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
835		for Runtime
836	{
837		fn query_call_info(
838			call: RuntimeCall,
839			len: u32,
840		) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
841			TransactionPayment::query_call_info(call, len)
842		}
843		fn query_call_fee_details(
844			call: RuntimeCall,
845			len: u32,
846		) -> pallet_transaction_payment::FeeDetails<Balance> {
847			TransactionPayment::query_call_fee_details(call, len)
848		}
849		fn query_weight_to_fee(weight: Weight) -> Balance {
850			TransactionPayment::weight_to_fee(weight)
851		}
852		fn query_length_to_fee(length: u32) -> Balance {
853			TransactionPayment::length_to_fee(length)
854		}
855	}
856
857	impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
858		fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
859			let acceptable_assets = vec![AssetId(xcm_config::RocRelayLocation::get())];
860			PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
861		}
862
863		fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
864			use crate::xcm_config::XcmConfig;
865
866			type Trader = <XcmConfig as xcm_executor::Config>::Trader;
867
868			PolkadotXcm::query_weight_to_asset_fee::<Trader>(weight, asset)
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 set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> {
1034					let native_location = Parent.into();
1035					let dest = Parent.into();
1036
1037					pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
1038						native_location,
1039						dest,
1040					)
1041				}
1042
1043				fn get_asset() -> Asset {
1044					Asset {
1045						id: AssetId(Location::parent()),
1046						fun: Fungible(ExistentialDeposit::get()),
1047					}
1048				}
1049			}
1050
1051			parameter_types! {
1052				pub ExistentialDepositAsset: Option<Asset> = Some((
1053					RocRelayLocation::get(),
1054					ExistentialDeposit::get()
1055				).into());
1056				pub const RandomParaId: ParaId = ParaId::new(43211234);
1057			}
1058
1059			impl pallet_xcm_benchmarks::Config for Runtime {
1060				type XcmConfig = xcm_config::XcmConfig;
1061				type DeliveryHelper = (
1062					cumulus_primitives_utility::ToParentDeliveryHelper<
1063						xcm_config::XcmConfig,
1064						ExistentialDepositAsset,
1065						xcm_config::PriceForParentDelivery,
1066					>,
1067					polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1068						xcm_config::XcmConfig,
1069						ExistentialDepositAsset,
1070						PriceForSiblingParachainDelivery,
1071						RandomParaId,
1072						ParachainSystem,
1073					>
1074				);
1075				type AccountIdConverter = xcm_config::LocationToAccountId;
1076				fn valid_destination() -> Result<Location, BenchmarkError> {
1077					Ok(RocRelayLocation::get())
1078				}
1079				fn worst_case_holding(_depositable_count: u32) -> Assets {
1080					// just concrete assets according to relay chain.
1081					let assets: Vec<Asset> = vec![
1082						Asset {
1083							id: AssetId(RocRelayLocation::get()),
1084							fun: Fungible(1_000_000 * UNITS),
1085						}
1086					];
1087					assets.into()
1088				}
1089			}
1090
1091			parameter_types! {
1092				pub const TrustedTeleporter: Option<(Location, Asset)> = Some((
1093					RocRelayLocation::get(),
1094					Asset { fun: Fungible(UNITS), id: AssetId(RocRelayLocation::get()) },
1095				));
1096				pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
1097				pub const TrustedReserve: Option<(Location, Asset)> = None;
1098			}
1099
1100			impl pallet_xcm_benchmarks::fungible::Config for Runtime {
1101				type TransactAsset = Balances;
1102
1103				type CheckedAccount = CheckedAccount;
1104				type TrustedTeleporter = TrustedTeleporter;
1105				type TrustedReserve = TrustedReserve;
1106
1107				fn get_asset() -> Asset {
1108					Asset {
1109						id: AssetId(RocRelayLocation::get()),
1110						fun: Fungible(UNITS),
1111					}
1112				}
1113			}
1114
1115			impl pallet_xcm_benchmarks::generic::Config for Runtime {
1116				type RuntimeCall = RuntimeCall;
1117				type TransactAsset = Balances;
1118
1119				fn worst_case_response() -> (u64, Response) {
1120					(0u64, Response::Version(Default::default()))
1121				}
1122
1123				fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
1124					Err(BenchmarkError::Skip)
1125				}
1126
1127				fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
1128					Err(BenchmarkError::Skip)
1129				}
1130
1131				fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
1132					Ok((RocRelayLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
1133				}
1134
1135				fn subscribe_origin() -> Result<Location, BenchmarkError> {
1136					Ok(RocRelayLocation::get())
1137				}
1138
1139				fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
1140					let origin = RocRelayLocation::get();
1141					let assets: Assets = (AssetId(RocRelayLocation::get()), 1_000 * UNITS).into();
1142					let ticket = Location { parents: 0, interior: Here };
1143					Ok((origin, ticket, assets))
1144				}
1145
1146				fn worst_case_for_trader() -> Result<(Asset, WeightLimit), BenchmarkError> {
1147					Ok((Asset {
1148						id: AssetId(RocRelayLocation::get()),
1149						fun: Fungible(1_000_000 * UNITS),
1150					}, WeightLimit::Limited(Weight::from_parts(5000, 5000))))
1151				}
1152
1153				fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
1154					Err(BenchmarkError::Skip)
1155				}
1156
1157				fn export_message_origin_and_destination(
1158				) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
1159					Err(BenchmarkError::Skip)
1160				}
1161
1162				fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
1163					Err(BenchmarkError::Skip)
1164				}
1165			}
1166
1167			type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1168			type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1169
1170			use frame_support::traits::WhitelistedStorageKeys;
1171			let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
1172
1173			let mut batches = Vec::<BenchmarkBatch>::new();
1174			let params = (&config, &whitelist);
1175			add_benchmarks!(params, batches);
1176
1177			Ok(batches)
1178		}
1179	}
1180
1181	impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
1182		fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
1183			build_state::<RuntimeGenesisConfig>(config)
1184		}
1185
1186		fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
1187			get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
1188		}
1189
1190		fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
1191			genesis_config_presets::preset_names()
1192		}
1193	}
1194
1195	impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
1196		fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1197			PolkadotXcm::is_trusted_reserve(asset, location)
1198		}
1199		fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1200			PolkadotXcm::is_trusted_teleporter(asset, location)
1201		}
1202	}
1203
1204	impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
1205		fn parachain_id() -> ParaId {
1206			ParachainInfo::parachain_id()
1207		}
1208	}
1209}
1210
1211cumulus_pallet_parachain_system::register_validate_block! {
1212	Runtime = Runtime,
1213	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
1214}