1#![cfg_attr(not(feature = "std"), no_std)]
18#![recursion_limit = "256"]
20
21#[cfg(feature = "std")]
23include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
24
25extern crate alloc;
26
27mod genesis_config_presets;
28mod xcm_config;
29
30use crate::xcm_config::XcmOriginToTransactDispatchOrigin;
31use cumulus_primitives_core::ParaId;
32use parachains_common::message_queue::{NarrowOriginToSibling, ParaIdToSibling};
33use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
34
35use alloc::{borrow::Cow, vec, vec::Vec};
36use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
37use frame_support::weights::{constants, FixedFee, RuntimeDbWeight};
38use sp_api::impl_runtime_apis;
39use sp_core::OpaqueMetadata;
40use sp_runtime::{
41 generic, impl_opaque_keys,
42 traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, Hash as HashT},
43 transaction_validity::{TransactionSource, TransactionValidity},
44 ApplyExtrinsicResult, MultiSignature, MultiSigner,
45};
46#[cfg(feature = "std")]
47use sp_version::NativeVersion;
48use sp_version::RuntimeVersion;
49
50pub use frame_support::{
52 construct_runtime, derive_impl,
53 dispatch::DispatchClass,
54 genesis_builder_helper::{build_state, get_preset},
55 parameter_types,
56 traits::{
57 AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse,
58 Everything, HandleMessage, IsInVec, Nothing, QueueFootprint, Randomness, TransformOrigin,
59 },
60 weights::{
61 constants::{BlockExecutionWeight, WEIGHT_REF_TIME_PER_SECOND},
62 ConstantMultiplier, IdentityFee, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
63 WeightToFeePolynomial,
64 },
65 BoundedSlice, StorageValue,
66};
67use frame_system::{
68 limits::{BlockLength, BlockWeights},
69 EnsureRoot,
70};
71pub use pallet_balances::Call as BalancesCall;
72pub use pallet_timestamp::Call as TimestampCall;
73pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
74#[cfg(any(feature = "std", test))]
75pub use sp_runtime::BuildStorage;
76pub use sp_runtime::{Perbill, Permill};
77
78use cumulus_primitives_core::AggregateMessageOrigin; use parachains_common::{AccountId, Signature};
80
81pub type SessionHandlers = ();
82
83impl_opaque_keys! {
84 pub struct SessionKeys {
85 pub aura: Aura,
86 }
87}
88
89#[sp_version::runtime_version]
91pub const VERSION: RuntimeVersion = RuntimeVersion {
92 spec_name: Cow::Borrowed("yet-another-parachain"),
93 impl_name: Cow::Borrowed("yet-another-parachain"),
94 authoring_version: 1,
95 spec_version: 1_002_000,
96 impl_version: 0,
97 apis: RUNTIME_API_VERSIONS,
98 transaction_version: 6,
99 system_version: 1,
100};
101
102pub const MILLISECS_PER_BLOCK: u64 = 2000;
103
104pub const SLOT_DURATION: u64 = 3 * MILLISECS_PER_BLOCK;
105
106pub const EPOCH_DURATION_IN_BLOCKS: u32 = 10 * MINUTES;
107
108pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
110pub const HOURS: BlockNumber = MINUTES * 60;
111pub const DAYS: BlockNumber = HOURS * 24;
112
113pub const YAP: Balance = 1_000_000_000_000;
114pub const NANOYAP: Balance = 1_000;
115
116#[cfg(feature = "std")]
118pub fn native_version() -> NativeVersion {
119 NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
120}
121
122const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
125const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(95);
128const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
130 WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
131 cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
132);
133
134const UNINCLUDED_SEGMENT_CAPACITY: u32 = 10;
137
138const RELAY_PARENT_OFFSET: u32 = 1;
140
141const BLOCK_PROCESSING_VELOCITY: u32 = 3;
144const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
146
147parameter_types! {
148 pub const BlockHashCount: BlockNumber = 250;
149 pub const Version: RuntimeVersion = VERSION;
150 pub RuntimeBlockLength: BlockLength =
151 BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
152 pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder()
153 .base_block(BlockExecutionWeight::get())
154 .for_class(DispatchClass::all(), |weights| {
155 weights.base_extrinsic = <pallet_verify_signature::weights::SubstrateWeight::<Runtime> as pallet_verify_signature::WeightInfo>::verify_signature();
156 })
157 .for_class(DispatchClass::Normal, |weights| {
158 weights.max_total = Some(NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT);
159 })
160 .for_class(DispatchClass::Operational, |weights| {
161 weights.max_total = Some(MAXIMUM_BLOCK_WEIGHT);
162 weights.reserved = Some(
165 MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
166 );
167 })
168 .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO)
169 .build_or_panic();
170 pub const SS58Prefix: u8 = 42;
171 pub const InMemoryDbWeight: RuntimeDbWeight = RuntimeDbWeight {
174 read: 9_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
175 write: 28_000 * constants::WEIGHT_REF_TIME_PER_NANOS,
176 };
177}
178
179#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
180impl frame_system::Config for Runtime {
181 type AccountId = AccountId;
183 type RuntimeCall = RuntimeCall;
185 type Lookup = AccountIdLookup<AccountId, ()>;
187 type Nonce = Nonce;
189 type Hash = Hash;
191 type Hashing = BlakeTwo256;
193 type Block = Block;
195 type RuntimeEvent = RuntimeEvent;
197 type RuntimeOrigin = RuntimeOrigin;
199 type BlockHashCount = BlockHashCount;
201 type Version = Version;
203 type PalletInfo = PalletInfo;
205 type AccountData = pallet_balances::AccountData<Balance>;
206 type OnNewAccount = ();
207 type OnKilledAccount = ();
208 type DbWeight = InMemoryDbWeight;
209 type BaseCallFilter = frame_support::traits::Everything;
210 type SystemWeightInfo = frame_system::weights::SubstrateWeight<Self>;
211 type ExtensionsWeightInfo = frame_system::SubstrateExtensionsWeight<Self>;
212 type BlockWeights = RuntimeBlockWeights;
213 type BlockLength = RuntimeBlockLength;
214 type SS58Prefix = SS58Prefix;
215 type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
216 type MaxConsumers = frame_support::traits::ConstU32<16>;
217 type SingleBlockMigrations = RemoveCollectiveFlip;
218}
219
220impl cumulus_pallet_weight_reclaim::Config for Runtime {
221 type WeightInfo = ();
222}
223
224impl pallet_timestamp::Config for Runtime {
225 type Moment = u64;
227 type OnTimestampSet = Aura;
228 type MinimumPeriod = ConstU64<0>;
229 type WeightInfo = pallet_timestamp::weights::SubstrateWeight<Self>;
230}
231
232parameter_types! {
233 pub const ExistentialDeposit: u128 = NANOYAP;
234 pub const TransactionByteFee: u128 = NANOYAP;
235}
236
237impl pallet_balances::Config for Runtime {
238 type Balance = Balance;
240 type DustRemoval = ();
241 type RuntimeEvent = RuntimeEvent;
243 type ExistentialDeposit = ExistentialDeposit;
244 type AccountStore = System;
245 type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
246 type MaxLocks = ConstU32<50>;
247 type MaxReserves = ConstU32<50>;
248 type ReserveIdentifier = [u8; 8];
249 type RuntimeHoldReason = RuntimeHoldReason;
250 type RuntimeFreezeReason = RuntimeFreezeReason;
251 type FreezeIdentifier = ();
252 type MaxFreezes = ConstU32<0>;
253 type DoneSlashHandler = ();
254}
255
256impl pallet_transaction_payment::Config for Runtime {
257 type RuntimeEvent = RuntimeEvent;
258 type OnChargeTransaction = pallet_transaction_payment::FungibleAdapter<Balances, ()>;
259 type WeightToFee = FixedFee<1, <Self as pallet_balances::Config>::Balance>;
260 type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
261 type FeeMultiplierUpdate = ();
262 type OperationalFeeMultiplier = ConstU8<5>;
263 type WeightInfo = pallet_transaction_payment::weights::SubstrateWeight<Self>;
264}
265
266impl pallet_sudo::Config for Runtime {
267 type RuntimeCall = RuntimeCall;
268 type RuntimeEvent = RuntimeEvent;
269 type WeightInfo = pallet_sudo::weights::SubstrateWeight<Runtime>;
270}
271
272parameter_types! {
273 pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
274 pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);
275 pub const RelayOrigin: AggregateMessageOrigin = AggregateMessageOrigin::Parent;
276}
277
278type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
279 Runtime,
280 RELAY_CHAIN_SLOT_DURATION_MILLIS,
281 BLOCK_PROCESSING_VELOCITY,
282 UNINCLUDED_SEGMENT_CAPACITY,
283>;
284
285pub struct DmpSink;
286impl HandleMessage for DmpSink {
287 type MaxMessageLen = ConstU32<16>;
288
289 fn handle_message(_msg: BoundedSlice<u8, Self::MaxMessageLen>) {}
290
291 fn handle_messages<'a>(_: impl Iterator<Item = BoundedSlice<'a, u8, Self::MaxMessageLen>>) {
292 unimplemented!()
293 }
294
295 fn sweep_queue() {
296 unimplemented!()
297 }
298}
299
300impl cumulus_pallet_parachain_system::Config for Runtime {
301 type WeightInfo = cumulus_pallet_parachain_system::weights::SubstrateWeight<Self>;
302 type RuntimeEvent = RuntimeEvent;
303 type OnSystemEvent = ();
304 type SelfParaId = parachain_info::Pallet<Runtime>;
305 type OutboundXcmpMessageSource = XcmpQueue;
306 type DmpQueue = frame_support::traits::EnqueueWithOrigin<MessageQueue, RelayOrigin>;
307 type ReservedDmpWeight = ReservedDmpWeight;
308 type XcmpMessageHandler = XcmpQueue;
309 type ReservedXcmpWeight = ReservedXcmpWeight;
310 type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
311 type ConsensusHook = ConsensusHook;
312 type RelayParentOffset = ConstU32<RELAY_PARENT_OFFSET>;
313}
314
315impl pallet_message_queue::Config for Runtime {
316 type RuntimeEvent = RuntimeEvent;
317 type WeightInfo = ();
318 type MessageProcessor = xcm_builder::ProcessXcmMessage<
319 AggregateMessageOrigin,
320 xcm_executor::XcmExecutor<xcm_config::XcmConfig>,
321 RuntimeCall,
322 >;
323 type Size = u32;
324 type QueueChangeHandler = NarrowOriginToSibling<XcmpQueue>;
326 type QueuePausedQuery = NarrowOriginToSibling<XcmpQueue>;
327 type HeapSize = sp_core::ConstU32<{ 103 * 1024 }>;
328 type MaxStale = sp_core::ConstU32<8>;
329 type ServiceWeight = MessageQueueServiceWeight;
330 type IdleMaxServiceWeight = ();
331}
332parameter_types! {
333 pub MessageQueueServiceWeight: Weight = Perbill::from_percent(35) * RuntimeBlockWeights::get().max_block;
334}
335
336impl pallet_authorship::Config for Runtime {
337 type FindAuthor = ();
338 type EventHandler = ();
339}
340
341pub struct WeightToFee;
342impl WeightToFeePolynomial for WeightToFee {
343 type Balance = Balance;
344 fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
345 let p = YAP / 10;
348 let q = 100 *
349 Balance::from(
350 frame_support::weights::constants::ExtrinsicBaseWeight::get().ref_time(),
351 );
352 vec![WeightToFeeCoefficient {
353 degree: 1,
354 negative: false,
355 coeff_frac: Perbill::from_rational(p % q, q),
356 coeff_integer: p / q,
357 }]
358 .into()
359 }
360}
361
362impl cumulus_pallet_xcmp_queue::Config for Runtime {
363 type RuntimeEvent = RuntimeEvent;
364 type ChannelInfo = ParachainSystem;
365 type VersionWrapper = ();
366 type XcmpQueue = TransformOrigin<MessageQueue, AggregateMessageOrigin, ParaId, ParaIdToSibling>;
368 type MaxInboundSuspended = sp_core::ConstU32<1_000>;
369 type MaxActiveOutboundChannels = ConstU32<128>;
370 type MaxPageSize = ConstU32<{ 1 << 16 }>;
371 type ControllerOrigin = EnsureRoot<AccountId>;
372 type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
373 type WeightInfo = ();
374 type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
375}
376
377impl parachain_info::Config for Runtime {}
378
379impl cumulus_pallet_aura_ext::Config for Runtime {}
380
381impl pallet_aura::Config for Runtime {
382 type AuthorityId = AuraId;
383 type DisabledValidators = ();
384 type MaxAuthorities = ConstU32<100_000>;
385 type AllowMultipleBlocksPerSlot = ConstBool<true>;
386 type SlotDuration = ConstU64<SLOT_DURATION>;
387}
388
389impl pallet_utility::Config for Runtime {
390 type RuntimeEvent = RuntimeEvent;
391 type RuntimeCall = RuntimeCall;
392 type PalletsOrigin = OriginCaller;
393 type WeightInfo = ();
394}
395
396#[cfg(feature = "runtime-benchmarks")]
397pub struct VerifySignatureBenchmarkHelper;
398#[cfg(feature = "runtime-benchmarks")]
399impl pallet_verify_signature::BenchmarkHelper<MultiSignature, AccountId>
400 for VerifySignatureBenchmarkHelper
401{
402 fn create_signature(_entropy: &[u8], msg: &[u8]) -> (MultiSignature, AccountId) {
403 use sp_io::crypto::{sr25519_generate, sr25519_sign};
404 use sp_runtime::traits::IdentifyAccount;
405 let public = sr25519_generate(0.into(), None);
406 let who_account: AccountId = MultiSigner::Sr25519(public).into_account().into();
407 let signature = MultiSignature::Sr25519(sr25519_sign(0.into(), &public, msg).unwrap());
408 (signature, who_account)
409 }
410}
411
412impl pallet_verify_signature::Config for Runtime {
413 type Signature = MultiSignature;
414 type AccountIdentifier = MultiSigner;
415 type WeightInfo = pallet_verify_signature::weights::SubstrateWeight<Runtime>;
416 #[cfg(feature = "runtime-benchmarks")]
417 type BenchmarkHelper = VerifySignatureBenchmarkHelper;
418}
419
420construct_runtime! {
421 pub enum Runtime
422 {
423 System: frame_system,
424 Timestamp: pallet_timestamp,
425 Sudo: pallet_sudo,
426 TransactionPayment: pallet_transaction_payment,
427 WeightReclaim: cumulus_pallet_weight_reclaim,
428
429 ParachainSystem: cumulus_pallet_parachain_system = 20,
430 ParachainInfo: parachain_info = 21,
431
432 Balances: pallet_balances = 30,
433
434 Aura: pallet_aura = 31,
435 AuraExt: cumulus_pallet_aura_ext = 32,
436
437 Utility: pallet_utility = 40,
438 VerifySignature: pallet_verify_signature = 41,
439
440 XcmpQueue: cumulus_pallet_xcmp_queue = 51,
442 PolkadotXcm: pallet_xcm = 52,
443 CumulusXcm: cumulus_pallet_xcm = 53,
444 MessageQueue: pallet_message_queue = 54,
445 }
446}
447
448pub type Balance = u128;
450pub type Nonce = u32;
452pub type Hash = <BlakeTwo256 as HashT>::Output;
454pub type BlockNumber = u32;
456pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
458pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
460pub type Block = generic::Block<Header, UncheckedExtrinsic>;
462pub type SignedBlock = generic::SignedBlock<Block>;
464pub type BlockId = generic::BlockId<Block>;
466pub type TxExtension = cumulus_pallet_weight_reclaim::StorageWeightReclaim<
468 Runtime,
469 (
470 frame_system::CheckNonZeroSender<Runtime>,
473 frame_system::CheckSpecVersion<Runtime>,
474 frame_system::CheckTxVersion<Runtime>,
475 frame_system::CheckGenesis<Runtime>,
476 frame_system::CheckEra<Runtime>,
477 frame_system::CheckNonce<Runtime>,
478 frame_system::CheckWeight<Runtime>,
479 pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
480 ),
481>;
482pub type UncheckedExtrinsic =
484 generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, TxExtension>;
485pub type Executive = frame_executive::Executive<
487 Runtime,
488 Block,
489 frame_system::ChainContext<Runtime>,
490 Runtime,
491 AllPalletsWithSystem,
492>;
493
494pub struct RemoveCollectiveFlip;
495impl frame_support::traits::OnRuntimeUpgrade for RemoveCollectiveFlip {
496 fn on_runtime_upgrade() -> Weight {
497 use frame_support::storage::migration;
498 #[allow(deprecated)]
500 migration::remove_storage_prefix(b"RandomnessCollectiveFlip", b"RandomMaterial", b"");
501 <Runtime as frame_system::Config>::DbWeight::get().writes(1)
502 }
503}
504
505impl_runtime_apis! {
506 impl sp_api::Core<Block> for Runtime {
507 fn version() -> RuntimeVersion {
508 VERSION
509 }
510
511 fn execute_block(block: Block) {
512 Executive::execute_block(block);
513 }
514
515 fn initialize_block(header: &<Block as BlockT>::Header) -> sp_runtime::ExtrinsicInclusionMode {
516 Executive::initialize_block(header)
517 }
518 }
519
520 impl sp_api::Metadata<Block> for Runtime {
521 fn metadata() -> OpaqueMetadata {
522 OpaqueMetadata::new(Runtime::metadata().into())
523 }
524
525 fn metadata_at_version(version: u32) -> Option<OpaqueMetadata> {
526 Runtime::metadata_at_version(version)
527 }
528
529 fn metadata_versions() -> alloc::vec::Vec<u32> {
530 Runtime::metadata_versions()
531 }
532 }
533
534 impl sp_block_builder::BlockBuilder<Block> for Runtime {
535 fn apply_extrinsic(
536 extrinsic: <Block as BlockT>::Extrinsic,
537 ) -> ApplyExtrinsicResult {
538 Executive::apply_extrinsic(extrinsic)
539 }
540
541 fn finalize_block() -> <Block as BlockT>::Header {
542 Executive::finalize_block()
543 }
544
545 fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {
546 data.create_extrinsics()
547 }
548
549 fn check_inherents(block: Block, data: sp_inherents::InherentData) -> sp_inherents::CheckInherentsResult {
550 data.check_extrinsics(&block)
551 }
552 }
553
554 impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
555 fn validate_transaction(
556 source: TransactionSource,
557 tx: <Block as BlockT>::Extrinsic,
558 block_hash: <Block as BlockT>::Hash,
559 ) -> TransactionValidity {
560 Executive::validate_transaction(source, tx, block_hash)
561 }
562 }
563
564 impl sp_offchain::OffchainWorkerApi<Block> for Runtime {
565 fn offchain_worker(header: &<Block as BlockT>::Header) {
566 Executive::offchain_worker(header)
567 }
568 }
569
570 impl sp_session::SessionKeys<Block> for Runtime {
571 fn decode_session_keys(
572 encoded: Vec<u8>,
573 ) -> Option<Vec<(Vec<u8>, sp_core::crypto::KeyTypeId)>> {
574 SessionKeys::decode_into_raw_public_keys(&encoded)
575 }
576
577 fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {
578 SessionKeys::generate(seed)
579 }
580 }
581
582 impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
583 fn slot_duration() -> sp_consensus_aura::SlotDuration {
584 sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
585 }
586
587 fn authorities() -> Vec<AuraId> {
588 pallet_aura::Authorities::<Runtime>::get().into_inner()
589 }
590 }
591
592 impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
593 fn account_nonce(account: AccountId) -> Nonce {
594 System::account_nonce(account)
595 }
596 }
597
598 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
599 fn query_info(
600 uxt: <Block as BlockT>::Extrinsic,
601 len: u32,
602 ) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
603 TransactionPayment::query_info(uxt, len)
604 }
605 fn query_fee_details(
606 uxt: <Block as BlockT>::Extrinsic,
607 len: u32,
608 ) -> pallet_transaction_payment::FeeDetails<Balance> {
609 TransactionPayment::query_fee_details(uxt, len)
610 }
611 fn query_weight_to_fee(weight: Weight) -> Balance {
612 TransactionPayment::weight_to_fee(weight)
613 }
614 fn query_length_to_fee(length: u32) -> Balance {
615 TransactionPayment::length_to_fee(length)
616 }
617 }
618
619 impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
620 for Runtime
621 {
622 fn query_call_info(
623 call: RuntimeCall,
624 len: u32,
625 ) -> pallet_transaction_payment::RuntimeDispatchInfo<Balance> {
626 TransactionPayment::query_call_info(call, len)
627 }
628 fn query_call_fee_details(
629 call: RuntimeCall,
630 len: u32,
631 ) -> pallet_transaction_payment::FeeDetails<Balance> {
632 TransactionPayment::query_call_fee_details(call, len)
633 }
634 fn query_weight_to_fee(weight: Weight) -> Balance {
635 TransactionPayment::weight_to_fee(weight)
636 }
637 fn query_length_to_fee(length: u32) -> Balance {
638 TransactionPayment::length_to_fee(length)
639 }
640 }
641
642 impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
643 fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {
644 ParachainSystem::collect_collation_info(header)
645 }
646 }
647
648 impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
649 fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
650 build_state::<RuntimeGenesisConfig>(config)
651 }
652
653 fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
654 get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
655 }
656
657 fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
658 genesis_config_presets::preset_names()
659 }
660 }
661
662 impl cumulus_primitives_core::RelayParentOffsetApi<Block> for Runtime {
663 fn relay_parent_offset() -> u32 {
664 RELAY_PARENT_OFFSET
665 }
666 }
667
668 impl cumulus_primitives_aura::AuraUnincludedSegmentApi<Block> for Runtime {
669 fn can_build_upon(
670 included_hash: <Block as BlockT>::Hash,
671 slot: cumulus_primitives_aura::Slot,
672 ) -> bool {
673 ConsensusHook::can_build_upon(included_hash, slot)
674 }
675 }
676
677 impl cumulus_primitives_core::GetParachainInfo<Block> for Runtime {
678 fn parachain_id() -> ParaId {
679 ParachainInfo::parachain_id()
680 }
681 }
682}
683
684cumulus_pallet_parachain_system::register_validate_block! {
685 Runtime = Runtime,
686 BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
687}