From 24bd45f772e1c8f7d0de618c853c8ea03203ff47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20Murray?= Date: Fri, 6 Sep 2024 14:56:27 +0100 Subject: [PATCH] Clean up genesis config presets for all runtimes (#450) This PR does three things related to chain-specs and genesis config presets: - Refactor `preset_names` to `genesis_config_presets` in all runtimes as suggested for the Polkadot Coretime runtime in #410. - Make the chain-spec generator use the preset from the WASM directly for each runtime. - Propagate the `on_chain_release_build` feature to the chain-spec generator. Without this we cannot generate live/genesis chain-specs with the chain-spec generator without having to post-process it to replace the WASM compiled with this flag. --------- Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com> --- CHANGELOG.md | 4 +++ chain-spec-generator/Cargo.toml | 16 +++++++++ .../src/system_parachains_specs.rs | 36 ++++++------------- relay/kusama/src/genesis_config_presets.rs | 6 ++++ relay/kusama/src/lib.rs | 5 +-- relay/polkadot/src/genesis_config_presets.rs | 6 ++++ relay/polkadot/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../asset-hubs/asset-hub-kusama/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../asset-hubs/asset-hub-polkadot/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../bridge-hub-polkadot/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../collectives-polkadot/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../coretime/coretime-kusama/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 2 +- .../encointer/src/genesis_config_presets.rs | 6 ++++ system-parachains/encointer/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../gluttons/glutton-kusama/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../people/people-kusama/src/lib.rs | 5 +-- .../src/genesis_config_presets.rs | 6 ++++ .../people/people-polkadot/src/lib.rs | 5 +-- 28 files changed, 115 insertions(+), 75 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46be51afea..6eb4bd8375 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Allow signed origins to send arbitrary XCMs from some system chains ([polkadot-fellows/runtimes#407](https://github.com/polkadot-fellows/runtimes/pull/407)) +### Fixed + +- Chain-spec generator: propagate the `on_chain_release_build` feature to the chain-spec generator. Without this the live/genesis chain-specs contain a wrongly-configured WASM blob ([polkadot-fellows/runtimes#450](https://github.com/polkadot-fellows/runtimes/pull/450)). + ## [1.3.2] 27.08.2024 ### Fixed diff --git a/chain-spec-generator/Cargo.toml b/chain-spec-generator/Cargo.toml index 66640c7e1b..157c51981a 100644 --- a/chain-spec-generator/Cargo.toml +++ b/chain-spec-generator/Cargo.toml @@ -46,3 +46,19 @@ runtime-benchmarks = [ "people-polkadot-runtime/runtime-benchmarks", "polkadot-runtime/runtime-benchmarks", ] + +on-chain-release-build = [ + "asset-hub-kusama-runtime/on-chain-release-build", + "asset-hub-polkadot-runtime/on-chain-release-build", + "bridge-hub-kusama-runtime/on-chain-release-build", + "bridge-hub-polkadot-runtime/on-chain-release-build", + "collectives-polkadot-runtime/on-chain-release-build", + "coretime-kusama-runtime/on-chain-release-build", + "coretime-polkadot-runtime/on-chain-release-build", + "encointer-kusama-runtime/on-chain-release-build", + "glutton-kusama-runtime/on-chain-release-build", + "kusama-runtime/on-chain-release-build", + "people-kusama-runtime/on-chain-release-build", + "people-polkadot-runtime/on-chain-release-build", + "polkadot-runtime/on-chain-release-build", +] diff --git a/chain-spec-generator/src/system_parachains_specs.rs b/chain-spec-generator/src/system_parachains_specs.rs index db726d7f0d..dd37d8d7b2 100644 --- a/chain-spec-generator/src/system_parachains_specs.rs +++ b/chain-spec-generator/src/system_parachains_specs.rs @@ -66,7 +66,7 @@ pub fn asset_hub_polkadot_local_testnet_config() -> Result, S .with_name("Polkadot Asset Hub Local") .with_id("asset-hub-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_polkadot_runtime::genesis_config_presets::asset_hub_polkadot_local_testnet_genesis(1000.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -86,7 +86,7 @@ pub fn asset_hub_kusama_local_testnet_config() -> Result, Str .with_name("Kusama Asset Hub Local") .with_id("asset-hub-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(asset_hub_kusama_runtime::genesis_config_presets::asset_hub_kusama_local_testnet_genesis(1000.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -107,7 +107,7 @@ pub fn collectives_polkadot_local_testnet_config() -> Result, .with_name("Polkadot Collectives Local") .with_id("collectives-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(collectives_polkadot_runtime::genesis_config_presets::collectives_polkadot_local_testnet_genesis(1001.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -128,7 +128,7 @@ pub fn bridge_hub_polkadot_local_testnet_config() -> Result, .with_name("Polkadot Bridge Hub Local") .with_id("bridge-hub-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_polkadot_runtime::genesis_config_presets::bridge_hub_polkadot_local_testnet_genesis(1002.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -148,7 +148,7 @@ pub fn bridge_hub_kusama_local_testnet_config() -> Result, St .with_name("Kusama Bridge Hub Local") .with_id("bridge-hub-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(bridge_hub_kusama_runtime::genesis_config_presets::bridge_hub_kusama_local_testnet_genesis(1002.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -166,11 +166,7 @@ pub fn glutton_kusama_local_testnet_config() -> Result, Strin .with_name("Kusama Glutton Local") .with_id("glutton-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch( - glutton_kusama_runtime::genesis_config_presets::glutton_kusama_local_testnet_genesis( - 1300.into(), - ), - ) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -190,7 +186,7 @@ pub fn encointer_kusama_local_testnet_config() -> Result, Str .with_name("Kusama Encointer Local") .with_id("encointer-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch(encointer_kusama_runtime::genesis_config_presets::encointer_kusama_local_testnet_genesis(1001.into())) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -210,11 +206,7 @@ pub fn coretime_kusama_local_testnet_config() -> Result, Stri .with_name("Kusama Coretime Local") .with_id("coretime-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch( - coretime_kusama_runtime::genesis_config_presets::coretime_kusama_local_testnet_genesis( - 1005.into(), - ), - ) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -327,11 +319,7 @@ pub fn people_kusama_local_testnet_config() -> Result, String .with_name("Kusama People Local") .with_id("people-kusama-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch( - people_kusama_runtime::genesis_config_presets::people_kusama_local_testnet_genesis( - 1004.into(), - ), - ) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) @@ -351,11 +339,7 @@ pub fn people_polkadot_local_testnet_config() -> Result, Stri .with_name("Polkadot People Local") .with_id("people-polkadot-local") .with_chain_type(ChainType::Local) - .with_genesis_config_patch( - people_polkadot_runtime::genesis_config_presets::people_polkadot_local_testnet_genesis( - 1004.into(), - ), - ) + .with_genesis_config_preset_name("local_testnet") .with_properties(properties) .build(), )) diff --git a/relay/kusama/src/genesis_config_presets.rs b/relay/kusama/src/genesis_config_presets.rs index dda349608b..804c296fa3 100644 --- a/relay/kusama/src/genesis_config_presets.rs +++ b/relay/kusama/src/genesis_config_presets.rs @@ -23,6 +23,7 @@ use pallet_staking::{Forcing, StakerStatus}; use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams}; use runtime_parachains::configuration::HostConfiguration; use sp_core::{sr25519, Pair, Public}; +use sp_genesis_builder::PresetId; use sp_runtime::{traits::IdentifyAccount, Perbill}; #[cfg(not(feature = "std"))] use sp_std::alloc::format; @@ -224,6 +225,11 @@ pub fn kusama_development_config_genesis() -> serde_json::Value { ) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 7653bead2d..aa0b696f0f 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -2523,10 +2523,7 @@ sp_api::impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/relay/polkadot/src/genesis_config_presets.rs b/relay/polkadot/src/genesis_config_presets.rs index 38abd8e48f..8d8afb6ad0 100644 --- a/relay/polkadot/src/genesis_config_presets.rs +++ b/relay/polkadot/src/genesis_config_presets.rs @@ -23,6 +23,7 @@ use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams}; use polkadot_runtime_constants::currency::UNITS as DOT; use runtime_parachains::configuration::HostConfiguration; use sp_core::{sr25519, Pair, Public}; +use sp_genesis_builder::PresetId; use sp_runtime::{traits::IdentifyAccount, Perbill}; #[cfg(not(feature = "std"))] use sp_std::alloc::format; @@ -224,6 +225,11 @@ pub fn polkadot_development_config_genesis() -> serde_json::Value { ) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 08a782346f..f6f587eb91 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -2694,10 +2694,7 @@ sp_api::impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs b/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs index 09aef4c37d..f092687fe6 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the AssetHubKusama runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn asset_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { asset_hub_kusama_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { 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 0e3db3440f..4515b3d2a0 100644 --- a/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs @@ -1372,10 +1372,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs index 2f87b6b3b8..4d60c808d8 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs @@ -19,6 +19,7 @@ use crate::*; use parachains_common::AssetHubPolkadotAuraId; use sp_core::sr25519; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -88,6 +89,11 @@ fn asset_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value asset_hub_polkadot_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { 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 67522fcd60..18e634b06f 100644 --- a/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs +++ b/system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs @@ -1340,10 +1340,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs index 24f1a87143..d9850b62a7 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the BridgeHubKusama runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn bridge_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { bridge_hub_kusama_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { 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 405eaa4891..5b06329ed9 100644 --- a/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -812,10 +812,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs index 0d549d3c2e..e4ee542bea 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the BridgeHubPolkadot runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -77,6 +78,11 @@ fn bridge_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value bridge_hub_polkadot_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { 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 8c2aa532f3..10cf516cc3 100644 --- a/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -814,10 +814,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs index 8ad0b4dcdf..0fcbb37305 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the CollectivesPolkadot runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn collectives_polkadot_development_genesis(para_id: ParaId) -> serde_json::Valu collectives_polkadot_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/collectives/collectives-polkadot/src/lib.rs b/system-parachains/collectives/collectives-polkadot/src/lib.rs index 0ddd613f0c..7be3bfd3e6 100644 --- a/system-parachains/collectives/collectives-polkadot/src/lib.rs +++ b/system-parachains/collectives/collectives-polkadot/src/lib.rs @@ -1039,10 +1039,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs index 545d0a87e4..dbefac5c74 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -19,6 +19,7 @@ use crate::*; use hex_literal::hex; use sp_core::crypto::UncheckedInto; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -131,6 +132,11 @@ fn coretime_kusama_live_genesis(para_id: ParaId) -> serde_json::Value { ) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/coretime/coretime-kusama/src/lib.rs b/system-parachains/coretime/coretime-kusama/src/lib.rs index 08177d041f..2f0bc186f4 100644 --- a/system-parachains/coretime/coretime-kusama/src/lib.rs +++ b/system-parachains/coretime/coretime-kusama/src/lib.rs @@ -1107,10 +1107,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } } diff --git a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs index 509a23d52e..38f3aceed7 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -133,7 +133,7 @@ fn coretime_polkadot_live_genesis(para_id: ParaId) -> serde_json::Value { ) } -pub(super) fn preset_names() -> Vec { +pub fn preset_names() -> Vec { vec![PresetId::from("live"), PresetId::from("development"), PresetId::from("local_testnet")] } diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs index 906c77e505..8f25c9ae86 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the EncointerKusama runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn encointer_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { encointer_kusama_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/encointer/src/lib.rs b/system-parachains/encointer/src/lib.rs index 3654899cfe..d2f1a50110 100644 --- a/system-parachains/encointer/src/lib.rs +++ b/system-parachains/encointer/src/lib.rs @@ -1041,10 +1041,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs index aa6b3f67ba..c951b4e538 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -18,6 +18,7 @@ use crate::*; use cumulus_primitives_core::ParaId; +use sp_genesis_builder::PresetId; fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { serde_json::json!({ @@ -36,6 +37,11 @@ fn glutton_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { glutton_kusama_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/gluttons/glutton-kusama/src/lib.rs b/system-parachains/gluttons/glutton-kusama/src/lib.rs index 6392e0a9d8..140763101c 100644 --- a/system-parachains/gluttons/glutton-kusama/src/lib.rs +++ b/system-parachains/gluttons/glutton-kusama/src/lib.rs @@ -399,10 +399,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } diff --git a/system-parachains/people/people-kusama/src/genesis_config_presets.rs b/system-parachains/people/people-kusama/src/genesis_config_presets.rs index 74aa13cf80..1254ed4469 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the PeopleKusama runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn people_kusama_development_genesis(para_id: ParaId) -> serde_json::Value { people_kusama_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index 3076b5da04..ee32677762 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -1077,10 +1077,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } } diff --git a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs index 6847d7ca73..f48e219922 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -17,6 +17,7 @@ //! Genesis configs presets for the PeoplePolkadot runtime use crate::*; +use sp_genesis_builder::PresetId; use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; @@ -72,6 +73,11 @@ fn people_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value { people_polkadot_local_testnet_genesis(para_id) } +/// Provides the names of the predefined genesis configs for this runtime. +pub fn preset_names() -> Vec { + vec![PresetId::from("development"), PresetId::from("local_testnet")] +} + /// Provides the JSON representation of predefined genesis config for given `id`. pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { let patch = match id.try_into() { diff --git a/system-parachains/people/people-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index 791b0738c1..06ef90faca 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -1042,10 +1042,7 @@ impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - sp_genesis_builder::PresetId::from("local_testnet"), - sp_genesis_builder::PresetId::from("development"), - ] + genesis_config_presets::preset_names() } } }