polkadot_sdk_docs/polkadot_sdk/
cumulus.rs1#![doc = docify::embed!("./src/polkadot_sdk/cumulus.rs", system_pallets)]
24#![doc = docify::embed!("./src/polkadot_sdk/cumulus.rs", consensus_pallets)]
32#![doc = docify::embed!("./src/polkadot_sdk/cumulus.rs", validate_block)]
40#![deny(rustdoc::broken_intra_doc_links)]
46#![deny(rustdoc::private_intra_doc_links)]
47
48#[cfg(test)]
49mod tests {
50	mod runtime {
51		pub use frame::{
52			deps::sp_consensus_aura::sr25519::AuthorityId as AuraId, prelude::*,
53			runtime::prelude::*, testing_prelude::*,
54		};
55
56		#[docify::export(CR)]
57		construct_runtime!(
58			pub enum Runtime {
59				System: frame_system,
61				Timestamp: pallet_timestamp,
62				ParachainSystem: cumulus_pallet_parachain_system,
63				ParachainInfo: parachain_info,
64
65				Aura: pallet_aura,
67				AuraExt: cumulus_pallet_aura_ext,
68			}
69		);
70
71		#[docify::export]
72		mod system_pallets {
73			use super::*;
74
75			#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
76			impl frame_system::Config for Runtime {
77				type Block = MockBlock<Self>;
78				type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
79			}
80
81			impl cumulus_pallet_parachain_system::Config for Runtime {
82				type RuntimeEvent = RuntimeEvent;
83				type OnSystemEvent = ();
84				type SelfParaId = parachain_info::Pallet<Runtime>;
85				type OutboundXcmpMessageSource = ();
86				type XcmpMessageHandler = ();
87				type ReservedDmpWeight = ();
88				type ReservedXcmpWeight = ();
89				type CheckAssociatedRelayNumber =
90					cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
91				type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
92					Runtime,
93					6000, 1,
95					1,
96				>;
97				type WeightInfo = ();
98				type DmpQueue = frame::traits::EnqueueWithOrigin<(), sp_core::ConstU8<0>>;
99				type RelayParentOffset = ConstU32<0>;
100			}
101
102			impl parachain_info::Config for Runtime {}
103		}
104
105		#[docify::export]
106		mod consensus_pallets {
107			use super::*;
108
109			impl pallet_aura::Config for Runtime {
110				type AuthorityId = AuraId;
111				type DisabledValidators = ();
112				type MaxAuthorities = ConstU32<100_000>;
113				type AllowMultipleBlocksPerSlot = ConstBool<false>;
114				type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
115			}
116
117			#[docify::export(timestamp)]
118			#[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)]
119			impl pallet_timestamp::Config for Runtime {}
120
121			impl cumulus_pallet_aura_ext::Config for Runtime {}
122		}
123
124		#[docify::export(validate_block)]
125		cumulus_pallet_parachain_system::register_validate_block! {
126			Runtime = Runtime,
127			BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,
128		}
129	}
130}