Expand description

Lean about Cumulus, the framework that transforms substrate-based chains into polkadot-enabled parachains.


Substrate provides a framework (FRAME) through which a blockchain node and runtime can easily be created. Cumulus aims to extend the same approach to creation of Polkadot parachains.

Cumulus clouds are shaped sort of like dots; together they form a system that is intricate, beautiful and functional.

§Example: Runtime

A Cumulus-based runtime is fairly similar to other FRAME-based runtimes. Most notably, the following changes are applied to a normal FRAME-based runtime to make it a Cumulus-based runtime:

§Cumulus Pallets

A parachain runtime should use a number of pallets that are provided by Cumulus and Substrate. Notably:

mod system_pallets {
	use super::*;

	impl frame_system::Config for Runtime {
		type Block = MockBlock<Self>;
		type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;

	impl cumulus_pallet_parachain_system::Config for Runtime {
		type RuntimeEvent = RuntimeEvent;
		type OnSystemEvent = ();
		type SelfParaId = parachain_info::Pallet<Runtime>;
		type OutboundXcmpMessageSource = ();
		type XcmpMessageHandler = ();
		type ReservedDmpWeight = ();
		type ReservedXcmpWeight = ();
		type CheckAssociatedRelayNumber =
		type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
			6000, // relay chain block time
		type WeightInfo = ();
		type DmpQueue = frame::traits::EnqueueWithOrigin<(), sp_core::ConstU8<0>>;

	impl parachain_info::Config for Runtime {}

Given that all Cumulus-based runtimes use a simple Aura-based consensus mechanism, the following pallets also need to be added:

mod consensus_pallets {
	use super::*;

	impl pallet_aura::Config for Runtime {
		type AuthorityId = AuraId;
		type DisabledValidators = ();
		type MaxAuthorities = ConstU32<100_000>;
		type AllowMultipleBlocksPerSlot = ConstBool<false>;
		type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;

	impl pallet_timestamp::Config for Runtime {}

	impl cumulus_pallet_aura_ext::Config for Runtime {}

Finally, a separate macro, similar to impl_runtime_api, which creates the default set of runtime APIs, will generate the parachain runtime’s validation runtime API, also known as parachain validation function (PVF). Without this API, the relay chain is unable to validate blocks produced by our parachain.

cumulus_pallet_parachain_system::register_validate_block! {
	Runtime = Runtime,
	BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>,