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