1#![cfg_attr(not(feature = "std"), no_std)]
17#![recursion_limit = "256"]
19
20#[cfg(feature = "std")]
22include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
23
24#[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, RelaychainDataProvider};
42use cumulus_primitives_core::{AggregateMessageOrigin, ParaId, VerifySchedulingSignature};
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},
73 transaction_validity::{TransactionSource, TransactionValidity},
74 ApplyExtrinsicResult, Debug, DispatchError, MultiAddress, MultiSignature, MultiSigner, Perbill,
75 Percent,
76};
77use sp_session::OpaqueGeneratedSessionKeys;
78use sp_version::RuntimeVersion;
79use testnet_parachains_constants::westend::{
80 accumulate_forward::*, consensus::*, currency::*, dap::*, fee::WeightToFee, time::*,
81};
82use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
83use xcm::{prelude::*, Version as XcmVersion};
84use xcm_config::{
85 FellowshipLocation, GovernanceLocation, TokenRelayLocation, XcmConfig,
86 XcmOriginToTransactDispatchOrigin,
87};
88use xcm_runtime_apis::{
89 dry_run::{CallDryRunEffects, Error as XcmDryRunApiError, XcmDryRunEffects},
90 fees::Error as XcmPaymentApiError,
91};
92
93pub type Address = MultiAddress<AccountId, ()>;
95
96pub type Block = generic::Block<Header, UncheckedExtrinsic>;
98
99pub type SignedBlock = generic::SignedBlock<Block>;
101
102pub type BlockId = generic::BlockId<Block>;
104
105pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim<
107 Runtime,
108 (
109 frame_system::AuthorizeCall<Runtime>,
110 frame_system::CheckNonZeroSender<Runtime>,
111 frame_system::CheckSpecVersion<Runtime>,
112 frame_system::CheckTxVersion<Runtime>,
113 frame_system::CheckGenesis<Runtime>,
114 frame_system::CheckEra<Runtime>,
115 frame_system::CheckNonce<Runtime>,
116 frame_system::CheckWeight<Runtime>,
117 pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
118 frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
119 ),
120>;
121
122pub type UncheckedExtrinsic =
124 generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
125
126pub type Migrations = (
128 pallet_broker::migration::MigrateV4ToV5<Runtime, BrokerFirstSaleRegion>,
129 pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
131 cumulus_pallet_aura_ext::migration::MigrateV0ToV1<Runtime>,
132 cumulus_pallet_parachain_system::migration::v3::Migration<Runtime>,
133 cumulus_pallet_parachain_system::migration::MigrateV3ToV4<Runtime>,
134);
135
136pub type Executive = frame_executive::Executive<
138 Runtime,
139 Block,
140 frame_system::ChainContext<Runtime>,
141 Runtime,
142 AllPalletsWithSystem,
143>;
144
145impl_opaque_keys! {
146 pub struct SessionKeys {
147 pub aura: Aura,
148 }
149}
150
151#[sp_version::runtime_version]
152pub const VERSION: RuntimeVersion = RuntimeVersion {
153 spec_name: alloc::borrow::Cow::Borrowed("coretime-westend"),
154 impl_name: alloc::borrow::Cow::Borrowed("coretime-westend"),
155 authoring_version: 1,
156 spec_version: 1_024_001,
157 impl_version: 0,
158 apis: RUNTIME_API_VERSIONS,
159 transaction_version: 2,
160 system_version: 1,
161};
162
163const RELAY_PARENT_OFFSET: u32 = 0;
164
165parameter_types! {
166 pub const Version: RuntimeVersion = VERSION;
167 pub RuntimeBlockLength: BlockLength = BlockLength::builder()
168 .max_length(5 * 1024 * 1024)
169 .modify_max_length_for_class(DispatchClass::Normal, |m| {
170 *m = NORMAL_DISPATCH_RATIO * *m
171 })
172 .build();
173 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
174 .base_block(BlockExecutionWeight::get())
175 .for_class(DispatchClass::all(), |weights| {
176 weights.base_extrinsic = ExtrinsicBaseWeight::get();
177 })
178 .for_class(DispatchClass::Normal, |weights| {
179 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
180 })
181 .for_class(DispatchClass::Operational, |weights| {
182 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
183 weights.reserved = Some(
186 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
187 );
188 })
189 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
190 .build_or_panic();
191 pub const SS58Prefix: u8 = 42;
192}
193
194#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig)]
196impl frame_system::Config for Runtime {
197 type AccountId = AccountId;
199 type Nonce = Nonce;
201 type Hash = Hash;
203 type Block = Block;
205 type BlockHashCount = BlockHashCount;
207 type Version = Version;
209 type AccountData = pallet_balances::AccountData<Balance>;
211 type DbWeight = RocksDbWeight;
213 type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
215 type ExtensionsWeightInfo = weights::frame_system_extensions::WeightInfo<Runtime>;
217 type BlockWeights = RuntimeBlockWeights;
219 type BlockLength = RuntimeBlockLength;
221 type SS58Prefix = SS58Prefix;
222 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
224 type MaxConsumers = ConstU32<16>;
225 type SingleBlockMigrations = Migrations;
226}
227
228impl cumulus_pallet_weight_reclaim::Config for Runtime {
229 type WeightInfo = weights::cumulus_pallet_weight_reclaim::WeightInfo<Runtime>;
230}
231
232impl pallet_timestamp::Config for Runtime {
233 type Moment = u64;
235 type OnTimestampSet = Aura;
236 type MinimumPeriod = ConstU64<0>;
237 type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
238}
239
240impl pallet_authorship::Config for Runtime {
241 type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
242 type EventHandler = (CollatorSelection,);
243}
244
245parameter_types! {
246 pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT;
247}
248
249impl pallet_balances::Config for Runtime {
250 type Balance = Balance;
251 type DustRemoval = AccumulateForward;
252 type RuntimeEvent = RuntimeEvent;
253 type ExistentialDeposit = ExistentialDeposit;
254 type AccountStore = System;
255 type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
256 type MaxLocks = ConstU32<50>;
257 type MaxReserves = ConstU32<50>;
258 type ReserveIdentifier = [u8; 8];
259 type RuntimeHoldReason = RuntimeHoldReason;
260 type RuntimeFreezeReason = RuntimeFreezeReason;
261 type FreezeIdentifier = ();
262 type MaxFreezes = ConstU32<0>;
263 type DoneSlashHandler = ();
264}
265
266parameter_types! {
267 pub const TransactionByteFee: Balance = MILLICENTS;
269 pub const AccumulateForwardFeePercent: Percent = Percent::from_percent(100);
271}
272
273pub type DealWithFeesAccumulate = pallet_accumulate_and_forward::DealWithFeesSplit<
274 Runtime,
275 AccumulateForwardFeePercent,
276 DealWithFees<Runtime>,
277>;
278
279impl pallet_transaction_payment::Config for Runtime {
280 type RuntimeEvent = RuntimeEvent;
281 type OnChargeTransaction =
282 pallet_transaction_payment::FungibleAdapter<Balances, DealWithFeesAccumulate>;
283 type OperationalFeeMultiplier = ConstU8<5>;
284 type WeightToFee = WeightToFee;
285 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
286 type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
287 type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
288}
289
290parameter_types! {
291 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
292 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
293 pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
294}
295
296impl cumulus_pallet_parachain_system::Config for Runtime {
297 type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
298 type RuntimeEvent = RuntimeEvent;
299 type OnSystemEvent = ();
300 type SelfParaId = parachain_info::Pallet<Runtime>;
301 type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
302 type OutboundXcmpMessageSource = XcmpQueue;
303 type ReservedDmpWeight = ReservedDmpWeight;
304 type XcmpMessageHandler = XcmpQueue;
305 type ReservedXcmpWeight = ReservedXcmpWeight;
306 type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
307 type ConsensusHook = ConsensusHook;
308 type RelayParentOffset = ConstU32<RELAY_PARENT_OFFSET>;
309 type SchedulingSignatureVerifier = ();
310}
311
312type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
313 Runtime,
314 RELAY_CHAIN_SLOT_DURATION_MILLIS,
315 BLOCK_PROCESSING_VELOCITY,
316 UNINCLUDED_SEGMENT_CAPACITY,
317>;
318
319parameter_types! {
320 pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
321}
322
323impl pallet_message_queue::Config for Runtime {
324 type RuntimeEvent = RuntimeEvent;
325 type WeightInfo = weights::pallet_message_queue::WeightInfo<Runtime>;
326 #[cfg(feature = "runtime-benchmarks")]
327 type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<
328 cumulus_primitives_core::AggregateMessageOrigin,
329 >;
330 #[cfg(not(feature = "runtime-benchmarks"))]
331 type MessageProcessor = xcm_builder::ProcessXcmMessage<
332 AggregateMessageOrigin,
333 xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
334 RuntimeCall,
335 >;
336 type Size = u32;
337 type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
339 type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
340 type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>;
341 type MaxStale = sp_core::ConstU32<8>;
342 type ServiceWeight = MessageQueueServiceWeight;
343 type IdleMaxServiceWeight = MessageQueueServiceWeight;
344}
345
346impl parachain_info::Config for Runtime {}
347
348impl cumulus_pallet_aura_ext::Config for Runtime {}
349
350parameter_types! {
351 pub const FellowsBodyId: BodyId = BodyId::Technical;
353}
354
355pub type RootOrFellows = EitherOfDiverse<
357 EnsureRoot<AccountId>,
358 EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
359>;
360
361parameter_types! {
362 pub FeeAssetId: AssetId = AssetId(TokenRelayLocation::get());
364 pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3);
366}
367
368pub type PriceForSiblingParachainDelivery = polkadot_runtime_common::xcm_sender::ExponentialPrice<
369 FeeAssetId,
370 BaseDeliveryFee,
371 TransactionByteFee,
372 XcmpQueue,
373>;
374
375impl cumulus_pallet_xcmp_queue::Config for Runtime {
376 type RuntimeEvent = RuntimeEvent;
377 type ChannelInfo = ParachainSystem;
378 type VersionWrapper = PolkadotXcm;
379 type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
380 type MaxInboundSuspended = ConstU32<1_000>;
381 type MaxActiveOutboundChannels = ConstU32<128>;
382 type MaxPageSize = ConstU32<{ 103 * 1024 }>;
385 type ControllerOrigin = RootOrFellows;
386 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
387 type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
388 type PriceForSiblingDelivery = PriceForSiblingParachainDelivery;
389}
390
391impl cumulus_pallet_xcmp_queue::migration::v5::V5Config for Runtime {
392 type ChannelList = ParachainSystem;
394}
395
396pub const PERIOD: u32 = 6 * HOURS;
397pub const OFFSET: u32 = 0;
398
399impl pallet_session::Config for Runtime {
400 type RuntimeEvent = RuntimeEvent;
401 type ValidatorId = <Self as frame_system::Config>::AccountId;
402 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
404 type ShouldEndSession = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
405 type NextSessionRotation = pallet_session::PeriodicSessions<ConstU32<PERIOD>, ConstU32<OFFSET>>;
406 type SessionManager = CollatorSelection;
407 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
409 type Keys = SessionKeys;
410 type DisablingStrategy = ();
411 type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
412 type Currency = Balances;
413 type KeyDeposit = ();
414}
415
416impl pallet_aura::Config for Runtime {
417 type AuthorityId = AuraId;
418 type DisabledValidators = ();
419 type MaxAuthorities = ConstU32<100_000>;
420 type AllowMultipleBlocksPerSlot = ConstBool<true>;
421 type SlotDuration = ConstU64<SLOT_DURATION>;
422}
423
424parameter_types! {
425 pub const PotId: PalletId = PalletId(*b"PotStake");
426 pub const SessionLength: BlockNumber = 6 * HOURS;
427 pub const StakingAdminBodyId: BodyId = BodyId::Defense;
429}
430
431pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
433 EnsureRoot<AccountId>,
434 EnsureXcm<IsVoiceOfBody<GovernanceLocation, StakingAdminBodyId>>,
435>;
436
437impl pallet_collator_selection::Config for Runtime {
438 type RuntimeEvent = RuntimeEvent;
439 type Currency = Balances;
440 type UpdateOrigin = CollatorSelectionUpdateOrigin;
441 type PotId = PotId;
442 type MaxCandidates = ConstU32<100>;
443 type MinEligibleCollators = ConstU32<4>;
444 type MaxInvulnerables = ConstU32<20>;
445 type KickThreshold = ConstU32<PERIOD>;
447 type ValidatorId = <Self as frame_system::Config>::AccountId;
448 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
449 type ValidatorRegistration = Session;
450 type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
451}
452
453parameter_types! {
454 pub const DepositBase: Balance = deposit(1, 88);
456 pub const DepositFactor: Balance = deposit(0, 32);
458}
459
460impl pallet_multisig::Config for Runtime {
461 type RuntimeEvent = RuntimeEvent;
462 type RuntimeCall = RuntimeCall;
463 type Currency = Balances;
464 type DepositBase = DepositBase;
465 type DepositFactor = DepositFactor;
466 type MaxSignatories = ConstU32<100>;
467 type WeightInfo = weights::pallet_multisig::WeightInfo<Runtime>;
468 type BlockNumberProvider = frame_system::Pallet<Runtime>;
469}
470
471#[derive(
473 Copy,
474 Clone,
475 Eq,
476 PartialEq,
477 Ord,
478 PartialOrd,
479 Encode,
480 Decode,
481 DecodeWithMemTracking,
482 Debug,
483 MaxEncodedLen,
484 scale_info::TypeInfo,
485)]
486pub enum ProxyType {
487 Any,
489 NonTransfer,
491 CancelProxy,
493 Broker,
495 CoretimeRenewer,
497 OnDemandPurchaser,
499 Collator,
501}
502impl Default for ProxyType {
503 fn default() -> Self {
504 Self::Any
505 }
506}
507
508impl InstanceFilter<RuntimeCall> for ProxyType {
509 fn filter(&self, c: &RuntimeCall) -> bool {
510 match self {
511 ProxyType::Any => true,
512 ProxyType::NonTransfer => !matches!(
513 c,
514 RuntimeCall::Balances { .. } |
515 RuntimeCall::Broker(pallet_broker::Call::purchase { .. }) |
517 RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
518 RuntimeCall::Broker(pallet_broker::Call::transfer { .. }) |
519 RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
520 RuntimeCall::Broker(pallet_broker::Call::pool { .. }) |
522 RuntimeCall::Broker(pallet_broker::Call::assign { .. })
524 ),
525 ProxyType::CancelProxy => matches!(
526 c,
527 RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. }) |
528 RuntimeCall::Utility { .. } |
529 RuntimeCall::Multisig { .. }
530 ),
531 ProxyType::Broker => {
532 matches!(
533 c,
534 RuntimeCall::Broker { .. } |
535 RuntimeCall::Utility { .. } |
536 RuntimeCall::Multisig { .. }
537 )
538 },
539 ProxyType::CoretimeRenewer => {
540 matches!(
541 c,
542 RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
543 RuntimeCall::Utility { .. } |
544 RuntimeCall::Multisig { .. }
545 )
546 },
547 ProxyType::OnDemandPurchaser => {
548 matches!(
549 c,
550 RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
551 RuntimeCall::Utility { .. } |
552 RuntimeCall::Multisig { .. }
553 )
554 },
555 ProxyType::Collator => matches!(
556 c,
557 RuntimeCall::CollatorSelection { .. } |
558 RuntimeCall::Utility { .. } |
559 RuntimeCall::Multisig { .. }
560 ),
561 }
562 }
563
564 fn is_superset(&self, o: &Self) -> bool {
565 match (self, o) {
566 (x, y) if x == y => true,
567 (ProxyType::Any, _) => true,
568 (_, ProxyType::Any) => false,
569 (ProxyType::Broker, ProxyType::CoretimeRenewer) => true,
570 (ProxyType::Broker, ProxyType::OnDemandPurchaser) => true,
571 (ProxyType::NonTransfer, ProxyType::Collator) => true,
572 _ => false,
573 }
574 }
575}
576
577parameter_types! {
578 pub const ProxyDepositBase: Balance = deposit(1, 40);
580 pub const ProxyDepositFactor: Balance = deposit(0, 33);
582 pub const MaxProxies: u16 = 32;
583 pub const AnnouncementDepositBase: Balance = deposit(1, 48);
585 pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
586 pub const MaxPending: u16 = 32;
587}
588
589impl pallet_proxy::Config for Runtime {
590 type RuntimeEvent = RuntimeEvent;
591 type RuntimeCall = RuntimeCall;
592 type Currency = Balances;
593 type ProxyType = ProxyType;
594 type ProxyDepositBase = ProxyDepositBase;
595 type ProxyDepositFactor = ProxyDepositFactor;
596 type MaxProxies = MaxProxies;
597 type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
598 type MaxPending = MaxPending;
599 type CallHasher = BlakeTwo256;
600 type AnnouncementDepositBase = AnnouncementDepositBase;
601 type AnnouncementDepositFactor = AnnouncementDepositFactor;
602 type BlockNumberProvider = frame_system::Pallet<Runtime>;
603}
604
605impl pallet_utility::Config for Runtime {
606 type RuntimeEvent = RuntimeEvent;
607 type RuntimeCall = RuntimeCall;
608 type PalletsOrigin = OriginCaller;
609 type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
610}
611
612impl pallet_sudo::Config for Runtime {
613 type RuntimeCall = RuntimeCall;
614 type RuntimeEvent = RuntimeEvent;
615 type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
616}
617
618impl pallet_accumulate_and_forward::Config for Runtime {
619 type Currency = Balances;
620 type PalletId = AccumulateForwardPalletId;
621 type Forwarder = xcm_builder::TeleportForwarderForAccountId32<
622 xcm_config::XcmConfig,
623 testnet_parachains_constants::westend::locations::AssetHubLocation,
624 xcm_config::TokenRelayLocation,
625 DapStagingLocation,
626 >;
627 type TransferPeriod = ForwardPeriod;
628 type MinTransferAmount = MinForwardAmount;
629 type BlockNumberProvider = RelaychainDataProvider<Runtime>;
630 type WeightInfo = weights::pallet_accumulate_and_forward::WeightInfo<Runtime>;
631}
632
633const CORETIME_WESTEND_FIRST_SALE_REGION_BEGIN: u32 = 246_662;
636
637pub struct BrokerFirstSaleRegion;
638
639impl pallet_broker::migration::v5::FirstSaleRegion for BrokerFirstSaleRegion {
640 fn region_begin() -> u32 {
641 CORETIME_WESTEND_FIRST_SALE_REGION_BEGIN
642 }
643}
644
645pub type MetaTxExtension = (
646 pallet_verify_signature::VerifySignature<Runtime>,
647 pallet_meta_tx::MetaTxMarker<Runtime>,
648 frame_system::CheckNonZeroSender<Runtime>,
649 frame_system::CheckSpecVersion<Runtime>,
650 frame_system::CheckTxVersion<Runtime>,
651 frame_system::CheckGenesis<Runtime>,
652 frame_system::CheckEra<Runtime>,
653 frame_system::CheckNonce<Runtime>,
654 frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
655);
656
657impl pallet_meta_tx::Config for Runtime {
658 type WeightInfo = weights::pallet_meta_tx::WeightInfo<Runtime>;
659 type RuntimeEvent = RuntimeEvent;
660 #[cfg(not(feature = "runtime-benchmarks"))]
661 type Extension = MetaTxExtension;
662 #[cfg(feature = "runtime-benchmarks")]
663 type Extension = pallet_meta_tx::WeightlessExtension<Runtime>;
664}
665
666impl pallet_verify_signature::Config for Runtime {
667 type Signature = MultiSignature;
668 type AccountIdentifier = MultiSigner;
669 type WeightInfo = weights::pallet_verify_signature::WeightInfo<Runtime>;
670 #[cfg(feature = "runtime-benchmarks")]
671 type BenchmarkHelper = ();
672}
673
674construct_runtime!(
676 pub enum Runtime
677 {
678 System: frame_system = 0,
680 ParachainSystem: cumulus_pallet_parachain_system = 1,
681 Timestamp: pallet_timestamp = 3,
682 ParachainInfo: parachain_info = 4,
683 WeightReclaim: cumulus_pallet_weight_reclaim = 5,
684
685 Balances: pallet_balances = 10,
687 TransactionPayment: pallet_transaction_payment = 11,
688 AccumulateForward: pallet_accumulate_and_forward = 12,
689
690 Authorship: pallet_authorship = 20,
692 CollatorSelection: pallet_collator_selection = 21,
693 Session: pallet_session = 22,
694 Aura: pallet_aura = 23,
695 AuraExt: cumulus_pallet_aura_ext = 24,
696
697 XcmpQueue: cumulus_pallet_xcmp_queue = 30,
699 PolkadotXcm: pallet_xcm = 31,
700 CumulusXcm: cumulus_pallet_xcm = 32,
701 MessageQueue: pallet_message_queue = 34,
702
703 Utility: pallet_utility = 40,
705 Multisig: pallet_multisig = 41,
706 Proxy: pallet_proxy = 42,
707 MetaTx: pallet_meta_tx = 43,
708 VerifySignature: pallet_verify_signature = 44,
709
710 Broker: pallet_broker = 50,
712
713 Sudo: pallet_sudo = 100,
715 }
716);
717
718#[cfg(feature = "runtime-benchmarks")]
719mod benches {
720 frame_benchmarking::define_benchmarks!(
721 [frame_system, SystemBench::<Runtime>]
722 [cumulus_pallet_parachain_system, ParachainSystem]
723 [pallet_timestamp, Timestamp]
724 [pallet_balances, Balances]
725 [pallet_broker, Broker]
726 [pallet_collator_selection, CollatorSelection]
727 [pallet_session, SessionBench::<Runtime>]
728 [cumulus_pallet_xcmp_queue, XcmpQueue]
729 [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
730 [pallet_message_queue, MessageQueue]
731 [pallet_multisig, Multisig]
732 [pallet_proxy, Proxy]
733 [pallet_utility, Utility]
734 [pallet_meta_tx, MetaTx]
735 [pallet_verify_signature, VerifySignature]
736 [pallet_xcm_benchmarks::fungible, XcmBalances]
738 [pallet_xcm_benchmarks::generic, XcmGeneric]
739 [cumulus_pallet_weight_reclaim, WeightReclaim]
740 [pallet_accumulate_and_forward, AccumulateForward]
741 );
742}
743
744impl_runtime_apis! {
745 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
746 fn slot_duration() -> sp_consensus_aura::SlotDuration {
747 sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
748 }
749
750 fn authorities() -> Vec<AuraId> {
751 pallet_aura::Authorities::<Runtime>::get().into_inner()
752 }
753 }
754
755 impl cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
756 fn relay_parent_offset() -> u32 {
757 RELAY_PARENT_OFFSET
758 }
759
760 fn max_claim_queue_offset() -> u8 {
761 cumulus_pallet_parachain_system::Pallet::<Runtime>::max_claim_queue_offset()
762 }
763 }
764
765 impl cumulus_primitives_core::SchedulingV3EnabledApi<Block> for Runtime {
766 fn scheduling_v3_enabled() -> bool {
767 <Runtime as cumulus_pallet_parachain_system::Config>::SchedulingSignatureVerifier::V3_SCHEDULING_ENABLED
768 }
769 }
770
771 impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
772 fn can_build_upon(
773 included_hash: <Block as BlockT>::Hash,
774 slot: cumulus_primitives_aura::Slot,
775 ) -> bool {
776 ConsensusHook::can_build_upon(included_hash, slot)
777 }
778 }
779
780 impl sp_api::Core<Block> for Runtime {
781 fn version() -> RuntimeVersion {
782 VERSION
783 }
784
785 fn execute_block(block: <Block as BlockT>::LazyBlock) {
786 Executive::execute_block(block)
787 }
788
789 fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
790 Executive::initialize_block(header)
791 }
792 }
793
794 impl sp_api::Metadata<Block> for Runtime {
795 fn metadata() -> OpaqueMetadata {
796 OpaqueMetadata::new(Runtime::metadata().into())
797 }
798
799 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
800 Runtime::metadata_at_version(version)
801 }
802
803 fn metadata_versions() -> alloc::vec::Vec<u32> {
804 Runtime::metadata_versions()
805 }
806 }
807
808 impl sp_block_builder::BlockBuilder<Block> for Runtime {
809 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
810 Executive::apply_extrinsic(extrinsic)
811 }
812
813 fn finalize_block() -> <Block as BlockT>::Header {
814 Executive::finalize_block()
815 }
816
817 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
818 data.create_extrinsics()
819 }
820
821 fn check_inherents(
822 block: <Block as BlockT>::LazyBlock,
823 data: sp_inherents::InherentData,
824 ) -> sp_inherents::CheckInherentsResult {
825 data.check_extrinsics(&block)
826 }
827 }
828
829 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
830 fn validate_transaction(
831 source: TransactionSource,
832 tx: <Block as BlockT>::Extrinsic,
833 block_hash: <Block as BlockT>::Hash,
834 ) -> TransactionValidity {
835 Executive::validate_transaction(source, tx, block_hash)
836 }
837 }
838
839 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
840 fn offchain_worker(header: &<Block as BlockT>::Header) {
841 Executive::offchain_worker(header)
842 }
843 }
844
845 impl sp_session::SessionKeys<Block> for Runtime {
846 fn generate_session_keys(owner: Vec<u8>, seed: Option<Vec<u8>>) -> OpaqueGeneratedSessionKeys {
847 SessionKeys::generate(&owner, seed).into()
848 }
849
850 fn decode_session_keys(
851 encoded: Vec<u8>,
852 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
853 SessionKeys::decode_into_raw_public_keys(&encoded)
854 }
855 }
856
857 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
858 fn account_nonce(account: AccountId) -> Nonce {
859 System::account_nonce(account)
860 }
861 }
862
863 impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
864 fn sale_price() -> Result<Balance, DispatchError> {
865 Broker::current_price()
866 }
867 }
868
869 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
870 fn query_info(
871 uxt: <Block as BlockT>::Extrinsic,
872 len: u32,
873 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
874 TransactionPayment::query_info(uxt, len)
875 }
876 fn query_fee_details(
877 uxt: <Block as BlockT>::Extrinsic,
878 len: u32,
879 ) -> pallet_transaction_payment::FeeDetails<Balance> {
880 TransactionPayment::query_fee_details(uxt, len)
881 }
882 fn query_weight_to_fee(weight: Weight) -> Balance {
883 TransactionPayment::weight_to_fee(weight)
884 }
885 fn query_length_to_fee(length: u32) -> Balance {
886 TransactionPayment::length_to_fee(length)
887 }
888 }
889
890 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
891 for Runtime
892 {
893 fn query_call_info(
894 call: RuntimeCall,
895 len: u32,
896 ) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
897 TransactionPayment::query_call_info(call, len)
898 }
899 fn query_call_fee_details(
900 call: RuntimeCall,
901 len: u32,
902 ) -> pallet_transaction_payment::FeeDetails<Balance> {
903 TransactionPayment::query_call_fee_details(call, len)
904 }
905 fn query_weight_to_fee(weight: Weight) -> Balance {
906 TransactionPayment::weight_to_fee(weight)
907 }
908 fn query_length_to_fee(length: u32) -> Balance {
909 TransactionPayment::length_to_fee(length)
910 }
911 }
912
913 impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
914 fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
915 let acceptable_assets = vec![AssetId(xcm_config::TokenRelayLocation::get())];
916 PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
917 }
918
919 fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
920 type Trader = <XcmConfig as xcm_executor::Config>::Trader;
921 PolkadotXcm::query_weight_to_asset_fee::<Trader>(weight, asset)
922 }
923
924 fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
925 PolkadotXcm::query_xcm_weight(message)
926 }
927
928 fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>, asset_id: VersionedAssetId) -> Result<VersionedAssets, XcmPaymentApiError> {
929 type AssetExchanger = <XcmConfig as xcm_executor::Config>::AssetExchanger;
930 PolkadotXcm::query_delivery_fees::<AssetExchanger>(destination, message, asset_id)
931 }
932 }
933
934 impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
935 fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
936 PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
937 }
938
939 fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
940 PolkadotXcm::dry_run_xcm::<xcm_config::XcmRouter>(origin_location, xcm)
941 }
942 }
943
944 impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
945 fn convert_location(location: VersionedLocation) -> Result<
946 AccountId,
947 xcm_runtime_apis::conversions::Error
948 > {
949 xcm_runtime_apis::conversions::LocationToAccountHelper::<
950 AccountId,
951 xcm_config::LocationToAccountId,
952 >::convert_location(location)
953 }
954 }
955
956 impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
957 fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
958 PolkadotXcm::is_trusted_reserve(asset, location)
959 }
960 fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
961 PolkadotXcm::is_trusted_teleporter(asset, location)
962 }
963 }
964
965 impl xcm_runtime_apis::authorized_aliases::AuthorizedAliasersApi<Block> for Runtime {
966 fn authorized_aliasers(target: VersionedLocation) -> Result<
967 Vec<xcm_runtime_apis::authorized_aliases::OriginAliaser>,
968 xcm_runtime_apis::authorized_aliases::Error
969 > {
970 PolkadotXcm::authorized_aliasers(target)
971 }
972 fn is_authorized_alias(origin: VersionedLocation, target: VersionedLocation) -> Result<
973 bool,
974 xcm_runtime_apis::authorized_aliases::Error
975 > {
976 PolkadotXcm::is_authorized_alias(origin, target)
977 }
978 }
979
980 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
981 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
982 ParachainSystem::collect_collation_info(header)
983 }
984 }
985
986 #[cfg(feature = "try-runtime")]
987 impl frame_try_runtime::TryRuntime<Block> for Runtime {
988 fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
989 let weight = Executive::try_runtime_upgrade(checks).unwrap();
990 (weight, RuntimeBlockWeights::get().max_block)
991 }
992
993 fn execute_block(
994 block: <Block as BlockT>::LazyBlock,
995 state_root_check: bool,
996 signature_check: bool,
997 select: frame_try_runtime::TryStateSelect,
998 ) -> Weight {
999 Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
1002 }
1003 }
1004
1005 #[cfg(feature = "runtime-benchmarks")]
1006 impl frame_benchmarking::Benchmark<Block> for Runtime {
1007 fn benchmark_metadata(extra: bool) -> (
1008 Vec<frame_benchmarking::BenchmarkList>,
1009 Vec<frame_support::traits::StorageInfo>,
1010 ) {
1011 use frame_benchmarking::BenchmarkList;
1012 use frame_support::traits::StorageInfoTrait;
1013 use frame_system_benchmarking::Pallet as SystemBench;
1014 use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
1015 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
1016
1017 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1021 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1022
1023 let mut list = Vec::<BenchmarkList>::new();
1024 list_benchmarks!(list, extra);
1025
1026 let storage_info = AllPalletsWithSystem::storage_info();
1027 (list, storage_info)
1028 }
1029
1030 #[allow(non_local_definitions)]
1031 fn dispatch_benchmark(
1032 config: frame_benchmarking::BenchmarkConfig
1033 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
1034 use frame_benchmarking::{BenchmarkBatch, BenchmarkError};
1035 use sp_storage::TrackedStorageKey;
1036 use codec::Encode;
1037
1038 use frame_system_benchmarking::Pallet as SystemBench;
1039 impl frame_system_benchmarking::Config for Runtime {
1040 fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> Result<(), BenchmarkError> {
1041 ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
1042 Ok(())
1043 }
1044
1045 fn verify_set_code() {
1046 System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
1047 }
1048 }
1049
1050 use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
1051 impl cumulus_pallet_session_benchmarking::Config for Runtime {
1052 fn generate_session_keys_and_proof(owner: Self::AccountId) -> (Self::Keys, Vec<u8>) {
1053 let keys = SessionKeys::generate(&owner.encode(), None);
1054 (keys.keys, keys.proof.encode())
1055 }
1056 }
1057
1058 use xcm::latest::prelude::*;
1059 use xcm_config::TokenRelayLocation;
1060 use testnet_parachains_constants::westend::locations::{AssetHubParaId, AssetHubLocation};
1061
1062 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
1063 impl pallet_xcm::benchmarking::Config for Runtime {
1064 type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1065 xcm_config::XcmConfig,
1066 ExistentialDepositAsset,
1067 PriceForSiblingParachainDelivery,
1068 AssetHubParaId,
1069 ParachainSystem,
1070 >;
1071
1072 fn reachable_dest() -> Option<Location> {
1073 Some(AssetHubLocation::get())
1074 }
1075
1076 fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
1077 Some((
1079 Asset {
1080 fun: Fungible(ExistentialDeposit::get()),
1081 id: AssetId(TokenRelayLocation::get())
1082 },
1083 AssetHubLocation::get(),
1084 ))
1085 }
1086
1087 fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
1088 let core = 0;
1092 let begin = 0;
1093 let end = 42;
1094
1095 let region_id = pallet_broker::Pallet::<Runtime>::issue(core, begin, pallet_broker::CoreMask::complete(), end, None, None);
1096 Some((
1097 Asset {
1098 fun: NonFungible(Index(region_id.into())),
1099 id: AssetId(xcm_config::BrokerPalletLocation::get())
1100 },
1101 AssetHubLocation::get(),
1102 ))
1103 }
1104
1105 fn set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> {
1106 let native_location = Parent.into();
1107 let dest = AssetHubLocation::get();
1108
1109 pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
1110 native_location,
1111 dest,
1112 )
1113 }
1114
1115 fn get_asset() -> Asset {
1116 Asset {
1117 id: AssetId(TokenRelayLocation::get()),
1118 fun: Fungible(ExistentialDeposit::get()),
1119 }
1120 }
1121
1122 fn get_assets(n: u32) -> Assets {
1123 let regions: Vec<Asset> = (0..n)
1126 .map(|i| {
1127 let region_id = pallet_broker::Pallet::<Runtime>::issue(
1128 i as pallet_broker::CoreIndex,
1129 0,
1130 pallet_broker::CoreMask::complete(),
1131 42,
1132 None,
1133 None,
1134 );
1135 Asset {
1136 fun: NonFungible(Index(region_id.into())),
1137 id: AssetId(xcm_config::BrokerPalletLocation::get()),
1138 }
1139 })
1140 .collect();
1141 regions.into()
1142 }
1143
1144 fn batch_call(calls: Vec<RuntimeCall>) -> Option<RuntimeCall> {
1145 Some(RuntimeCall::Utility(pallet_utility::Call::batch { calls }))
1146 }
1147 }
1148
1149 parameter_types! {
1150 pub ExistentialDepositAsset: Option<Asset> = Some((
1151 TokenRelayLocation::get(),
1152 ExistentialDeposit::get()
1153 ).into());
1154 }
1155
1156 impl pallet_xcm_benchmarks::Config for Runtime {
1157 type XcmConfig = xcm_config::XcmConfig;
1158
1159 type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1160 xcm_config::XcmConfig,
1161 ExistentialDepositAsset,
1162 PriceForSiblingParachainDelivery,
1163 AssetHubParaId,
1164 ParachainSystem,
1165 >;
1166
1167 type AccountIdConverter = xcm_config::LocationToAccountId;
1168 fn valid_destination() -> Result<Location, BenchmarkError> {
1169 Ok(AssetHubLocation::get())
1170 }
1171 fn worst_case_holding(_depositable_count: u32) -> xcm_executor::AssetsInHolding {
1172 use pallet_xcm_benchmarks::MockCredit;
1173 let mut holding = xcm_executor::AssetsInHolding::new();
1175 holding.fungible.insert(
1176 AssetId(TokenRelayLocation::get()),
1177 alloc::boxed::Box::new(MockCredit(1_000_000 * UNITS)),
1178 );
1179 holding
1180 }
1181 }
1182
1183 parameter_types! {
1184 pub TrustedTeleporter: Option<(Location, Asset)> = Some((
1185 AssetHubLocation::get(),
1186 Asset { fun: Fungible(UNITS), id: AssetId(TokenRelayLocation::get()) },
1187 ));
1188 pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
1189 pub const TrustedReserve: Option<(Location, Asset)> = None;
1190 }
1191
1192 impl pallet_xcm_benchmarks::fungible::Config for Runtime {
1193 type TransactAsset = Balances;
1194
1195 type CheckedAccount = CheckedAccount;
1196 type TrustedTeleporter = TrustedTeleporter;
1197 type TrustedReserve = TrustedReserve;
1198
1199 fn get_asset() -> Asset {
1200 Asset {
1201 id: AssetId(TokenRelayLocation::get()),
1202 fun: Fungible(UNITS),
1203 }
1204 }
1205 }
1206
1207 impl pallet_xcm_benchmarks::generic::Config for Runtime {
1208 type RuntimeCall = RuntimeCall;
1209 type TransactAsset = Balances;
1210
1211 fn worst_case_response() -> (u64, Response) {
1212 (0u64, Response::Version(Default::default()))
1213 }
1214
1215 fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
1216 Err(BenchmarkError::Skip)
1217 }
1218
1219 fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
1220 Err(BenchmarkError::Skip)
1221 }
1222
1223 fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
1224 Ok((AssetHubLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
1225 }
1226
1227 fn subscribe_origin() -> Result<Location, BenchmarkError> {
1228 Ok(AssetHubLocation::get())
1229 }
1230
1231 fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
1232 let origin = AssetHubLocation::get();
1233 let assets: Assets = (AssetId(TokenRelayLocation::get()), 1_000 * UNITS).into();
1234 let ticket = Location { parents: 0, interior: Here };
1235 Ok((origin, ticket, assets))
1236 }
1237
1238 fn worst_case_for_trader() -> Result<(Asset, WeightLimit), BenchmarkError> {
1239 Ok((Asset {
1240 id: AssetId(TokenRelayLocation::get()),
1241 fun: Fungible(1_000_000 * UNITS),
1242 }, WeightLimit::Limited(Weight::from_parts(5000, 5000))))
1243 }
1244
1245 fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
1246 Err(BenchmarkError::Skip)
1247 }
1248
1249 fn export_message_origin_and_destination(
1250 ) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
1251 Err(BenchmarkError::Skip)
1252 }
1253
1254 fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
1255 use parachains_common::benchmarking::set_up_worst_case_authorized_alias;
1256
1257 Ok(set_up_worst_case_authorized_alias::<Runtime>())
1261 }
1262 }
1263
1264 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1265 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1266
1267 use frame_support::traits::WhitelistedStorageKeys;
1268 let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
1269
1270 let mut batches = Vec::<BenchmarkBatch>::new();
1271 let params = (&config, &whitelist);
1272 add_benchmarks!(params, batches);
1273
1274 Ok(batches)
1275 }
1276 }
1277
1278 impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
1279 fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
1280 build_state::<RuntimeGenesisConfig>(config)
1281 }
1282
1283 fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
1284 get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
1285 }
1286
1287 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
1288 genesis_config_presets::preset_names()
1289 }
1290 }
1291
1292 impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
1293 fn parachain_id() -> ParaId {
1294 ParachainInfo::parachain_id()
1295 }
1296 }
1297
1298 impl cumulus_primitives_core::TargetBlockRate<Block> for Runtime {
1299 fn target_block_rate() -> u32 {
1300 BLOCK_PROCESSING_VELOCITY
1301 }
1302 }
1303}
1304
1305cumulus_pallet_parachain_system::register_validate_block! {
1306 Runtime = Runtime,
1307 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
1308}