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