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