#[genesis_build]
Expand description

The #[pallet::genesis_build] attribute allows you to define how genesis_configuration is built. This takes as input the GenesisConfig type (as self) and constructs the pallet’s initial state.

The impl must be defined as:

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig<$maybe_generics> {
	fn build(&self) { $expr }
}

I.e. a trait implementation with generic T: Config, of trait GenesisBuild<T> on type GenesisConfig with generics none or T.

E.g.:

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
	fn build(&self) {}
}

Macro expansion

The macro will add the following attribute:

  • #[cfg(feature = "std")]

The macro will implement sp_runtime::BuildModuleGenesisStorage using () as a second generic for non-instantiable pallets.