From 7104fcdfe9191c641dd37e416acec203be42bfcf Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 7 Nov 2023 09:47:23 +0300 Subject: [PATCH] adapt https://github.com/paritytech/polkadot-sdk/issues/1492 --- Cargo.lock | 8 ++++++++ relay/kusama/Cargo.toml | 2 ++ relay/kusama/src/lib.rs | 14 +++++++++++++- relay/polkadot/Cargo.toml | 2 ++ relay/polkadot/src/lib.rs | 14 +++++++++++++- .../asset-hubs/asset-hub-kusama/Cargo.toml | 2 ++ .../asset-hubs/asset-hub-kusama/src/lib.rs | 11 +++++++++++ .../asset-hubs/asset-hub-polkadot/Cargo.toml | 2 ++ .../asset-hubs/asset-hub-polkadot/src/lib.rs | 11 +++++++++++ .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 2 ++ .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 11 +++++++++++ .../bridge-hubs/bridge-hub-polkadot/Cargo.toml | 2 ++ .../bridge-hubs/bridge-hub-polkadot/src/lib.rs | 11 +++++++++++ .../collectives/collectives-polkadot/Cargo.toml | 2 ++ .../collectives/collectives-polkadot/src/lib.rs | 10 ++++++++++ .../gluttons/glutton-kusama/Cargo.toml | 2 ++ .../gluttons/glutton-kusama/src/lib.rs | 12 +++++++++++- 17 files changed, 115 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fdca71f21..42a5e74a68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -581,6 +581,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-offchain", "sp-runtime", @@ -650,6 +651,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-offchain", "sp-runtime", @@ -1308,6 +1310,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-offchain", @@ -1371,6 +1374,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-offchain", @@ -1872,6 +1876,7 @@ dependencies = [ "sp-block-builder", "sp-consensus-aura", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-offchain", @@ -3943,6 +3948,7 @@ dependencies = [ "sp-api", "sp-block-builder", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-offchain", "sp-runtime", @@ -8151,6 +8157,7 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-beefy", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", @@ -11502,6 +11509,7 @@ dependencies = [ "sp-consensus-babe", "sp-consensus-beefy", "sp-core", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keyring", diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index f7dc6b505d..6c9ab41da1 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -30,6 +30,7 @@ offchain-primitives = { package = "sp-offchain", default-features = false , vers sp-std = { package = "sp-std", default-features = false , version = "12.0.0" } sp-application-crypto = { default-features = false , version = "27.0.0" } sp-arithmetic = { default-features = false , version = "20.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-io = { default-features = false , version = "27.0.0" } sp-mmr-primitives = { default-features = false , version = "23.0.0" } sp-runtime = { default-features = false , version = "28.0.0" } @@ -215,6 +216,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", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index afa508d781..39b88294ea 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -65,7 +65,9 @@ use frame_election_provider_support::{ 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, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, @@ -2354,6 +2356,16 @@ sp_api::impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index 9fdb31aa8d..dccbf65a83 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -27,6 +27,7 @@ offchain-primitives = { package = "sp-offchain", default-features = false , vers tx-pool-api = { package = "sp-transaction-pool", default-features = false , version = "23.0.0" } sp-arithmetic = { default-features = false , version = "20.0.0" } sp-api = { default-features = false , version = "23.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-std = { default-features = false , version = "12.0.0" } sp-io = { default-features = false , version = "27.0.0" } sp-mmr-primitives = { default-features = false , version = "23.0.0" } @@ -198,6 +199,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", diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 889364e380..c2fe989738 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -50,7 +50,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, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, @@ -2150,6 +2152,16 @@ sp_api::impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml index 5434783aa7..eb8291f397 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml @@ -45,6 +45,7 @@ sp-api = { default-features = false, version = "23.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-consensus-aura = { default-features = false, version = "0.29.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } sp-runtime = { default-features = false, version = "28.0.0" } @@ -210,6 +211,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", diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs index d16441ef25..9f4cbbad99 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -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, @@ -1189,6 +1190,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml index 2e69902304..cf3c803c97 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml +++ b/system-parachains/asset-hubs/asset-hub-polkadot/Cargo.toml @@ -42,6 +42,7 @@ sp-api = { default-features = false, version = "23.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-consensus-aura = { default-features = false, version = "0.29.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } sp-runtime = { default-features = false, version = "28.0.0" } @@ -191,6 +192,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", diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs index df1d00075c..bd5787f15b 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -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, @@ -1066,6 +1067,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml index f5f658fea2..2b8f3cfc89 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -40,6 +40,7 @@ sp-api = { default-features = false, version = "23.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-consensus-aura = { default-features = false, version = "0.29.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-io = { default-features = false, version = "27.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } @@ -121,6 +122,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", diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs index 937e44a0f6..1a1268da8e 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -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}, @@ -640,6 +641,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml index c28039fa3e..aad6871f51 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -40,6 +40,7 @@ sp-api = { default-features = false, version = "23.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-consensus-aura = { default-features = false, version = "0.29.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-io = { default-features = false, version = "27.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } @@ -121,6 +122,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", diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 3133a43e65..f5d97ab45e 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -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}, @@ -615,6 +616,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/collectives/collectives-polkadot/Cargo.toml b/system-parachains/collectives/collectives-polkadot/Cargo.toml index 54a5f94f10..57156c5ec2 100644 --- a/system-parachains/collectives/collectives-polkadot/Cargo.toml +++ b/system-parachains/collectives/collectives-polkadot/Cargo.toml @@ -46,6 +46,7 @@ sp-arithmetic = { default-features = false , version = "20.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-consensus-aura = { default-features = false, version = "0.29.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } sp-runtime = { default-features = false, version = "28.0.0" } @@ -198,6 +199,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", diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 63bdd240c8..2b04fe9421 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -886,6 +886,16 @@ impl_runtime_apis! { } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { diff --git a/system-parachains/gluttons/glutton-kusama/Cargo.toml b/system-parachains/gluttons/glutton-kusama/Cargo.toml index 30be665295..b037ddbc21 100644 --- a/system-parachains/gluttons/glutton-kusama/Cargo.toml +++ b/system-parachains/gluttons/glutton-kusama/Cargo.toml @@ -25,6 +25,7 @@ pallet-sudo = { default-features = false, optional = true, version = "25.0.0" } sp-api = { default-features = false, version = "23.0.0" } sp-block-builder = { default-features = false, version = "23.0.0" } sp-core = { default-features = false, version = "25.0.0" } +sp-genesis-builder = { default-features = false , version = "0.4.0" } sp-inherents = { default-features = false, version = "23.0.0" } sp-offchain = { default-features = false, version = "23.0.0" } sp-runtime = { default-features = false, version = "28.0.0" } @@ -83,6 +84,7 @@ std = [ "sp-api/std", "sp-block-builder/std", "sp-core/std", + "sp-genesis-builder/std", "sp-inherents/std", "sp-offchain/std", "sp-runtime/std", diff --git a/system-parachains/gluttons/glutton-kusama/src/lib.rs b/system-parachains/gluttons/glutton-kusama/src/lib.rs index a6153952de..db98c4fa23 100644 --- a/system-parachains/gluttons/glutton-kusama/src/lib.rs +++ b/system-parachains/gluttons/glutton-kusama/src/lib.rs @@ -347,12 +347,22 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn create_default_config() -> Vec { + create_default_config::() + } + + fn build_config(config: Vec) -> sp_genesis_builder::Result { + build_config::(config) + } + } + #[cfg(feature = "runtime-benchmarks")] impl frame_benchmarking::Benchmark for Runtime { fn benchmark_metadata(extra: bool) -> (