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