genesis-builder: implemented for all runtimes (#1492)

This PR implements [`GenesisBuilder`
API](https://github.com/paritytech/polkadot-sdk/blob/a414ea7515c9cdc81f1d12410e646afc148250e8/substrate/primitives/genesis-builder/src/lib.rs#L38)
for all the runtimes in polkadot repo.

Step towards: paritytech/polkadot-sdk#25

---------

Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
Michal Kucharczyk
2023-09-27 11:59:19 +02:00
committed by GitHub
parent ab3a3bc278
commit 5a2833cceb
46 changed files with 307 additions and 27 deletions
+2
View File
@@ -21,6 +21,7 @@ beefy-primitives = { package = "sp-consensus-beefy", path = "../../../substrate/
binary-merkle-tree = { path = "../../../substrate/utils/binary-merkle-tree", default-features = false }
rococo-runtime-constants = { package = "rococo-runtime-constants", path = "constants", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
inherents = { package = "sp-inherents", path = "../../../substrate/primitives/inherents", default-features = false }
offchain-primitives = { package = "sp-offchain", path = "../../../substrate/primitives/offchain", default-features = false }
sp-std = { package = "sp-std", path = "../../../substrate/primitives/std", default-features = false }
@@ -175,6 +176,7 @@ std = [
"serde_derive",
"sp-api/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
+13 -1
View File
@@ -58,7 +58,9 @@ use beefy_primitives::{
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, Contains, EitherOfDiverse, EverythingBut, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, LockIdentifier, PrivilegeCmp, ProcessMessage,
@@ -2232,6 +2234,16 @@ sp_api::impl_runtime_apis! {
Ok(batches)
}
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn create_default_config() -> Vec<u8> {
create_default_config::<RuntimeGenesisConfig>()
}
fn build_config(config: Vec<u8>) -> sp_genesis_builder::Result {
build_config::<RuntimeGenesisConfig>(config)
}
}
}
#[cfg(test)]