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
@@ -32,6 +32,7 @@ sp-authority-discovery = { path = "../../../primitives/authority-discovery", def
sp-consensus-babe = { path = "../../../primitives/consensus/babe", default-features = false}
sp-consensus-grandpa = { path = "../../../primitives/consensus/grandpa", default-features = false}
sp-block-builder = { path = "../../../primitives/block-builder", default-features = false}
sp-genesis-builder = { version = "0.1.0-dev", default-features = false, path = "../../../primitives/genesis-builder" }
sp-inherents = { path = "../../../primitives/inherents", default-features = false}
node-primitives = { path = "../primitives", default-features = false}
sp-offchain = { path = "../../../primitives/offchain", default-features = false}
@@ -231,6 +232,7 @@ std = [
"sp-consensus-babe/std",
"sp-consensus-grandpa/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-offchain/std",
+11
View File
@@ -30,6 +30,7 @@ use frame_election_provider_support::{
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
instances::{Instance1, Instance2},
ord_parameter_types,
pallet_prelude::Get,
@@ -2750,6 +2751,16 @@ 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)]