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, 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, XcmConfig,
84	XcmOriginToTransactDispatchOrigin,
85};
86use xcm_runtime_apis::{
87	dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
88	fees::Error as XcmPaymentApiError,
89};
90
91/// The address format for describing accounts.
92pub type Address = MultiAddress<AccountId, ()>;
93
94/// Block type as expected by this runtime.
95pub type Block = generic::Block<Header, UncheckedExtrinsic>;
96
97/// A Block signed with a Justification
98pub type SignedBlock = generic::SignedBlock<Block>;
99
100/// BlockId type as expected by this runtime.
101pub type BlockId = generic::BlockId<Block>;
102
103/// The TransactionExtension to the basic transaction logic.
104pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim<
105	Runtime,
106	(
107		frame_system::AuthorizeCall<Runtime>,
108		frame_system::CheckNonZeroSender<Runtime>,
109		frame_system::CheckSpecVersion<Runtime>,
110		frame_system::CheckTxVersion<Runtime>,
111		frame_system::CheckGenesis<Runtime>,
112		frame_system::CheckEra<Runtime>,
113		frame_system::CheckNonce<Runtime>,
114		frame_system::CheckWeight<Runtime>,
115		pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
116		frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
117	),
118>;
119
120/// Unchecked extrinsic type as expected by this runtime.
121pub type UncheckedExtrinsic =
122	generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
123
124/// Migrations to apply on runtime upgrade.
125pub type Migrations = (
126	pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
127	cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
128	cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
129	pallet_broker::migration::MigrateV0ToV1<Runtime>,
130	pallet_broker::migration::MigrateV1ToV2<Runtime>,
131	pallet_broker::migration::MigrateV2ToV3<Runtime>,
132	pallet_broker::migration::MigrateV3ToV4<Runtime, BrokerMigrationV4BlockConversion>,
133	pallet_session::migrations::v1::MigrateV0ToV1<
134		Runtime,
135		pallet_session::migrations::v1::InitOffenceSeverity<Runtime>,
136	>,
137	// permanent
138	pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
139	cumulus_pallet_aura_ext::migration::MigrateV0ToV1<Runtime>,
140);
141
142/// Executive: handles dispatch to the various modules.
143pub type Executive = frame_executive::Executive<
144	Runtime,
145	Block,
146	frame_system::ChainContext<Runtime>,
147	Runtime,
148	AllPalletsWithSystem,
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_021_000,
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	type SingleBlockMigrations = Migrations;
232}
233
234impl cumulus_pallet_weight_reclaim::Config for Runtime {
235	type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo<Runtime>;
236}
237
238impl pallet_timestamp::Config for Runtime {
239	/// A timestamp: milliseconds since the unix epoch.
240	type Moment = u64;
241	type OnTimestampSet = Aura;
242	type MinimumPeriod = ConstU64<0>;
243	type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
244}
245
246impl pallet_authorship::Config for Runtime {
247	type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
248	type EventHandler = (CollatorSelection,);
249}
250
251parameter_types! {
252	pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
253}
254
255impl pallet_balances::Config for Runtime {
256	type Balance = Balance;
257	type DustRemoval = ();
258	type RuntimeEvent = RuntimeEvent;
259	type ExistentialDeposit = ExistentialDeposit;
260	type AccountStore = System;
261	type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
262	type MaxLocks = ConstU32<50>;
263	type MaxReserves = ConstU32<50>;
264	type ReserveIdentifier = [u8; 8];
265	type RuntimeHoldReason = RuntimeHoldReason;
266	type RuntimeFreezeReason = RuntimeFreezeReason;
267	type FreezeIdentifier = ();
268	type MaxFreezes = ConstU32<0>;
269	type DoneSlashHandler = ();
270}
271
272parameter_types! {
273	/// Relay Chain `TransactionByteFee` / 10
274	pub const TransactionByteFee: Balance = MILLICENTS;
275}
276
277impl pallet_transaction_payment::Config for Runtime {
278	type RuntimeEvent = RuntimeEvent;
279	type OnChargeTransaction =
280		pallet_transaction_payment::FungibleAdapter<Balances, DealWithFees<Runtime>>;
281	type OperationalFeeMultiplier = ConstU8<5>;
282	type WeightToFee = WeightToFee;
283	type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
284	type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
285	type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
286}
287
288parameter_types! {
289	pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
290	pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
291	pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
292}
293
294impl cumulus_pallet_parachain_system::Config for Runtime {
295	type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
296	type RuntimeEvent = RuntimeEvent;
297	type OnSystemEvent = ();
298	type SelfParaId = parachain_info::Pallet<Runtime>;
299	type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
300	type OutboundXcmpMessageSource = XcmpQueue;
301	type ReservedDmpWeight = ReservedDmpWeight;
302	type XcmpMessageHandler = XcmpQueue;
303	type ReservedXcmpWeight = ReservedXcmpWeight;
304	type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
305	type ConsensusHook = ConsensusHook;
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 as BlockT>::LazyBlock) {
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 as BlockT>::LazyBlock,
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			type Trader = <XcmConfig as xcm_executor::Config>::Trader;
865			PolkadotXcm::query_weight_to_asset_fee::<Trader>(weight, asset)
866		}
867
868		fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
869			PolkadotXcm::query_xcm_weight(message)
870		}
871
872		fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>, asset_id: VersionedAssetId) -> Result<VersionedAssets, XcmPaymentApiError> {
873			type AssetExchanger = <XcmConfig as xcm_executor::Config>::AssetExchanger;
874			PolkadotXcm::query_delivery_fees::<AssetExchanger>(destination, message, asset_id)
875		}
876	}
877
878	impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
879		fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
880			PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
881		}
882
883		fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
884			PolkadotXcm::dry_run_xcm::<xcm_config::XcmRouter>(origin_location, xcm)
885		}
886	}
887
888	impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
889		fn convert_location(location: VersionedLocation) -> Result<
890			AccountId,
891			xcm_runtime_apis::conversions::Error
892		> {
893			xcm_runtime_apis::conversions::LocationToAccountHelper::<
894				AccountId,
895				xcm_config::LocationToAccountId,
896			>::convert_location(location)
897		}
898	}
899
900	impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
901		fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
902			ParachainSystem::collect_collation_info(header)
903		}
904	}
905
906	#[cfg(feature = "try-runtime")]
907	impl frame_try_runtime::TryRuntime<Block> for Runtime {
908		fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
909			let weight = Executive::try_runtime_upgrade(checks).unwrap();
910			(weight, RuntimeBlockWeights::get().max_block)
911		}
912
913		fn execute_block(
914			block: <Block as BlockT>::LazyBlock,
915			state_root_check: bool,
916			signature_check: bool,
917			select: frame_try_runtime::TryStateSelect,
918		) -> Weight {
919			// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
920			// have a backtrace here.
921			Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
922		}
923	}
924
925	#[cfg(feature = "runtime-benchmarks")]
926	impl frame_benchmarking::Benchmark<Block> for Runtime {
927		fn benchmark_metadata(extra: bool) -> (
928			Vec<frame_benchmarking::BenchmarkList>,
929			Vec<frame_support::traits::StorageInfo>,
930		) {
931			use frame_benchmarking::BenchmarkList;
932			use frame_support::traits::StorageInfoTrait;
933			use frame_system_benchmarking::Pallet as SystemBench;
934			use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
935			use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
936
937			// This is defined once again in dispatch_benchmark, because list_benchmarks!
938			// and add_benchmarks! are macros exported by define_benchmarks! macros and those types
939			// are referenced in that call.
940			type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
941			type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
942
943			let mut list = Vec::<BenchmarkList>::new();
944			list_benchmarks!(list, extra);
945
946			let storage_info = AllPalletsWithSystem::storage_info();
947			(list, storage_info)
948		}
949
950		#[allow(non_local_definitions)]
951		fn dispatch_benchmark(
952			config: frame_benchmarking::BenchmarkConfig
953		) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
954			use frame_benchmarking::{BenchmarkBatch, BenchmarkError};
955			use sp_storage::TrackedStorageKey;
956
957			use frame_system_benchmarking::Pallet as SystemBench;
958			impl frame_system_benchmarking::Config for Runtime {
959				fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> Result<(), BenchmarkError> {
960					ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
961					Ok(())
962				}
963
964				fn verify_set_code() {
965					System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
966				}
967			}
968
969			use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
970			impl cumulus_pallet_session_benchmarking::Config for Runtime {}
971
972			use xcm::latest::prelude::*;
973			use xcm_config::RocRelayLocation;
974
975			use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
976			use testnet_parachains_constants::rococo::locations::{AssetHubParaId, AssetHubLocation};
977
978			parameter_types! {
979				pub ExistentialDepositAsset: Option<Asset> = Some((
980					RocRelayLocation::get(),
981					ExistentialDeposit::get()
982				).into());
983			}
984
985			impl pallet_xcm::benchmarking::Config for Runtime {
986				type DeliveryHelper =
987					polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
988						xcm_config::XcmConfig,
989						ExistentialDepositAsset,
990						PriceForSiblingParachainDelivery,
991						AssetHubParaId,
992						ParachainSystem,
993					>;
994
995				fn reachable_dest() -> Option<Location> {
996					Some(AssetHubLocation::get())
997				}
998
999				fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
1000					// Relay/native token can be teleported between AH and Relay.
1001					Some((
1002						Asset {
1003							fun: Fungible(ExistentialDeposit::get()),
1004							id: AssetId(RocRelayLocation::get())
1005						},
1006						AssetHubLocation::get(),
1007					))
1008				}
1009
1010				fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
1011					// Coretime chain can reserve transfer regions to some random parachain.
1012
1013					// Properties of a mock region:
1014					let core = 0;
1015					let begin = 0;
1016					let end = 42;
1017
1018					let region_id = pallet_broker::Pallet::<Runtime>::issue(core, begin, pallet_broker::CoreMask::complete(), end, None, None);
1019					Some((
1020						Asset {
1021							fun: NonFungible(Index(region_id.into())),
1022							id: AssetId(xcm_config::BrokerPalletLocation::get())
1023						},
1024						AssetHubLocation::get(),
1025					))
1026				}
1027
1028				fn set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> {
1029					let native_location = Parent.into();
1030					let dest = AssetHubLocation::get();
1031
1032					pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
1033						native_location,
1034						dest,
1035					)
1036				}
1037
1038				fn get_asset() -> Asset {
1039					Asset {
1040						id: AssetId(RocRelayLocation::get()),
1041						fun: Fungible(ExistentialDeposit::get()),
1042					}
1043				}
1044			}
1045
1046			impl pallet_xcm_benchmarks::Config for Runtime {
1047				type XcmConfig = xcm_config::XcmConfig;
1048				type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1049						xcm_config::XcmConfig,
1050						ExistentialDepositAsset,
1051						PriceForSiblingParachainDelivery,
1052						AssetHubParaId,
1053						ParachainSystem,
1054					>;
1055				type AccountIdConverter = xcm_config::LocationToAccountId;
1056				fn valid_destination() -> Result<Location, BenchmarkError> {
1057					Ok(AssetHubLocation::get())
1058				}
1059				fn worst_case_holding(_depositable_count: u32) -> Assets {
1060					// just concrete assets according to relay chain.
1061					let assets: Vec<Asset> = vec![
1062						Asset {
1063							id: AssetId(RocRelayLocation::get()),
1064							fun: Fungible(1_000_000 * UNITS),
1065						}
1066					];
1067					assets.into()
1068				}
1069			}
1070
1071			parameter_types! {
1072				pub TrustedTeleporter: Option<(Location, Asset)> = Some((
1073					AssetHubLocation::get(),
1074					Asset { fun: Fungible(UNITS), id: AssetId(RocRelayLocation::get()) },
1075				));
1076				pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
1077				pub const TrustedReserve: Option<(Location, Asset)> = None;
1078			}
1079
1080			impl pallet_xcm_benchmarks::fungible::Config for Runtime {
1081				type TransactAsset = Balances;
1082
1083				type CheckedAccount = CheckedAccount;
1084				type TrustedTeleporter = TrustedTeleporter;
1085				type TrustedReserve = TrustedReserve;
1086
1087				fn get_asset() -> Asset {
1088					Asset {
1089						id: AssetId(RocRelayLocation::get()),
1090						fun: Fungible(UNITS),
1091					}
1092				}
1093			}
1094
1095			impl pallet_xcm_benchmarks::generic::Config for Runtime {
1096				type RuntimeCall = RuntimeCall;
1097				type TransactAsset = Balances;
1098
1099				fn worst_case_response() -> (u64, Response) {
1100					(0u64, Response::Version(Default::default()))
1101				}
1102
1103				fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
1104					Err(BenchmarkError::Skip)
1105				}
1106
1107				fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
1108					Err(BenchmarkError::Skip)
1109				}
1110
1111				fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
1112					Ok((AssetHubLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
1113				}
1114
1115				fn subscribe_origin() -> Result<Location, BenchmarkError> {
1116					Ok(AssetHubLocation::get())
1117				}
1118
1119				fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
1120					let origin = AssetHubLocation::get();
1121					let assets: Assets = (AssetId(RocRelayLocation::get()), 1_000 * UNITS).into();
1122					let ticket = Location { parents: 0, interior: Here };
1123					Ok((origin, ticket, assets))
1124				}
1125
1126				fn worst_case_for_trader() -> Result<(Asset, WeightLimit), BenchmarkError> {
1127					Ok((Asset {
1128						id: AssetId(RocRelayLocation::get()),
1129						fun: Fungible(1_000_000 * UNITS),
1130					}, WeightLimit::Limited(Weight::from_parts(5000, 5000))))
1131				}
1132
1133				fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
1134					Err(BenchmarkError::Skip)
1135				}
1136
1137				fn export_message_origin_and_destination(
1138				) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
1139					Err(BenchmarkError::Skip)
1140				}
1141
1142				fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
1143					Err(BenchmarkError::Skip)
1144				}
1145			}
1146
1147			type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1148			type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1149
1150			use frame_support::traits::WhitelistedStorageKeys;
1151			let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
1152
1153			let mut batches = Vec::<BenchmarkBatch>::new();
1154			let params = (&config, &whitelist);
1155			add_benchmarks!(params, batches);
1156
1157			Ok(batches)
1158		}
1159	}
1160
1161	impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
1162		fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
1163			build_state::<RuntimeGenesisConfig>(config)
1164		}
1165
1166		fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
1167			get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
1168		}
1169
1170		fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
1171			genesis_config_presets::preset_names()
1172		}
1173	}
1174
1175	impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
1176		fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1177			PolkadotXcm::is_trusted_reserve(asset, location)
1178		}
1179		fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
1180			PolkadotXcm::is_trusted_teleporter(asset, location)
1181		}
1182	}
1183
1184	impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
1185		fn parachain_id() -> ParaId {
1186			ParachainInfo::parachain_id()
1187		}
1188	}
1189
1190	impl cumulus_primitives_core::TargetBlockRate<Block> for Runtime {
1191		fn target_block_rate() -> u32 {
1192			1
1193		}
1194	}
1195}
1196
1197cumulus_pallet_parachain_system::register_validate_block! {
1198	Runtime = Runtime,
1199	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
1200}