From de274404bf169e474249acf8a29768355488d61b Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Thu, 26 Dec 2024 11:16:16 +0100 Subject: [PATCH] remove_phantom_fields unneeded --- Cargo.lock | 1 - .../src/genesis_config_presets.rs | 6 ++---- .../src/genesis_config_presets.rs | 6 ++---- .../src/genesis_config_presets.rs | 5 +---- system-parachains/constants/Cargo.toml | 1 - .../constants/src/genesis_presets.rs | 20 +------------------ .../src/genesis_config_presets.rs | 5 +---- .../src/genesis_config_presets.rs | 5 +---- .../encointer/src/genesis_config_presets.rs | 5 +---- .../src/genesis_config_presets.rs | 6 +----- .../src/genesis_config_presets.rs | 5 +---- .../src/genesis_config_presets.rs | 5 +---- 12 files changed, 12 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 96e32d7780..02c6d0e8ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14994,7 +14994,6 @@ dependencies = [ "polkadot-core-primitives", "polkadot-primitives 16.0.0", "polkadot-runtime-constants", - "serde_json", "smallvec", "sp-core 34.0.0", "sp-runtime 39.0.2", 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 68946dfbbd..dfd3f61bce 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 @@ -69,12 +69,10 @@ fn bridge_hub_kusama_genesis( parachain_system: Default::default(), transaction_payment: Default::default(), bridge_polkadot_messages: Default::default(), + xcm_over_bridge_hub_polkadot: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn bridge_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 c89ee09893..3868f9fb1e 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 @@ -65,6 +65,7 @@ fn bridge_hub_polkadot_genesis( bridge_kusama_grandpa: Default::default(), bridge_kusama_parachains: Default::default(), bridge_kusama_messages: Default::default(), + xcm_over_bridge_hub_kusama: Default::default(), ethereum_system: EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), @@ -76,10 +77,7 @@ fn bridge_hub_polkadot_genesis( transaction_payment: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn bridge_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 198f68cfce..92429a6c42 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -72,10 +72,7 @@ fn collectives_polkadot_genesis( ambassador_treasury: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn collectives_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { diff --git a/system-parachains/constants/Cargo.toml b/system-parachains/constants/Cargo.toml index 40de8e9141..17582f7785 100644 --- a/system-parachains/constants/Cargo.toml +++ b/system-parachains/constants/Cargo.toml @@ -20,7 +20,6 @@ sp-core = { workspace = true } sp-runtime = { workspace = true } sp-std = { workspace = true } xcm = { workspace = true } -serde_json = { features = ["alloc"], workspace = true } [features] default = ["std"] diff --git a/system-parachains/constants/src/genesis_presets.rs b/system-parachains/constants/src/genesis_presets.rs index 8ef68e6ec5..a06ebb1943 100644 --- a/system-parachains/constants/src/genesis_presets.rs +++ b/system-parachains/constants/src/genesis_presets.rs @@ -17,7 +17,6 @@ use parachains_common::AuraId; use polkadot_primitives::{AccountId, AccountPublic}; -use serde_json::Value; use sp_core::{sr25519, Pair, Public}; use sp_runtime::traits::IdentifyAccount; #[cfg(not(feature = "std"))] @@ -66,21 +65,4 @@ where } /// The default XCM version to set in genesis config. -pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; - -pub fn remove_phantom_fields(value: &mut Value) { - match value { - Value::Object(map) => { - map.remove("phantom"); - - for (_, v) in map.iter_mut() { - remove_phantom_fields(v); - } - }, - Value::Array(arr) => - for v in arr.iter_mut() { - remove_phantom_fields(v); - }, - _ => {}, - } -} +pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; \ No newline at end of file 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 a90601677a..f73146efe2 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -71,10 +71,7 @@ fn coretime_kusama_genesis( broker: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn coretime_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 b4f6b7fab5..cfb01a0481 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -71,10 +71,7 @@ fn coretime_polkadot_genesis( broker: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } fn coretime_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs index 3baa87dad5..d6d52095e3 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -104,10 +104,7 @@ fn encointer_kusama_genesis( encointer_democracy: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn encointer_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 108a9cb020..a6d5c3eb13 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -19,7 +19,6 @@ use crate::*; use cumulus_primitives_core::ParaId; use sp_genesis_builder::PresetId; -use system_parachains_constants::genesis_presets::remove_phantom_fields; fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { let config = RuntimeGenesisConfig { @@ -30,10 +29,7 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { sudo: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn glutton_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 a3af52ff5c..2c70a35d39 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -68,10 +68,7 @@ fn people_kusama_genesis( transaction_payment: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn people_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 782a5df240..50a49e7344 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -68,10 +68,7 @@ fn people_polkadot_genesis( transaction_payment: Default::default(), }; - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); - - config_values + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {