From c35a621fa10e9893d72ce6f6058385b3410508c8 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Wed, 11 Sep 2024 11:16:28 +0200 Subject: [PATCH] More nits for rococo-runtime --- .../rococo/src/genesis_config_presets.rs | 18 +++++++++++++++--- polkadot/runtime/rococo/src/lib.rs | 8 +------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/polkadot/runtime/rococo/src/genesis_config_presets.rs b/polkadot/runtime/rococo/src/genesis_config_presets.rs index 2f2d504d243b6..97b193572a3ae 100644 --- a/polkadot/runtime/rococo/src/genesis_config_presets.rs +++ b/polkadot/runtime/rococo/src/genesis_config_presets.rs @@ -22,7 +22,7 @@ use crate::{ }; #[cfg(not(feature = "std"))] use alloc::format; -use alloc::vec::Vec; +use alloc::{vec, vec::Vec}; use polkadot_primitives::{AccountId, AccountPublic, AssignmentId, SchedulerParams, ValidatorId}; use rococo_runtime_constants::currency::UNITS as ROC; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; @@ -30,6 +30,7 @@ use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{sr25519, Pair, Public}; +use sp_genesis_builder::PresetId; use sp_runtime::traits::IdentifyAccount; /// Helper function to generate a crypto pair from seed @@ -522,10 +523,10 @@ fn wococo_local_testnet_genesis() -> serde_json::Value { } /// Provides the JSON representation of predefined genesis config for given `id`. -pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option> { +pub fn get_preset(id: &PresetId) -> Option> { let patch = match id.try_into() { Ok("local_testnet") => rococo_local_testnet_genesis(), - Ok("development") => rococo_development_config_genesis(), + Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => rococo_development_config_genesis(), Ok("staging_testnet") => rococo_staging_testnet_config_genesis(), Ok("wococo_local_testnet") => wococo_local_testnet_genesis(), Ok("versi_local_testnet") => versi_local_testnet_genesis(), @@ -537,3 +538,14 @@ pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option Vec { + vec![ + PresetId::from("local_testnet"), + PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET), + PresetId::from("staging_testnet"), + PresetId::from("wococo_local_testnet"), + PresetId::from("versi_local_testnet"), + ] +} diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index 6ec49c5830f7d..e5396034a44b8 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -2582,13 +2582,7 @@ sp_api::impl_runtime_apis! { } fn preset_names() -> Vec { - vec![ - PresetId::from("local_testnet"), - PresetId::from("development"), - PresetId::from("staging_testnet"), - PresetId::from("wococo_local_testnet"), - PresetId::from("versi_local_testnet"), - ] + genesis_config_presets::preset_names() } } }