Skip to main content

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