mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-23 22:25:42 +00:00
Relax genesis config to not require Default impl (#1221)
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -25,7 +25,10 @@ use sp_runtime::format_runtime_string;
|
|||||||
|
|
||||||
/// Get the default `GenesisConfig` as a JSON blob. For more info refer to
|
/// Get the default `GenesisConfig` as a JSON blob. For more info refer to
|
||||||
/// [`sp_genesis_builder::GenesisBuilder::create_default_config`]
|
/// [`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())
|
serde_json::to_string(&GC::default())
|
||||||
.expect("serialization to json is expected to work. qed.")
|
.expect("serialization to json is expected to work. qed.")
|
||||||
.into_bytes()
|
.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.
|
/// A trait to define the build function of a genesis config for both runtime and pallets.
|
||||||
///
|
///
|
||||||
/// Replaces deprecated [`GenesisBuild<T,I>`].
|
/// 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.
|
/// The build function puts initial `GenesisConfig` keys/values pairs into the storage.
|
||||||
fn build(&self);
|
fn build(&self);
|
||||||
}
|
}
|
||||||
@@ -452,7 +452,7 @@ pub trait BuildGenesisConfig: Default + sp_runtime::traits::MaybeSerializeDeseri
|
|||||||
#[deprecated(
|
#[deprecated(
|
||||||
note = "GenesisBuild is planned to be removed in December 2023. Use BuildGenesisConfig instead of it."
|
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.
|
/// The build function is called within an externalities allowing storage APIs.
|
||||||
/// Thus one can write to storage using regular pallet storages.
|
/// Thus one can write to storage using regular pallet storages.
|
||||||
fn build(&self);
|
fn build(&self);
|
||||||
|
|||||||
Reference in New Issue
Block a user