Skip to content

Commit

Permalink
RuntimeGenesisBuild added
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkucharczyk committed Jun 12, 2023
1 parent 5fc8e30 commit 3c131b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn expand_outer_config(
}
}

impl<T> #scrate::traits::GenesisBuild<T> for RuntimeGenesisConfig {
impl #scrate::traits::RuntimeGenesisBuild for RuntimeGenesisConfig {
fn build(&self) {
#genesis_build_calls
}
Expand Down
2 changes: 1 addition & 1 deletion frame/support/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub use metadata::{
mod hooks;
pub use hooks::{
GenesisBuild, Hooks, IntegrityTest, OnFinalize, OnGenesis, OnIdle, OnInitialize,
OnRuntimeUpgrade, OnTimestampSet,
OnRuntimeUpgrade, OnTimestampSet, RuntimeGenesisBuild,
};

pub mod schedule;
Expand Down
7 changes: 7 additions & 0 deletions frame/support/src/traits/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,13 @@ pub trait Hooks<BlockNumber> {
fn integrity_test() {}
}

/// A trait to define the build function of a runtime genesis config.
pub trait RuntimeGenesisBuild: Default + sp_runtime::traits::MaybeSerializeDeserialize {
/// Build function allows to put all genesis config keys for each runtime pallet into the
/// storage.
fn build(&self);
}

/// A trait to define the build function of a genesis config, T and I are placeholder for pallet
/// trait and pallet instance.
pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
Expand Down

0 comments on commit 3c131b6

Please sign in to comment.