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
Generated
+21
View File
@@ -774,6 +774,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -866,6 +867,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -961,6 +963,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -1859,6 +1862,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -1922,6 +1926,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -2021,6 +2026,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -2636,6 +2642,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -2846,6 +2853,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -5815,6 +5823,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -6811,6 +6820,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-grandpa",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-offchain",
@@ -8448,6 +8458,7 @@ dependencies = [
"sp-consensus-aura",
"sp-consensus-grandpa",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -10919,6 +10930,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -11251,6 +11263,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -12633,6 +12646,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-beefy",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -13061,6 +13075,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-beefy",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -14075,6 +14090,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -14160,6 +14176,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-beefy",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -16103,6 +16120,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -16350,6 +16368,7 @@ dependencies = [
"sp-block-builder",
"sp-consensus-aura",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-offchain",
"sp-runtime",
@@ -17764,6 +17783,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-beefy",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -20293,6 +20313,7 @@ dependencies = [
"sp-consensus-babe",
"sp-consensus-beefy",
"sp-core",
"sp-genesis-builder",
"sp-inherents",
"sp-io",
"sp-keyring",
@@ -44,6 +44,7 @@ sp-api = { path = "../../../substrate/primitives/api", default-features = false}
sp-block-builder = { path = "../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false}
@@ -111,6 +112,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -28,6 +28,7 @@ use sp_version::RuntimeVersion;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything},
weights::{
@@ -742,6 +743,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -42,6 +42,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -209,6 +210,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -52,6 +52,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
ord_parameter_types, parameter_types,
traits::{
AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
@@ -1340,6 +1341,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -39,6 +39,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -190,6 +191,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -84,6 +84,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse,
@@ -1218,6 +1219,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -41,6 +41,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -198,6 +199,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -39,6 +39,7 @@ use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
ord_parameter_types, parameter_types,
traits::{
tokens::nonfungibles_v2::Inspect, AsEnsureOriginWithArg, ConstBool, ConstU128, ConstU32,
@@ -1353,6 +1354,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -37,6 +37,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -118,6 +119,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-offchain/std",
@@ -43,6 +43,7 @@ use sp_version::RuntimeVersion;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything},
weights::{ConstantMultiplier, Weight},
@@ -779,6 +780,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -37,6 +37,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -118,6 +119,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-offchain/std",
@@ -43,6 +43,7 @@ use sp_version::RuntimeVersion;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything},
weights::{ConstantMultiplier, Weight},
@@ -779,6 +780,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -37,6 +37,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
@@ -153,6 +154,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-offchain/std",
@@ -45,6 +45,7 @@ use sp_version::RuntimeVersion;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, Everything},
weights::{ConstantMultiplier, Weight},
@@ -1233,6 +1234,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -43,6 +43,7 @@ sp-arithmetic = { path = "../../../../../substrate/primitives/arithmetic", defau
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -201,6 +202,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-offchain/std",
@@ -68,6 +68,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, ConstBool, ConstU16, ConstU32, ConstU64, ConstU8,
@@ -939,6 +940,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -22,6 +22,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -120,6 +121,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -47,6 +47,7 @@ use sp_version::RuntimeVersion;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU128, ConstU16, ConstU32, ConstU64, ConstU8, Everything},
weights::{ConstantMultiplier, Weight},
@@ -694,6 +695,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -24,6 +24,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -91,6 +92,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -64,6 +64,7 @@ use sp_version::RuntimeVersion;
pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, IsInVec, Randomness,
@@ -452,6 +453,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -20,6 +20,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -63,6 +64,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -46,6 +46,7 @@ use sp_version::RuntimeVersion;
pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, IsInVec, Randomness},
weights::{
@@ -366,6 +367,16 @@ impl_runtime_apis! {
ParachainSystem::collect_collation_info(header)
}
}
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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -19,6 +19,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false }
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -64,6 +65,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -53,6 +53,7 @@ use sp_version::RuntimeVersion;
pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, IsInVec, Randomness},
weights::{
@@ -398,6 +399,16 @@ impl_runtime_apis! {
ParachainSystem::collect_collation_info(header)
}
}
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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -44,6 +44,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -117,6 +118,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -36,6 +36,7 @@ use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
pallet_prelude::Weight,
parameter_types,
traits::{AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, Everything},
@@ -832,6 +833,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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
@@ -27,6 +27,7 @@ sp-api = { path = "../../../../../substrate/primitives/api", default-features =
sp-block-builder = { path = "../../../../../substrate/primitives/block-builder", default-features = false}
sp-consensus-aura = { path = "../../../../../substrate/primitives/consensus/aura", default-features = false}
sp-core = { path = "../../../../../substrate/primitives/core", default-features = false}
sp-genesis-builder = { path = "../../../../../substrate/primitives/genesis-builder", default-features = false }
sp-inherents = { path = "../../../../../substrate/primitives/inherents", default-features = false}
sp-offchain = { path = "../../../../../substrate/primitives/offchain", default-features = false}
sp-runtime = { path = "../../../../../substrate/primitives/runtime", default-features = false}
@@ -90,6 +91,7 @@ std = [
"sp-block-builder/std",
"sp-consensus-aura/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -40,6 +40,7 @@ use sp_version::RuntimeVersion;
pub use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
match_types, parameter_types,
traits::{
AsEnsureOriginWithArg, ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything,
@@ -796,6 +797,16 @@ impl_runtime_apis! {
ParachainSystem::collect_collation_info(header)
}
}
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)
}
}
}
cumulus_pallet_parachain_system::register_validate_block! {
+2
View File
@@ -28,6 +28,7 @@ offchain-primitives = { package = "sp-offchain", path = "../../../substrate/prim
sp-std = { package = "sp-std", path = "../../../substrate/primitives/std", default-features = false }
sp-application-crypto = { path = "../../../substrate/primitives/application-crypto", default-features = false }
sp-arithmetic = { path = "../../../substrate/primitives/arithmetic", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-range", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
@@ -211,6 +212,7 @@ std = [
"sp-application-crypto/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-npos-elections/std",
+14 -1
View File
@@ -60,8 +60,11 @@ use frame_election_provider_support::{
bounds::ElectionBoundsBuilder, generate_solution_type, onchain, NposSolution,
SequentialPhragmen,
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut,
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
@@ -2478,6 +2481,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)]
+2
View File
@@ -26,6 +26,7 @@ offchain-primitives = { package = "sp-offchain", path = "../../../substrate/prim
tx-pool-api = { package = "sp-transaction-pool", path = "../../../substrate/primitives/transaction-pool", default-features = false }
sp-arithmetic = { path = "../../../substrate/primitives/arithmetic", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-range", default-features = false }
@@ -193,6 +194,7 @@ std = [
"sp-api/std",
"sp-arithmetic/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-npos-elections/std",
+14 -1
View File
@@ -45,7 +45,9 @@ use frame_election_provider_support::{
bounds::ElectionBoundsBuilder, generate_solution_type, onchain, SequentialPhragmen,
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut,
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
@@ -2228,6 +2230,17 @@ 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)]
+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)]
+2
View File
@@ -28,6 +28,7 @@ sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-staking = { path = "../../../substrate/primitives/staking", default-features = false }
sp-core = { path = "../../../substrate/primitives/core", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-range", default-features = false }
sp-session = { path = "../../../substrate/primitives/session", default-features = false }
sp-version = { path = "../../../substrate/primitives/version", default-features = false }
@@ -124,6 +125,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
@@ -42,7 +42,9 @@ use frame_election_provider_support::{
onchain, SequentialPhragmen,
};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{Everything, KeyOwnerProofSystem, WithdrawReasons},
};
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
@@ -1137,4 +1139,14 @@ sp_api::impl_runtime_apis! {
Timestamp::now()
}
}
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)
}
}
}
+2
View File
@@ -25,6 +25,7 @@ offchain-primitives = { package = "sp-offchain", path = "../../../substrate/prim
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
sp-application-crypto = { path = "../../../substrate/primitives/application-crypto", default-features = false }
sp-std = { package = "sp-std", path = "../../../substrate/primitives/std", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-range", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
@@ -195,6 +196,7 @@ std = [
"sp-api/std",
"sp-application-crypto/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-npos-elections/std",
+13 -1
View File
@@ -27,7 +27,9 @@ use beefy_primitives::{
};
use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, SequentialPhragmen};
use frame_support::{
construct_runtime, parameter_types,
construct_runtime,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
fungible::HoldConsideration, ConstU32, Contains, EverythingBut, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, ProcessMessage, ProcessMessageError,
@@ -2153,6 +2155,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(all(test, feature = "try-runtime"))]
@@ -39,6 +39,7 @@ sp-std = { path = "../../../primitives/std", default-features = false}
sp-storage = { path = "../../../primitives/storage", default-features = false}
sp-transaction-pool = { path = "../../../primitives/transaction-pool", default-features = false}
sp-version = { path = "../../../primitives/version", default-features = false}
sp-genesis-builder = { version = "0.1.0-dev", default-features = false, path = "../../../primitives/genesis-builder" }
# Used for the node template's RPCs
frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api", default-features = false}
@@ -79,6 +80,7 @@ std = [
"sp-consensus-aura/std",
"sp-consensus-grandpa/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-offchain/std",
"sp-runtime/std",
@@ -23,6 +23,7 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use frame_support::genesis_builder_helper::{build_config, create_default_config};
// A few exports that help ease life for downstream crates.
pub use frame_support::{
construct_runtime, parameter_types,
@@ -571,4 +572,14 @@ impl_runtime_apis! {
Executive::try_execute_block(block, state_root_check, signature_check, select).expect("execute-block failed")
}
}
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)
}
}
}
+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)]
-3
View File
@@ -107,6 +107,3 @@ std = [
]
# Special feature to disable logging
disable-logging = [ "sp-api/disable-logging" ]
#Enabling this flag will disable GenesisBuilder API implementation in runtime.
disable-genesis-builder = []
-15
View File
@@ -15,8 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
const BUILD_NO_GENESIS_BUILDER_SUPPORT_ENV: &str = "BUILD_NO_GENESIS_BUILDER_SUPPORT";
fn main() {
#[cfg(feature = "std")]
{
@@ -31,19 +29,6 @@ fn main() {
.build();
}
#[cfg(feature = "std")]
if std::env::var(BUILD_NO_GENESIS_BUILDER_SUPPORT_ENV).is_ok() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.append_to_rust_flags("-Clink-arg=-zstack-size=1048576")
.set_file_name("wasm_binary_no_genesis_builder")
.import_memory()
.enable_feature("disable-genesis-builder")
.build();
}
println!("cargo:rerun-if-env-changed={}", BUILD_NO_GENESIS_BUILDER_SUPPORT_ENV);
#[cfg(feature = "std")]
{
substrate_wasm_builder::WasmBuilder::new()
+1 -4
View File
@@ -26,11 +26,10 @@ pub mod genesismap;
pub mod substrate_test_pallet;
use codec::{Decode, Encode};
#[cfg(not(feature = "disable-genesis-builder"))]
use frame_support::genesis_builder_helper::{build_config, create_default_config};
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{ConstU32, ConstU64},
weights::{
@@ -722,7 +721,6 @@ impl_runtime_apis! {
}
}
#[cfg(not(feature = "disable-genesis-builder"))]
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn create_default_config() -> Vec<u8> {
create_default_config::<RuntimeGenesisConfig>()
@@ -1203,7 +1201,6 @@ mod tests {
})
}
#[cfg(not(feature = "disable-genesis-builder"))]
mod genesis_builder_tests {
use super::*;
use crate::genesismap::GenesisStorageBuilder;