Skip to content
Snippets Groups Projects
Unverified Commit 430edd75 authored by Nazar Mokrynskyi's avatar Nazar Mokrynskyi Committed by GitHub
Browse files

Relax genesis config to not require `Default` impl (#1221)


Co-authored-by: default avatarOliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
parent 62f0a729
No related merge requests found
Pipeline #385231 failed with stages
in 47 minutes and 50 seconds
......@@ -25,7 +25,10 @@ use sp_runtime::format_runtime_string;
/// Get the default `GenesisConfig` as a JSON blob. For more info refer to
/// [`sp_genesis_builder::GenesisBuilder::create_default_config`]
pub fn create_default_config<GC: BuildGenesisConfig>() -> sp_std::vec::Vec<u8> {
pub fn create_default_config<GC>() -> sp_std::vec::Vec<u8>
where
GC: BuildGenesisConfig + Default,
{
serde_json::to_string(&GC::default())
.expect("serialization to json is expected to work. qed.")
.into_bytes()
......
......@@ -442,7 +442,7 @@ pub trait Hooks<BlockNumber> {
/// A trait to define the build function of a genesis config for both runtime and pallets.
///
/// Replaces deprecated [`GenesisBuild<T,I>`].
pub trait BuildGenesisConfig: Default + sp_runtime::traits::MaybeSerializeDeserialize {
pub trait BuildGenesisConfig: sp_runtime::traits::MaybeSerializeDeserialize {
/// The build function puts initial `GenesisConfig` keys/values pairs into the storage.
fn build(&self);
}
......@@ -452,7 +452,7 @@ pub trait BuildGenesisConfig: Default + sp_runtime::traits::MaybeSerializeDeseri
#[deprecated(
note = "GenesisBuild is planned to be removed in December 2023. Use BuildGenesisConfig instead of it."
)]
pub trait GenesisBuild<T, I = ()>: Default + sp_runtime::traits::MaybeSerializeDeserialize {
pub trait GenesisBuild<T, I = ()>: sp_runtime::traits::MaybeSerializeDeserialize {
/// The build function is called within an externalities allowing storage APIs.
/// Thus one can write to storage using regular pallet storages.
fn build(&self);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment