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_025_002,
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 DoneSlashHandler = ();
262}
263
264parameter_types! {
265 pub const TransactionByteFee: Balance = MILLICENTS;
267 pub const AccumulateForwardFeePercent: Percent = Percent::from_percent(100);
269}
270
271pub type DealWithFeesAccumulate = pallet_accumulate_and_forward::DealWithFeesSplit<
272 Runtime,
273 AccumulateForwardFeePercent,
274 DealWithFees<Runtime>,
275>;
276
277impl pallet_transaction_payment::Config for Runtime {
278 type RuntimeEvent = RuntimeEvent;
279 type OnChargeTransaction =
280 pallet_transaction_payment::FungibleAdapter<Balances, DealWithFeesAccumulate>;
281 type OperationalFeeMultiplier = ConstU8<5>;
282 type WeightToFee = WeightToFee;
283 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
284 type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
285 type WeightInfo = weights::pallet_transaction_payment::WeightInfo<Runtime>;
286}
287
288parameter_types! {
289 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
290 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
291 pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
292}
293
294impl cumulus_pallet_parachain_system::Config for Runtime {
295 type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Runtime>;
296 type RuntimeEvent = RuntimeEvent;
297 type OnSystemEvent = ();
298 type SelfParaId = parachain_info::Pallet<Runtime>;
299 type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
300 type OutboundXcmpMessageSource = XcmpQueue;
301 type ReservedDmpWeight = ReservedDmpWeight;
302 type XcmpMessageHandler = XcmpQueue;
303 type ReservedXcmpWeight = ReservedXcmpWeight;
304 type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
305 type ConsensusHook = ConsensusHook;
306 type RelayParentOffset = ConstU32<RELAY_PARENT_OFFSET>;
307 type SchedulingSignatureVerifier = ();
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 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 pub const FellowsBodyId: BodyId = BodyId::Technical;
351}
352
353pub type RootOrFellows = EitherOfDiverse<
355 EnsureRoot<AccountId>,
356 EnsureXcm<IsVoiceOfBody<FellowshipLocation, FellowsBodyId>>,
357>;
358
359parameter_types! {
360 pub FeeAssetId: AssetId = AssetId(TokenRelayLocation::get());
362 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 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 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 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 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 pub const StakingAdminBodyId: BodyId = BodyId::Defense;
427}
428
429pub 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 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 pub const DepositBase: Balance = deposit(1, 88);
454 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#[derive(
471 Copy,
472 Clone,
473 Eq,
474 PartialEq,
475 Ord,
476 PartialOrd,
477 Encode,
478 Decode,
479 DecodeWithMemTracking,
480 Debug,
481 MaxEncodedLen,
482 scale_info::TypeInfo,
483)]
484pub enum ProxyType {
485 Any,
487 NonTransfer,
489 CancelProxy,
491 Broker,
493 CoretimeRenewer,
495 OnDemandPurchaser,
497 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 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 RuntimeCall::Broker(pallet_broker::Call::pool { .. }) |
520 RuntimeCall::Broker(pallet_broker::Call::assign { .. }) |
522 RuntimeCall::OnDemand(pallet_on_demand_para::Call::place_order { .. })
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::OnDemand(pallet_on_demand_para::Call::place_order { .. }) |
536 RuntimeCall::Utility { .. } |
537 RuntimeCall::Multisig { .. }
538 )
539 },
540 ProxyType::CoretimeRenewer => {
541 matches!(
542 c,
543 RuntimeCall::Broker(pallet_broker::Call::renew { .. }) |
544 RuntimeCall::Utility { .. } |
545 RuntimeCall::Multisig { .. }
546 )
547 },
548 ProxyType::OnDemandPurchaser => {
549 matches!(
550 c,
551 RuntimeCall::Broker(pallet_broker::Call::purchase_credit { .. }) |
552 RuntimeCall::OnDemand(pallet_on_demand_para::Call::place_order { .. }) |
553 RuntimeCall::Utility { .. } |
554 RuntimeCall::Multisig { .. }
555 )
556 },
557 ProxyType::Collator => matches!(
558 c,
559 RuntimeCall::CollatorSelection { .. } |
560 RuntimeCall::Utility { .. } |
561 RuntimeCall::Multisig { .. }
562 ),
563 }
564 }
565
566 fn is_superset(&self, o: &Self) -> bool {
567 match (self, o) {
568 (x, y) if x == y => true,
569 (ProxyType::Any, _) => true,
570 (_, ProxyType::Any) => false,
571 (ProxyType::Broker, ProxyType::CoretimeRenewer) => true,
572 (ProxyType::Broker, ProxyType::OnDemandPurchaser) => true,
573 (ProxyType::NonTransfer, ProxyType::Collator) => true,
574 _ => false,
575 }
576 }
577}
578
579parameter_types! {
580 pub const ProxyDepositBase: Balance = deposit(1, 40);
582 pub const ProxyDepositFactor: Balance = deposit(0, 33);
584 pub const MaxProxies: u16 = 32;
585 pub const AnnouncementDepositBase: Balance = deposit(1, 48);
587 pub const AnnouncementDepositFactor: Balance = deposit(0, 66);
588 pub const MaxPending: u16 = 32;
589}
590
591impl pallet_proxy::Config for Runtime {
592 type RuntimeEvent = RuntimeEvent;
593 type RuntimeCall = RuntimeCall;
594 type Currency = Balances;
595 type ProxyType = ProxyType;
596 type ProxyDepositBase = ProxyDepositBase;
597 type ProxyDepositFactor = ProxyDepositFactor;
598 type MaxProxies = MaxProxies;
599 type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
600 type MaxPending = MaxPending;
601 type CallHasher = BlakeTwo256;
602 type AnnouncementDepositBase = AnnouncementDepositBase;
603 type AnnouncementDepositFactor = AnnouncementDepositFactor;
604 type BlockNumberProvider = frame_system::Pallet<Runtime>;
605}
606
607impl pallet_utility::Config for Runtime {
608 type RuntimeEvent = RuntimeEvent;
609 type RuntimeCall = RuntimeCall;
610 type PalletsOrigin = OriginCaller;
611 type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
612}
613
614impl pallet_sudo::Config for Runtime {
615 type RuntimeCall = RuntimeCall;
616 type RuntimeEvent = RuntimeEvent;
617 type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
618}
619
620impl pallet_accumulate_and_forward::Config for Runtime {
621 type Currency = Balances;
622 type PalletId = AccumulateForwardPalletId;
623 type Forwarder = xcm_builder::TeleportForwarderForAccountId32<
624 xcm_config::XcmConfig,
625 testnet_parachains_constants::westend::locations::AssetHubLocation,
626 xcm_config::TokenRelayLocation,
627 DapStagingLocation,
628 >;
629 type TransferPeriod = ForwardPeriod;
630 type MinTransferAmount = MinForwardAmount;
631 type BlockNumberProvider = RelaychainDataProvider<Runtime>;
632 type WeightInfo = weights::pallet_accumulate_and_forward::WeightInfo<Runtime>;
633}
634
635const CORETIME_WESTEND_FIRST_SALE_REGION_BEGIN: u32 = 246_662;
638
639pub struct BrokerFirstSaleRegion;
640
641impl pallet_broker::migration::v5::FirstSaleRegion for BrokerFirstSaleRegion {
642 fn region_begin() -> u32 {
643 CORETIME_WESTEND_FIRST_SALE_REGION_BEGIN
644 }
645}
646
647pub type MetaTxExtension = (
648 pallet_verify_signature::VerifySignature<Runtime>,
649 pallet_meta_tx::MetaTxMarker<Runtime>,
650 frame_system::CheckNonZeroSender<Runtime>,
651 frame_system::CheckSpecVersion<Runtime>,
652 frame_system::CheckTxVersion<Runtime>,
653 frame_system::CheckGenesis<Runtime>,
654 frame_system::CheckEra<Runtime>,
655 frame_system::CheckNonce<Runtime>,
656 frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
657);
658
659impl pallet_meta_tx::Config for Runtime {
660 type WeightInfo = weights::pallet_meta_tx::WeightInfo<Runtime>;
661 type RuntimeEvent = RuntimeEvent;
662 #[cfg(not(feature = "runtime-benchmarks"))]
663 type Extension = MetaTxExtension;
664 #[cfg(feature = "runtime-benchmarks")]
665 type Extension = pallet_meta_tx::WeightlessExtension<Runtime>;
666}
667
668impl pallet_verify_signature::Config for Runtime {
669 type Signature = MultiSignature;
670 type AccountIdentifier = MultiSigner;
671 type WeightInfo = weights::pallet_verify_signature::WeightInfo<Runtime>;
672 #[cfg(feature = "runtime-benchmarks")]
673 type BenchmarkHelper = ();
674}
675
676construct_runtime!(
678 pub enum Runtime
679 {
680 System: frame_system = 0,
682 OnDemand: pallet_on_demand_para = 51,
685 ParachainSystem: cumulus_pallet_parachain_system = 1,
686 Timestamp: pallet_timestamp = 3,
687 ParachainInfo: parachain_info = 4,
688 WeightReclaim: cumulus_pallet_weight_reclaim = 5,
689
690 Balances: pallet_balances = 10,
692 TransactionPayment: pallet_transaction_payment = 11,
693 AccumulateForward: pallet_accumulate_and_forward = 12,
694
695 Authorship: pallet_authorship = 20,
697 CollatorSelection: pallet_collator_selection = 21,
698 Session: pallet_session = 22,
699 Aura: pallet_aura = 23,
700 AuraExt: cumulus_pallet_aura_ext = 24,
701
702 XcmpQueue: cumulus_pallet_xcmp_queue = 30,
704 PolkadotXcm: pallet_xcm = 31,
705 CumulusXcm: cumulus_pallet_xcm = 32,
706 MessageQueue: pallet_message_queue = 34,
707
708 Utility: pallet_utility = 40,
710 Multisig: pallet_multisig = 41,
711 Proxy: pallet_proxy = 42,
712 MetaTx: pallet_meta_tx = 43,
713 VerifySignature: pallet_verify_signature = 44,
714
715 Broker: pallet_broker = 50,
717
718 Sudo: pallet_sudo = 100,
720 }
721);
722
723#[cfg(feature = "runtime-benchmarks")]
724mod benches {
725 frame_benchmarking::define_benchmarks!(
726 [frame_system, SystemBench::<Runtime>]
727 [cumulus_pallet_parachain_system, ParachainSystem]
728 [pallet_timestamp, Timestamp]
729 [pallet_balances, Balances]
730 [pallet_broker, Broker]
731 [pallet_on_demand_para, OnDemand]
732 [pallet_collator_selection, CollatorSelection]
733 [pallet_session, SessionBench::<Runtime>]
734 [cumulus_pallet_xcmp_queue, XcmpQueue]
735 [pallet_xcm, PalletXcmExtrinsicsBenchmark::<Runtime>]
736 [pallet_message_queue, MessageQueue]
737 [pallet_multisig, Multisig]
738 [pallet_proxy, Proxy]
739 [pallet_utility, Utility]
740 [pallet_meta_tx, MetaTx]
741 [pallet_verify_signature, VerifySignature]
742 [pallet_xcm_benchmarks::fungible, XcmBalances]
744 [pallet_xcm_benchmarks::generic, XcmGeneric]
745 [cumulus_pallet_weight_reclaim, WeightReclaim]
746 [pallet_accumulate_and_forward, AccumulateForward]
747 );
748}
749
750impl_runtime_apis! {
751 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
752 fn slot_duration() -> sp_consensus_aura::SlotDuration {
753 sp_consensus_aura::SlotDuration::from_millis(SLOT_DURATION)
754 }
755
756 fn authorities() -> Vec<AuraId> {
757 pallet_aura::Authorities::<Runtime>::get().into_inner()
758 }
759 }
760
761 impl cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
762 fn relay_parent_offset() -> u32 {
763 RELAY_PARENT_OFFSET
764 }
765
766 fn max_claim_queue_offset() -> u8 {
767 cumulus_pallet_parachain_system::Pallet::<Runtime>::max_claim_queue_offset()
768 }
769 }
770
771 impl cumulus_primitives_core::SchedulingV3EnabledApi<Block> for Runtime {
772 fn scheduling_v3_enabled() -> bool {
773 <Runtime as cumulus_pallet_parachain_system::Config>::SchedulingSignatureVerifier::V3_SCHEDULING_ENABLED
774 }
775 }
776
777 impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
778 fn can_build_upon(
779 included_hash: <Block as BlockT>::Hash,
780 slot: cumulus_primitives_aura::Slot,
781 ) -> bool {
782 ConsensusHook::can_build_upon(included_hash, slot)
783 }
784 }
785
786 impl sp_api::Core<Block> for Runtime {
787 fn version() -> RuntimeVersion {
788 VERSION
789 }
790
791 fn execute_block(block: <Block as BlockT>::LazyBlock) {
792 Executive::execute_block(block)
793 }
794
795 fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
796 Executive::initialize_block(header)
797 }
798 }
799
800 impl sp_api::Metadata<Block> for Runtime {
801 fn metadata() -> OpaqueMetadata {
802 OpaqueMetadata::new(Runtime::metadata().into())
803 }
804
805 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
806 Runtime::metadata_at_version(version)
807 }
808
809 fn metadata_versions() -> alloc::vec::Vec<u32> {
810 Runtime::metadata_versions()
811 }
812 }
813
814 impl sp_block_builder::BlockBuilder<Block> for Runtime {
815 fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
816 Executive::apply_extrinsic(extrinsic)
817 }
818
819 fn finalize_block() -> <Block as BlockT>::Header {
820 Executive::finalize_block()
821 }
822
823 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
824 data.create_extrinsics()
825 }
826
827 fn check_inherents(
828 block: <Block as BlockT>::LazyBlock,
829 data: sp_inherents::InherentData,
830 ) -> sp_inherents::CheckInherentsResult {
831 data.check_extrinsics(&block)
832 }
833 }
834
835 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
836 fn validate_transaction(
837 source: TransactionSource,
838 tx: <Block as BlockT>::Extrinsic,
839 block_hash: <Block as BlockT>::Hash,
840 ) -> TransactionValidity {
841 Executive::validate_transaction(source, tx, block_hash)
842 }
843 }
844
845 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
846 fn offchain_worker(header: &<Block as BlockT>::Header) {
847 Executive::offchain_worker(header)
848 }
849 }
850
851 impl sp_session::SessionKeys<Block> for Runtime {
852 fn generate_session_keys(owner: Vec<u8>, seed: Option<Vec<u8>>) -> OpaqueGeneratedSessionKeys {
853 SessionKeys::generate(&owner, seed).into()
854 }
855
856 fn decode_session_keys(
857 encoded: Vec<u8>,
858 ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {
859 SessionKeys::decode_into_raw_public_keys(&encoded)
860 }
861 }
862
863 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
864 fn account_nonce(account: AccountId) -> Nonce {
865 System::account_nonce(account)
866 }
867 }
868
869 impl pallet_broker::runtime_api::BrokerApi<Block, Balance> for Runtime {
870 fn sale_price() -> Result<Balance, DispatchError> {
871 Broker::current_price()
872 }
873 }
874
875 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
876 fn query_info(
877 uxt: <Block as BlockT>::Extrinsic,
878 len: u32,
879 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
880 TransactionPayment::query_info(uxt, len)
881 }
882 fn query_fee_details(
883 uxt: <Block as BlockT>::Extrinsic,
884 len: u32,
885 ) -> pallet_transaction_payment::FeeDetails<Balance> {
886 TransactionPayment::query_fee_details(uxt, len)
887 }
888 fn query_weight_to_fee(weight: Weight) -> Balance {
889 TransactionPayment::weight_to_fee(weight)
890 }
891 fn query_length_to_fee(length: u32) -> Balance {
892 TransactionPayment::length_to_fee(length)
893 }
894 }
895
896 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
897 for Runtime
898 {
899 fn query_call_info(
900 call: RuntimeCall,
901 len: u32,
902 ) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
903 TransactionPayment::query_call_info(call, len)
904 }
905 fn query_call_fee_details(
906 call: RuntimeCall,
907 len: u32,
908 ) -> pallet_transaction_payment::FeeDetails<Balance> {
909 TransactionPayment::query_call_fee_details(call, len)
910 }
911 fn query_weight_to_fee(weight: Weight) -> Balance {
912 TransactionPayment::weight_to_fee(weight)
913 }
914 fn query_length_to_fee(length: u32) -> Balance {
915 TransactionPayment::length_to_fee(length)
916 }
917 }
918
919 impl xcm_runtime_apis::fees::XcmPaymentApi<Block> for Runtime {
920 fn query_acceptable_payment_assets(xcm_version: xcm::Version) -> Result<Vec<VersionedAssetId>, XcmPaymentApiError> {
921 let acceptable_assets = vec![AssetId(xcm_config::TokenRelayLocation::get())];
922 PolkadotXcm::query_acceptable_payment_assets(xcm_version, acceptable_assets)
923 }
924
925 fn query_weight_to_asset_fee(weight: Weight, asset: VersionedAssetId) -> Result<u128, XcmPaymentApiError> {
926 type Trader = <XcmConfig as xcm_executor::Config>::Trader;
927 PolkadotXcm::query_weight_to_asset_fee::<Trader>(weight, asset)
928 }
929
930 fn query_xcm_weight(message: VersionedXcm<()>) -> Result<Weight, XcmPaymentApiError> {
931 PolkadotXcm::query_xcm_weight(message)
932 }
933
934 fn query_delivery_fees(destination: VersionedLocation, message: VersionedXcm<()>, asset_id: VersionedAssetId) -> Result<VersionedAssets, XcmPaymentApiError> {
935 type AssetExchanger = <XcmConfig as xcm_executor::Config>::AssetExchanger;
936 PolkadotXcm::query_delivery_fees::<AssetExchanger>(destination, message, asset_id)
937 }
938 }
939
940 impl xcm_runtime_apis::dry_run::DryRunApi<Block, RuntimeCall, RuntimeEvent, OriginCaller> for Runtime {
941 fn dry_run_call(origin: OriginCaller, call: RuntimeCall, result_xcms_version: XcmVersion) -> Result<CallDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
942 PolkadotXcm::dry_run_call::<Runtime, xcm_config::XcmRouter, OriginCaller, RuntimeCall>(origin, call, result_xcms_version)
943 }
944
945 fn dry_run_xcm(origin_location: VersionedLocation, xcm: VersionedXcm<RuntimeCall>) -> Result<XcmDryRunEffects<RuntimeEvent>, XcmDryRunApiError> {
946 PolkadotXcm::dry_run_xcm::<xcm_config::XcmRouter>(origin_location, xcm)
947 }
948 }
949
950 impl xcm_runtime_apis::conversions::LocationToAccountApi<Block, AccountId> for Runtime {
951 fn convert_location(location: VersionedLocation) -> Result<
952 AccountId,
953 xcm_runtime_apis::conversions::Error
954 > {
955 xcm_runtime_apis::conversions::LocationToAccountHelper::<
956 AccountId,
957 xcm_config::LocationToAccountId,
958 >::convert_location(location)
959 }
960 }
961
962 impl xcm_runtime_apis::trusted_query::TrustedQueryApi<Block> for Runtime {
963 fn is_trusted_reserve(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
964 PolkadotXcm::is_trusted_reserve(asset, location)
965 }
966 fn is_trusted_teleporter(asset: VersionedAsset, location: VersionedLocation) -> xcm_runtime_apis::trusted_query::XcmTrustedQueryResult {
967 PolkadotXcm::is_trusted_teleporter(asset, location)
968 }
969 }
970
971 impl xcm_runtime_apis::authorized_aliases::AuthorizedAliasersApi<Block> for Runtime {
972 fn authorized_aliasers(target: VersionedLocation) -> Result<
973 Vec<xcm_runtime_apis::authorized_aliases::OriginAliaser>,
974 xcm_runtime_apis::authorized_aliases::Error
975 > {
976 PolkadotXcm::authorized_aliasers(target)
977 }
978 fn is_authorized_alias(origin: VersionedLocation, target: VersionedLocation) -> Result<
979 bool,
980 xcm_runtime_apis::authorized_aliases::Error
981 > {
982 PolkadotXcm::is_authorized_alias(origin, target)
983 }
984 }
985
986 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
987 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
988 ParachainSystem::collect_collation_info(header)
989 }
990 }
991
992 #[cfg(feature = "try-runtime")]
993 impl frame_try_runtime::TryRuntime<Block> for Runtime {
994 fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
995 let weight = Executive::try_runtime_upgrade(checks).unwrap();
996 (weight, RuntimeBlockWeights::get().max_block)
997 }
998
999 fn execute_block(
1000 block: <Block as BlockT>::LazyBlock,
1001 state_root_check: bool,
1002 signature_check: bool,
1003 select: frame_try_runtime::TryStateSelect,
1004 ) -> Weight {
1005 Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap()
1008 }
1009 }
1010
1011 #[cfg(feature = "runtime-benchmarks")]
1012 impl frame_benchmarking::Benchmark<Block> for Runtime {
1013 fn benchmark_metadata(extra: bool) -> (
1014 Vec<frame_benchmarking::BenchmarkList>,
1015 Vec<frame_support::traits::StorageInfo>,
1016 ) {
1017 use frame_benchmarking::BenchmarkList;
1018 use frame_support::traits::StorageInfoTrait;
1019 use frame_system_benchmarking::Pallet as SystemBench;
1020 use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
1021 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
1022
1023 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1027 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1028
1029 let mut list = Vec::<BenchmarkList>::new();
1030 list_benchmarks!(list, extra);
1031
1032 let storage_info = AllPalletsWithSystem::storage_info();
1033 (list, storage_info)
1034 }
1035
1036 #[allow(non_local_definitions)]
1037 fn dispatch_benchmark(
1038 config: frame_benchmarking::BenchmarkConfig
1039 ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
1040 use frame_benchmarking::{BenchmarkBatch, BenchmarkError};
1041 use sp_storage::TrackedStorageKey;
1042 use codec::Encode;
1043
1044 use frame_system_benchmarking::Pallet as SystemBench;
1045 impl frame_system_benchmarking::Config for Runtime {
1046 fn setup_set_code_requirements(code: &alloc::vec::Vec<u8>) -> Result<(), BenchmarkError> {
1047 ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
1048 Ok(())
1049 }
1050
1051 fn verify_set_code() {
1052 System::assert_last_event(cumulus_pallet_parachain_system::Event::<Runtime>::ValidationFunctionStored.into());
1053 }
1054 }
1055
1056 use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
1057 impl cumulus_pallet_session_benchmarking::Config for Runtime {
1058 fn generate_session_keys_and_proof(owner: Self::AccountId) -> (Self::Keys, Vec<u8>) {
1059 let keys = SessionKeys::generate(&owner.encode(), None);
1060 (keys.keys, keys.proof.encode())
1061 }
1062 }
1063
1064 use xcm::latest::prelude::*;
1065 use xcm_config::TokenRelayLocation;
1066 use testnet_parachains_constants::westend::locations::{AssetHubParaId, AssetHubLocation};
1067
1068 use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
1069 impl pallet_xcm::benchmarking::Config for Runtime {
1070 type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1071 xcm_config::XcmConfig,
1072 ExistentialDepositAsset,
1073 PriceForSiblingParachainDelivery,
1074 AssetHubParaId,
1075 ParachainSystem,
1076 >;
1077
1078 fn reachable_dest() -> Option<Location> {
1079 Some(AssetHubLocation::get())
1080 }
1081
1082 fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
1083 Some((
1085 Asset {
1086 fun: Fungible(ExistentialDeposit::get()),
1087 id: AssetId(TokenRelayLocation::get())
1088 },
1089 AssetHubLocation::get(),
1090 ))
1091 }
1092
1093 fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
1094 let core = 0;
1098 let begin = 0;
1099 let end = 42;
1100
1101 let region_id = pallet_broker::Pallet::<Runtime>::issue(core, begin, pallet_broker::CoreMask::complete(), end, None, None);
1102 Some((
1103 Asset {
1104 fun: NonFungible(Index(region_id.into())),
1105 id: AssetId(xcm_config::BrokerPalletLocation::get())
1106 },
1107 AssetHubLocation::get(),
1108 ))
1109 }
1110
1111 fn set_up_complex_asset_transfer() -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> {
1112 let native_location = Parent.into();
1113 let dest = AssetHubLocation::get();
1114
1115 pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
1116 native_location,
1117 dest,
1118 )
1119 }
1120
1121 fn get_asset() -> Asset {
1122 Asset {
1123 id: AssetId(TokenRelayLocation::get()),
1124 fun: Fungible(ExistentialDeposit::get()),
1125 }
1126 }
1127
1128 fn get_assets(n: u32) -> Assets {
1129 let regions: Vec<Asset> = (0..n)
1132 .map(|i| {
1133 let region_id = pallet_broker::Pallet::<Runtime>::issue(
1134 i as pallet_broker::CoreIndex,
1135 0,
1136 pallet_broker::CoreMask::complete(),
1137 42,
1138 None,
1139 None,
1140 );
1141 Asset {
1142 fun: NonFungible(Index(region_id.into())),
1143 id: AssetId(xcm_config::BrokerPalletLocation::get()),
1144 }
1145 })
1146 .collect();
1147 regions.into()
1148 }
1149
1150 fn batch_call(calls: Vec<RuntimeCall>) -> Option<RuntimeCall> {
1151 Some(RuntimeCall::Utility(pallet_utility::Call::batch { calls }))
1152 }
1153 }
1154
1155 parameter_types! {
1156 pub ExistentialDepositAsset: Option<Asset> = Some((
1157 TokenRelayLocation::get(),
1158 ExistentialDeposit::get()
1159 ).into());
1160 }
1161
1162 impl pallet_xcm_benchmarks::Config for Runtime {
1163 type XcmConfig = xcm_config::XcmConfig;
1164
1165 type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper<
1166 xcm_config::XcmConfig,
1167 ExistentialDepositAsset,
1168 PriceForSiblingParachainDelivery,
1169 AssetHubParaId,
1170 ParachainSystem,
1171 >;
1172
1173 type AccountIdConverter = xcm_config::LocationToAccountId;
1174 fn valid_destination() -> Result<Location, BenchmarkError> {
1175 Ok(AssetHubLocation::get())
1176 }
1177 fn worst_case_holding(_depositable_count: u32) -> xcm_executor::AssetsInHolding {
1178 use pallet_xcm_benchmarks::MockCredit;
1179 let mut holding = xcm_executor::AssetsInHolding::new();
1181 holding.fungible.insert(
1182 AssetId(TokenRelayLocation::get()),
1183 alloc::boxed::Box::new(MockCredit(1_000_000 * UNITS)),
1184 );
1185 holding
1186 }
1187 }
1188
1189 parameter_types! {
1190 pub TrustedTeleporter: Option<(Location, Asset)> = Some((
1191 AssetHubLocation::get(),
1192 Asset { fun: Fungible(UNITS), id: AssetId(TokenRelayLocation::get()) },
1193 ));
1194 pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
1195 pub const TrustedReserve: Option<(Location, Asset)> = None;
1196 }
1197
1198 impl pallet_xcm_benchmarks::fungible::Config for Runtime {
1199 type TransactAsset = Balances;
1200
1201 type CheckedAccount = CheckedAccount;
1202 type TrustedTeleporter = TrustedTeleporter;
1203 type TrustedReserve = TrustedReserve;
1204
1205 fn get_asset() -> Asset {
1206 Asset {
1207 id: AssetId(TokenRelayLocation::get()),
1208 fun: Fungible(UNITS),
1209 }
1210 }
1211 }
1212
1213 impl pallet_xcm_benchmarks::generic::Config for Runtime {
1214 type RuntimeCall = RuntimeCall;
1215 type TransactAsset = Balances;
1216
1217 fn worst_case_response() -> (u64, Response) {
1218 (0u64, Response::Version(Default::default()))
1219 }
1220
1221 fn worst_case_asset_exchange() -> Result<(Assets, Assets), BenchmarkError> {
1222 Err(BenchmarkError::Skip)
1223 }
1224
1225 fn universal_alias() -> Result<(Location, Junction), BenchmarkError> {
1226 Err(BenchmarkError::Skip)
1227 }
1228
1229 fn transact_origin_and_runtime_call() -> Result<(Location, RuntimeCall), BenchmarkError> {
1230 Ok((AssetHubLocation::get(), frame_system::Call::remark_with_event { remark: vec![] }.into()))
1231 }
1232
1233 fn subscribe_origin() -> Result<Location, BenchmarkError> {
1234 Ok(AssetHubLocation::get())
1235 }
1236
1237 fn claimable_asset() -> Result<(Location, Location, Assets), BenchmarkError> {
1238 let origin = AssetHubLocation::get();
1239 let assets: Assets = (AssetId(TokenRelayLocation::get()), 1_000 * UNITS).into();
1240 let ticket = Location { parents: 0, interior: Here };
1241 Ok((origin, ticket, assets))
1242 }
1243
1244 fn worst_case_for_trader() -> Result<(Asset, WeightLimit), BenchmarkError> {
1245 Ok((Asset {
1246 id: AssetId(TokenRelayLocation::get()),
1247 fun: Fungible(1_000_000 * UNITS),
1248 }, WeightLimit::Limited(Weight::from_parts(5000, 5000))))
1249 }
1250
1251 fn unlockable_asset() -> Result<(Location, Location, Asset), BenchmarkError> {
1252 Err(BenchmarkError::Skip)
1253 }
1254
1255 fn export_message_origin_and_destination(
1256 ) -> Result<(Location, NetworkId, InteriorLocation), BenchmarkError> {
1257 Err(BenchmarkError::Skip)
1258 }
1259
1260 fn alias_origin() -> Result<(Location, Location), BenchmarkError> {
1261 use parachains_common::benchmarking::set_up_worst_case_authorized_alias;
1262
1263 Ok(set_up_worst_case_authorized_alias::<Runtime>())
1267 }
1268 }
1269
1270 type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
1271 type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
1272
1273 use frame_support::traits::WhitelistedStorageKeys;
1274 let whitelist: Vec<TrackedStorageKey> = AllPalletsWithSystem::whitelisted_storage_keys();
1275
1276 let mut batches = Vec::<BenchmarkBatch>::new();
1277 let params = (&config, &whitelist);
1278 add_benchmarks!(params, batches);
1279
1280 Ok(batches)
1281 }
1282 }
1283
1284 impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
1285 fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
1286 build_state::<RuntimeGenesisConfig>(config)
1287 }
1288
1289 fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
1290 get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
1291 }
1292
1293 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
1294 genesis_config_presets::preset_names()
1295 }
1296 }
1297
1298 impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
1299 fn parachain_id() -> ParaId {
1300 ParachainInfo::parachain_id()
1301 }
1302 }
1303
1304 impl cumulus_primitives_core::TargetBlockRate<Block> for Runtime {
1305 fn target_block_rate() -> u32 {
1306 BLOCK_PROCESSING_VELOCITY
1307 }
1308 }
1309}
1310
1311cumulus_pallet_parachain_system::register_validate_block! {
1312 Runtime = Runtime,
1313 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
1314}