runtime

Attribute Macro runtime 

Source
#[runtime]
Expand description

Construct a runtime, with the given name and the given pallets.

§Example:

#[crate::runtime]
mod runtime {
	// The main runtime
	#[runtime::runtime]
	// Runtime Types to be generated
	#[runtime::derive(
		RuntimeCall,
		RuntimeEvent,
		RuntimeError,
		RuntimeOrigin,
		RuntimeFreezeReason,
		RuntimeHoldReason,
		RuntimeSlashReason,
		RuntimeLockId,
		RuntimeTask,
		RuntimeViewFunction
	)]
	pub struct Runtime;

	// Use the concrete pezpallet type
	#[runtime::pezpallet_index(0)]
	pub type System = pezframe_system::Pezpallet<Runtime>;

	// Use path to the pezpallet
	#[runtime::pezpallet_index(1)]
	pub type Basic = pezpallet_basic;

	// Use the concrete pezpallet type with instance
	#[runtime::pezpallet_index(2)]
	pub type PalletWithInstance1 = pezpallet_with_instance::Pezpallet<Runtime, Instance1>;

	// Use path to the pezpallet with instance
	#[runtime::pezpallet_index(3)]
	pub type PalletWithInstance2 = pezpallet_with_instance<Instance2>;

	// Ensure that the runtime does not export the calls from the pezpallet
	#[runtime::pezpallet_index(4)]
	#[runtime::disable_call]
	#[deprecated = "example"]
	pub type PalletWithDisabledCall = pezpallet_with_disabled_call::Pezpallet<Runtime>;

	// Ensure that the runtime does not export the unsigned calls from the pezpallet
	#[runtime::pezpallet_index(5)]
	#[runtime::disable_unsigned]
	pub type PalletWithDisabledUnsigned = pezpallet_with_disabled_unsigned::Pezpallet<Runtime>;
}

§Supported Attributes:

§Legacy Ordering

An optional attribute can be defined as #[pezframe_support::runtime(legacy_ordering)] to ensure that the order of hooks is same as the order of pallets (and not based on the pezpallet_index). This is to support legacy runtimes and should be avoided for new ones.

§Note

The population of the genesis storage depends on the order of pallets. So, if one of your pallets depends on another pezpallet, the pezpallet that is depended upon needs to come before the pezpallet depending on it.

§Type definitions

  • The macro generates a type alias for each pezpallet to their Pezpallet. E.g. type System = pezframe_system::Pezpallet<Runtime>