From 1ccb486e2b2236f861f8d4c70296ee257998c8c6 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 3 Sep 2024 00:57:02 +0100 Subject: [PATCH 01/20] use RuntimeGenesisConfig in genesis config presets --- .../src/genesis_config_presets.rs | 28 ++++++++++++----- .../src/genesis_config_presets.rs | 28 ++++++++++++----- .../src/genesis_config_presets.rs | 27 +++++++++++----- .../src/genesis_config_presets.rs | 29 +++++++++++------ .../src/genesis_config_presets.rs | 28 ++++++++++++----- .../src/genesis_config_presets.rs | 25 ++++++++++----- .../src/genesis_config_presets.rs | 25 ++++++++++----- .../encointer/src/genesis_config_presets.rs | 31 ++++++++++++++----- .../src/genesis_config_presets.rs | 12 +++++-- .../src/genesis_config_presets.rs | 24 +++++++++----- .../src/genesis_config_presets.rs | 24 +++++++++----- 11 files changed, 197 insertions(+), 84 deletions(-) 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..d6e5fe06f0 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 @@ -27,24 +27,26 @@ fn asset_hub_kusama_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, ASSET_HUB_KUSAMA_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + transaction_payment: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_KUSAMA_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +58,22 @@ fn asset_hub_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + assets: Default::default(), + foreign_assets: Default::default(), + parachain_system: Default::default(), + vesting: Default::default(), + pool_assets: Default::default(), + }; + + serde_json::to_value(&config).expect("Could not build genesis config.") } pub fn asset_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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..2d69192fb1 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 @@ -43,24 +43,26 @@ fn asset_hub_polkadot_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + transaction_payment: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_POLKADOT_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -72,12 +74,22 @@ fn asset_hub_polkadot_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + assets: Default::default(), + foreign_assets: Default::default(), + parachain_system: Default::default(), + vesting: Default::default(), + pool_assets: Default::default(), + }; + + serde_json::to_value(&config).expect("Could not build genesis config.") } pub fn asset_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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..906c2eb573 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 @@ -27,24 +27,25 @@ fn bridge_hub_kusama_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +57,22 @@ fn bridge_hub_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + bridge_polkadot_grandpa: Default::default(), + bridge_polkadot_parachains: Default::default(), + parachain_system: Default::default(), + transaction_payment: Default::default(), + bridge_polkadot_messages: Default::default(), + }; + + 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 0d549d3c2e..1c5f596928 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 @@ -27,24 +27,25 @@ fn bridge_hub_polkadot_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,17 +57,27 @@ fn bridge_hub_polkadot_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, - "ethereumSystem": EthereumSystemConfig { + bridge_kusama_grandpa: Default::default(), + bridge_kusama_parachains: Default::default(), + bridge_kusama_messages: Default::default(), + ethereum_system: EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), ..Default::default() }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + parachain_system: Default::default(), + transaction_payment: Default::default() + }; + + 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 8ad0b4dcdf..0eb3c52e69 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -27,24 +27,25 @@ fn collectives_polkadot_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: COLLECTIVES_POLKADOT_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +57,23 @@ fn collectives_polkadot_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + alliance: Default::default(), + alliance_motion: Default::default(), + fellowship_treasury: Default::default(), + parachain_system: Default::default(), + transaction_payment: Default::default(), + ambassador_treasury: Default::default(), + }; + + 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/coretime/coretime-kusama/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs index 545d0a87e4..d2ef4bc88d 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -29,24 +29,25 @@ fn coretime_kusama_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, CORETIME_KUSAMA_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: CORETIME_KUSAMA_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -58,12 +59,20 @@ fn coretime_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + parachain_system: Default::default(), + transaction_payment: Default::default(), + broker: Default::default(), + }; + + 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 509a23d52e..8428543096 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -30,24 +30,25 @@ fn coretime_polkadot_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, CORETIME_POLKADOT_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: CORETIME_POLKADOT_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -59,12 +60,20 @@ fn coretime_polkadot_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: None, }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + parachain_system: Default::default(), + transaction_payment: Default::default(), + broker: Default::default(), + }; + + 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 906c77e505..9c71727d70 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -27,24 +27,27 @@ fn encointer_kusama_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + parachain_system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, ENCOINTER_KUSAMA_ED * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + transaction_payment: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ENCOINTER_KUSAMA_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +59,24 @@ fn encointer_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + collective: Default::default(), + membership: Default::default(), + encointer_scheduler: Default::default(), + encointer_ceremonies: Default::default(), + encointer_communities: Default::default(), + encointer_balances: Default::default(), + encointer_faucet: Default::default(), + }; + + 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 aa6b3f67ba..3a4dd1a101 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -20,12 +20,18 @@ use crate::*; use cumulus_primitives_core::ParaId; fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { - serde_json::json!({ - "parachainInfo": ParachainInfoConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + parachain_system: Default::default(), + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - }) + glutton: Default::default(), + sudo: Default::default(), + }; + + 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 74aa13cf80..7dbe384511 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -27,24 +27,25 @@ fn people_kusama_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, PEOPLE_KUSAMA_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: PEOPLE_KUSAMA_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +57,19 @@ fn people_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + parachain_system: Default::default(), + transaction_payment: Default::default() + }; + + 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 6847d7ca73..ad3b21758d 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -27,24 +27,25 @@ fn people_polkadot_genesis( endowed_accounts: Vec, id: ParaId, ) -> serde_json::Value { - serde_json::json!({ - "balances": BalancesConfig { + let config = RuntimeGenesisConfig { + system: Default::default(), + balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, PEOPLE_POLKADOT_ED * 4096 * 4096)) .collect(), }, - "parachainInfo": ParachainInfoConfig { + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, - "collatorSelection": CollatorSelectionConfig { + collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: PEOPLE_POLKADOT_ED * 16, ..Default::default() }, - "session": SessionConfig { + session: SessionConfig { keys: invulnerables .into_iter() .map(|(acc, aura)| { @@ -56,12 +57,19 @@ fn people_polkadot_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), + aura: Default::default(), + aura_ext: Default::default(), + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` - }) + parachain_system: Default::default(), + transaction_payment: Default::default() + }; + + serde_json::to_value(&config).expect("Could not build genesis config.") } pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { From 3f12e7c175ed2e51cecb06b09418bdc7af8fd00e Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 3 Sep 2024 01:03:02 +0100 Subject: [PATCH 02/20] fmt --- .../asset-hub-kusama/src/genesis_config_presets.rs | 11 ++++------- .../src/genesis_config_presets.rs | 11 ++++------- .../bridge-hub-kusama/src/genesis_config_presets.rs | 11 ++++------- .../src/genesis_config_presets.rs | 11 ++++------- .../src/genesis_config_presets.rs | 11 ++++------- .../coretime-kusama/src/genesis_config_presets.rs | 5 +---- .../coretime-polkadot/src/genesis_config_presets.rs | 10 ++-------- .../encointer/src/genesis_config_presets.rs | 11 ++++------- .../glutton-kusama/src/genesis_config_presets.rs | 5 +---- .../people-kusama/src/genesis_config_presets.rs | 13 +++++-------- .../people-polkadot/src/genesis_config_presets.rs | 13 +++++-------- 11 files changed, 38 insertions(+), 74 deletions(-) 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 d6e5fe06f0..ce72b97b71 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 @@ -37,10 +37,7 @@ fn asset_hub_kusama_genesis( .collect(), }, transaction_payment: Default::default(), - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_KUSAMA_ED * 16, @@ -51,9 +48,9 @@ fn asset_hub_kusama_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), 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 2d69192fb1..cb535176a9 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 @@ -53,10 +53,7 @@ fn asset_hub_polkadot_genesis( .collect(), }, transaction_payment: Default::default(), - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ASSET_HUB_POLKADOT_ED * 16, @@ -67,9 +64,9 @@ fn asset_hub_polkadot_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), 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 906c2eb573..c31f83e91b 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 @@ -36,10 +36,7 @@ fn bridge_hub_kusama_genesis( .map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16, @@ -50,9 +47,9 @@ fn bridge_hub_kusama_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), 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 1c5f596928..3a03678872 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 @@ -36,10 +36,7 @@ fn bridge_hub_polkadot_genesis( .map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16, @@ -50,8 +47,8 @@ fn bridge_hub_polkadot_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id + acc.clone(), // account id + acc, // validator id SessionKeys { aura }, // session keys ) }) @@ -74,7 +71,7 @@ fn bridge_hub_polkadot_genesis( // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` parachain_system: Default::default(), - transaction_payment: Default::default() + transaction_payment: Default::default(), }; serde_json::to_value(&config).expect("Could not build genesis config.") 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 0eb3c52e69..aa5b599975 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -36,10 +36,7 @@ fn collectives_polkadot_genesis( .map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: COLLECTIVES_POLKADOT_ED * 16, @@ -50,9 +47,9 @@ fn collectives_polkadot_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), 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 d2ef4bc88d..97e141c728 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -38,10 +38,7 @@ fn coretime_kusama_genesis( .map(|k| (k, CORETIME_KUSAMA_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: CORETIME_KUSAMA_ED * 16, 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 8428543096..6abe16ba65 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -39,10 +39,7 @@ fn coretime_polkadot_genesis( .map(|k| (k, CORETIME_POLKADOT_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: CORETIME_POLKADOT_ED * 16, @@ -62,10 +59,7 @@ fn coretime_polkadot_genesis( }, aura: Default::default(), aura_ext: Default::default(), - polkadot_xcm: PolkadotXcmConfig { - _config: Default::default(), - safe_xcm_version: None, - }, + polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: None }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` parachain_system: Default::default(), diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs index 9c71727d70..e1e336cd31 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -38,10 +38,7 @@ fn encointer_kusama_genesis( .collect(), }, transaction_payment: Default::default(), - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ENCOINTER_KUSAMA_ED * 16, @@ -52,9 +49,9 @@ fn encointer_kusama_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), 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 3a4dd1a101..afbf19dc09 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -23,10 +23,7 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { let config = RuntimeGenesisConfig { system: Default::default(), parachain_system: Default::default(), - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, glutton: Default::default(), sudo: Default::default(), }; 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 7dbe384511..e34ffb0e8c 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -36,10 +36,7 @@ fn people_kusama_genesis( .map(|k| (k, PEOPLE_KUSAMA_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: PEOPLE_KUSAMA_ED * 16, @@ -50,9 +47,9 @@ fn people_kusama_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), @@ -66,7 +63,7 @@ fn people_kusama_genesis( // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` parachain_system: Default::default(), - transaction_payment: Default::default() + transaction_payment: Default::default(), }; serde_json::to_value(&config).expect("Could not build genesis config.") 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 ad3b21758d..44f268b2c1 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -36,10 +36,7 @@ fn people_polkadot_genesis( .map(|k| (k, PEOPLE_POLKADOT_ED * 4096 * 4096)) .collect(), }, - parachain_info: ParachainInfoConfig { - parachain_id: id, - ..Default::default() - }, + parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() }, collator_selection: CollatorSelectionConfig { invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: PEOPLE_POLKADOT_ED * 16, @@ -50,9 +47,9 @@ fn people_polkadot_genesis( .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id - SessionKeys { aura }, // session keys + acc.clone(), // account id + acc, // validator id + SessionKeys { aura }, // session keys ) }) .collect(), @@ -66,7 +63,7 @@ fn people_polkadot_genesis( // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` parachain_system: Default::default(), - transaction_payment: Default::default() + transaction_payment: Default::default(), }; serde_json::to_value(&config).expect("Could not build genesis config.") From 0e9243dfbc05f330b1a5dadd0784d46b4ea15100 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 3 Sep 2024 22:32:26 +0100 Subject: [PATCH 03/20] clippy fix --- .../asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs | 2 +- .../asset-hubs/asset-hub-polkadot/src/genesis_config_presets.rs | 2 +- .../bridge-hubs/bridge-hub-kusama/src/genesis_config_presets.rs | 2 +- .../bridge-hub-polkadot/src/genesis_config_presets.rs | 2 +- .../collectives-polkadot/src/genesis_config_presets.rs | 2 +- .../coretime/coretime-kusama/src/genesis_config_presets.rs | 2 +- .../coretime/coretime-polkadot/src/genesis_config_presets.rs | 2 +- system-parachains/encointer/src/genesis_config_presets.rs | 2 +- .../gluttons/glutton-kusama/src/genesis_config_presets.rs | 2 +- .../people/people-kusama/src/genesis_config_presets.rs | 2 +- .../people/people-polkadot/src/genesis_config_presets.rs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) 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 ce72b97b71..d407b16f75 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 @@ -70,7 +70,7 @@ fn asset_hub_kusama_genesis( pool_assets: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn asset_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 cb535176a9..8758fe8406 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 @@ -86,7 +86,7 @@ fn asset_hub_polkadot_genesis( pool_assets: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn asset_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { 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 c31f83e91b..7d93934864 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,7 +69,7 @@ fn bridge_hub_kusama_genesis( bridge_polkadot_messages: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 3a03678872..5871582d2f 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 @@ -74,7 +74,7 @@ fn bridge_hub_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 aa5b599975..f550357cb5 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -70,7 +70,7 @@ fn collectives_polkadot_genesis( ambassador_treasury: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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/coretime/coretime-kusama/src/genesis_config_presets.rs b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs index 97e141c728..87a8f3c8a0 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -69,7 +69,7 @@ fn coretime_kusama_genesis( broker: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 6abe16ba65..dbac248289 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -67,7 +67,7 @@ fn coretime_polkadot_genesis( broker: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 e1e336cd31..e581d96f66 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -73,7 +73,7 @@ fn encointer_kusama_genesis( encointer_faucet: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 afbf19dc09..1b497656c4 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -28,7 +28,7 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { sudo: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 e34ffb0e8c..18d1457bf1 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -66,7 +66,7 @@ fn people_kusama_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + 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 44f268b2c1..b358926c9c 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -66,7 +66,7 @@ fn people_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(&config).expect("Could not build genesis config.") + serde_json::to_value(config).expect("Could not build genesis config.") } pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { From dcd050a9baaef28b462e0e73ac6b82fd78fd5a45 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 4 Sep 2024 12:26:52 +0100 Subject: [PATCH 04/20] change log --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e9397901..9b50dced3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Changed +- Genesis config presets: Make use of RuntimeGenesisConfig to construct genesis config values for all runtimes ([polkadot-fellows/runtimes#451](https://github.com/polkadot-fellows/runtimes/pull/451)). + ## [1.3.2] 27.08.2024 ### Fixed @@ -356,7 +361,7 @@ Note: This release only affects the following runtimes and is not a full system - Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65)) - Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) - Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) - + ### Fixed - Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) From fbf97c6d0ddbdc1f0e7f652318de551cf128be66 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 4 Sep 2024 12:38:19 +0100 Subject: [PATCH 05/20] Update CHANGELOG.md Co-authored-by: Adrian Catangiu --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b50dced3c..023047be0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -361,7 +361,6 @@ Note: This release only affects the following runtimes and is not a full system - Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65)) - Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) - Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) - ### Fixed - Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) From a09b416a2640f98147320f9659baccc052c3a2bd Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 4 Sep 2024 12:53:18 +0100 Subject: [PATCH 06/20] revert --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 023047be0b..226a04bdcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -361,6 +361,7 @@ Note: This release only affects the following runtimes and is not a full system - Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65)) - Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109)) - Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108)) + ### Fixed - Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56)) From 83a9076f41c61a81b5b157565ba7864d083cbb45 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 4 Sep 2024 13:53:59 +0100 Subject: [PATCH 07/20] nit --- .../asset-hubs/asset-hub-kusama/src/genesis_config_presets.rs | 4 ++-- .../asset-hub-polkadot/src/genesis_config_presets.rs | 4 ++-- .../bridge-hub-kusama/src/genesis_config_presets.rs | 4 ++-- .../collectives-polkadot/src/genesis_config_presets.rs | 4 ++-- .../coretime/coretime-kusama/src/genesis_config_presets.rs | 4 ++-- .../coretime/coretime-polkadot/src/genesis_config_presets.rs | 4 ++-- system-parachains/encointer/src/genesis_config_presets.rs | 4 ++-- .../people/people-kusama/src/genesis_config_presets.rs | 4 ++-- .../people/people-polkadot/src/genesis_config_presets.rs | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) 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 d407b16f75..f53bd536da 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 @@ -55,14 +55,14 @@ fn asset_hub_kusama_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` assets: Default::default(), foreign_assets: Default::default(), parachain_system: Default::default(), 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 8758fe8406..fa6e47b874 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 @@ -71,14 +71,14 @@ fn asset_hub_polkadot_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` assets: Default::default(), foreign_assets: Default::default(), parachain_system: Default::default(), 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 7d93934864..c2e41e748b 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 @@ -54,14 +54,14 @@ fn bridge_hub_kusama_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` bridge_polkadot_grandpa: Default::default(), bridge_polkadot_parachains: Default::default(), parachain_system: Default::default(), 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 f550357cb5..03aba95ca9 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -54,14 +54,14 @@ fn collectives_polkadot_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` alliance: Default::default(), alliance_motion: Default::default(), fellowship_treasury: Default::default(), 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 87a8f3c8a0..7d0e03335a 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -56,14 +56,14 @@ fn coretime_kusama_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` parachain_system: Default::default(), transaction_payment: Default::default(), broker: Default::default(), 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 dbac248289..9520d39168 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -57,11 +57,11 @@ fn coretime_polkadot_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: None }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` parachain_system: Default::default(), transaction_payment: Default::default(), broker: Default::default(), diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs index e581d96f66..cc1bd9007a 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -56,14 +56,14 @@ fn encointer_kusama_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` collective: Default::default(), membership: Default::default(), encointer_scheduler: Default::default(), 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 18d1457bf1..56ce7beab8 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -54,14 +54,14 @@ fn people_kusama_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` parachain_system: Default::default(), transaction_payment: Default::default(), }; 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 b358926c9c..6fd7ab77ae 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -54,14 +54,14 @@ fn people_polkadot_genesis( }) .collect(), }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: Some(SAFE_XCM_VERSION), }, - // no need to pass anything to aura, in fact it will panic if we do. Session will take care - // of this. `aura: Default::default()` parachain_system: Default::default(), transaction_payment: Default::default(), }; From d6cca6487606d44e0aa1d83ff21e2d6337533d3a Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 10 Sep 2024 18:19:01 +0100 Subject: [PATCH 08/20] remove phantom fields in serde_jsons --- .../src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 18 +++++++++++++++--- .../src/genesis_config_presets.rs | 5 ++++- system-parachains/constants/Cargo.toml | 1 + .../constants/src/genesis_presets.rs | 19 +++++++++++++++++++ system-parachains/constants/src/lib.rs | 2 +- .../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, 69 insertions(+), 12 deletions(-) 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 95e36ec6ad..53c72864dc 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 @@ -70,7 +70,10 @@ fn bridge_hub_kusama_genesis( bridge_polkadot_messages: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 b5d5cbb605..dc6ce13146 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 @@ -16,6 +16,7 @@ //! Genesis configs presets for the BridgeHubPolkadot runtime +use sp_std::marker::PhantomData; use crate::*; use sp_genesis_builder::PresetId; use sp_std::vec::Vec; @@ -62,8 +63,16 @@ fn bridge_hub_polkadot_genesis( safe_xcm_version: Some(SAFE_XCM_VERSION), }, bridge_kusama_grandpa: Default::default(), - bridge_kusama_parachains: Default::default(), - bridge_kusama_messages: Default::default(), + bridge_kusama_parachains: BridgeKusamaParachainsConfig { + operating_mode: Default::default(), + owner: None, + phantom: PhantomData::default(), + }, + bridge_kusama_messages: BridgeKusamaMessagesConfig { + operating_mode: Default::default(), + owner: None, + phantom: PhantomData::default(), + }, ethereum_system: EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), @@ -75,7 +84,10 @@ fn bridge_hub_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 49dafbf123..8baac3b588 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -71,7 +71,10 @@ fn collectives_polkadot_genesis( ambassador_treasury: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 17582f7785..40de8e9141 100644 --- a/system-parachains/constants/Cargo.toml +++ b/system-parachains/constants/Cargo.toml @@ -20,6 +20,7 @@ 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 abb1f8b955..8d48c97e94 100644 --- a/system-parachains/constants/src/genesis_presets.rs +++ b/system-parachains/constants/src/genesis_presets.rs @@ -17,6 +17,7 @@ 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,3 +67,21 @@ 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); + } + } + _ => {} + } +} diff --git a/system-parachains/constants/src/lib.rs b/system-parachains/constants/src/lib.rs index 7f31f7e149..d5e23a73a4 100644 --- a/system-parachains/constants/src/lib.rs +++ b/system-parachains/constants/src/lib.rs @@ -55,4 +55,4 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( ); /// Treasury pallet id of the local chain, used to convert into AccountId -pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); +pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); \ 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 5c90bdb26d..9ef7d7d578 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -70,7 +70,10 @@ fn coretime_kusama_genesis( broker: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 4f9f9c1806..409033b064 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -67,7 +67,10 @@ fn coretime_polkadot_genesis( broker: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 107cc818a5..395aae7dcf 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -74,7 +74,10 @@ fn encointer_kusama_genesis( encointer_faucet: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 a6d5c3eb13..108a9cb020 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -19,6 +19,7 @@ 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 { @@ -29,7 +30,10 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { sudo: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 1522c3bf72..fb35867390 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -67,7 +67,10 @@ fn people_kusama_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 45d66b6d1a..d59f215f7b 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -67,7 +67,10 @@ fn people_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { From 098bac9085796b1e8eff02e0409521811edb6b04 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 10 Sep 2024 18:27:37 +0100 Subject: [PATCH 09/20] fmt --- Cargo.lock | 1 + .../src/genesis_config_presets.rs | 15 +++------------ .../constants/src/genesis_presets.rs | 9 ++++----- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a34e028c5d..8d6bfe01df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14930,6 +14930,7 @@ dependencies = [ "polkadot-core-primitives", "polkadot-primitives", "polkadot-runtime-constants", + "serde_json", "smallvec", "sp-core 34.0.0", "sp-runtime 38.0.0", 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 dc6ce13146..3207268d9b 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 @@ -16,10 +16,9 @@ //! Genesis configs presets for the BridgeHubPolkadot runtime -use sp_std::marker::PhantomData; use crate::*; use sp_genesis_builder::PresetId; -use sp_std::vec::Vec; +use sp_std::{marker::PhantomData, vec::Vec}; use system_parachains_constants::genesis_presets::*; const BRIDGE_HUB_POLKADOT_ED: Balance = ExistentialDeposit::get(); @@ -63,16 +62,8 @@ fn bridge_hub_polkadot_genesis( safe_xcm_version: Some(SAFE_XCM_VERSION), }, bridge_kusama_grandpa: Default::default(), - bridge_kusama_parachains: BridgeKusamaParachainsConfig { - operating_mode: Default::default(), - owner: None, - phantom: PhantomData::default(), - }, - bridge_kusama_messages: BridgeKusamaMessagesConfig { - operating_mode: Default::default(), - owner: None, - phantom: PhantomData::default(), - }, + bridge_kusama_parachains: Default::default(), + bridge_kusama_messages: Default::default(), ethereum_system: EthereumSystemConfig { para_id: id, asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(), diff --git a/system-parachains/constants/src/genesis_presets.rs b/system-parachains/constants/src/genesis_presets.rs index 8d48c97e94..8ef68e6ec5 100644 --- a/system-parachains/constants/src/genesis_presets.rs +++ b/system-parachains/constants/src/genesis_presets.rs @@ -76,12 +76,11 @@ pub fn remove_phantom_fields(value: &mut Value) { for (_, v) in map.iter_mut() { remove_phantom_fields(v); } - } - Value::Array(arr) => { + }, + Value::Array(arr) => for v in arr.iter_mut() { remove_phantom_fields(v); - } - } - _ => {} + }, + _ => {}, } } From ac021d919bd3379499558235493ef75b45e95305 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 10 Sep 2024 18:32:50 +0100 Subject: [PATCH 10/20] clippy --- .../bridge-hub-polkadot/src/genesis_config_presets.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3207268d9b..def7ec31a0 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 @@ -18,7 +18,7 @@ use crate::*; use sp_genesis_builder::PresetId; -use sp_std::{marker::PhantomData, vec::Vec}; +use sp_std::vec::Vec; use system_parachains_constants::genesis_presets::*; const BRIDGE_HUB_POLKADOT_ED: Balance = ExistentialDeposit::get(); From 79a3d5b76c4a6c304651f08cbcf0675e27b9fd59 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 10 Sep 2024 18:50:29 +0100 Subject: [PATCH 11/20] fmt --- system-parachains/constants/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/constants/src/lib.rs b/system-parachains/constants/src/lib.rs index d5e23a73a4..7f31f7e149 100644 --- a/system-parachains/constants/src/lib.rs +++ b/system-parachains/constants/src/lib.rs @@ -55,4 +55,4 @@ pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( ); /// Treasury pallet id of the local chain, used to convert into AccountId -pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); \ No newline at end of file +pub const TREASURY_PALLET_ID: PalletId = PalletId(*b"py/trsry"); From 1354b29800db02fa63d8abd808db88be25553af3 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Tue, 10 Sep 2024 23:54:49 +0100 Subject: [PATCH 12/20] empty From c3210cffa7ef503253562d16fb1c71d08b584372 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Wed, 11 Sep 2024 12:48:19 +0100 Subject: [PATCH 13/20] include polkadot xcm version --- .../coretime/coretime-polkadot/src/genesis_config_presets.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 409033b064..0b03d824a1 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -61,7 +61,10 @@ fn coretime_polkadot_genesis( // of this. `aura: Default::default()` aura: Default::default(), aura_ext: Default::default(), - polkadot_xcm: PolkadotXcmConfig { _config: Default::default(), safe_xcm_version: None }, + polkadot_xcm: PolkadotXcmConfig { + _config: Default::default(), + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, parachain_system: Default::default(), transaction_payment: Default::default(), broker: Default::default(), From 414016853d46584a3fda14e597bd18a23eb4de75 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Sat, 12 Oct 2024 17:58:52 +0100 Subject: [PATCH 14/20] remove extra serde_json operation --- .../src/genesis_config_presets.rs | 5 +- .../src/genesis_config_presets.rs | 5 +- .../src/genesis_config_presets.rs | 5 +- system-parachains/constants/Cargo.toml | 1 - .../constants/src/genesis_presets.rs | 18 ----- .../src/genesis_config_presets.rs | 5 +- .../src/genesis_config_presets.rs | 5 +- .../encointer/src/genesis_config_presets.rs | 80 +++++++++---------- .../src/genesis_config_presets.rs | 7 +- .../src/genesis_config_presets.rs | 5 +- .../src/genesis_config_presets.rs | 5 +- 11 files changed, 45 insertions(+), 96 deletions(-) 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 53c72864dc..95e36ec6ad 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 @@ -70,10 +70,7 @@ fn bridge_hub_kusama_genesis( bridge_polkadot_messages: 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 def7ec31a0..b5d5cbb605 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 @@ -75,10 +75,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 8baac3b588..49dafbf123 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -71,10 +71,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..abb1f8b955 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"))] @@ -67,20 +66,3 @@ 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); - }, - _ => {}, - } -} 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 9ef7d7d578..5c90bdb26d 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -70,10 +70,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 0b03d824a1..fd34a77840 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -70,10 +70,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 51eae66dfd..c9e1c1008d 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -15,7 +15,6 @@ // along with Polkadot. If not, see . //! Genesis configs presets for the EncointerKusama runtime - use crate::*; use sp_genesis_builder::PresetId; use sp_std::vec::Vec; @@ -57,39 +56,6 @@ fn encointer_kusama_genesis( }) .collect(), }, - "polkadotXcm": { - "safeXcmVersion": Some(SAFE_XCM_VERSION), - }, - "encointerScheduler": { - "currentPhase": CeremonyPhaseType::Registering, - "currentCeremonyIndex": 1, - "phaseDurations": vec![ - (CeremonyPhaseType::Registering, 604800000u64), // 7d - (CeremonyPhaseType::Assigning, 86400000u64), // 1d - (CeremonyPhaseType::Attesting, 172800000u64), // 2d - ], - }, - "encointerCeremonies": { - "ceremonyReward": BalanceType::from_num(1), - "timeTolerance": 600_000u64, // +-10min - "locationTolerance": 1_000, // [m] - "endorsementTicketsPerBootstrapper": 10, - "endorsementTicketsPerReputable": 5, - "reputationLifetime": 5, - "inactivityTimeout": 5, // idle ceremonies before purging community - "meetupTimeOffset": 0, - }, - "encointerCommunities": { - "minSolarTripTimeS": 1, // [s] - "maxSpeedMps": 1, // [m/s] suggested would be 83m/s for security, - }, - "encointerBalances": { - // for relative adjustment. - "feeConversionFactor": 7_143u32, - }, - "encointerFaucet": { - "reserveAmount": 10_000_000_000_000u128, - }, // no need to pass anything to aura, in fact it will panic if we do. Session will take care // of this. `aura: Default::default()` aura: Default::default(), @@ -100,17 +66,45 @@ fn encointer_kusama_genesis( }, collective: Default::default(), membership: Default::default(), - encointer_scheduler: Default::default(), - encointer_ceremonies: Default::default(), - encointer_communities: Default::default(), - encointer_balances: Default::default(), - encointer_faucet: Default::default(), - }; + encointer_scheduler: EncointerSchedulerConfig { + current_phase: CeremonyPhaseType::Registering, + current_ceremony_index: 1, + phase_durations: vec![ + (CeremonyPhaseType::Registering, 604800000u64), //7d + (CeremonyPhaseType::Assigning, 86400000u64), // 1d + (CeremonyPhaseType::Attesting, 172800000u64), // 2d - let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); - remove_phantom_fields(&mut config_values); + ], + _config: Default::default(), + }, + encointer_ceremonies: EncointerCeremoniesConfig { + ceremony_reward: BalanceType::from_num(1), + time_tolerance: 600_000u64, // +-10min + location_tolerance: 1_000, // [m] + endorsement_tickets_per_bootstrapper: 10, + endorsement_tickets_per_reputable: 5, + reputation_lifetime: 5, + inactivity_timeout: 5, // idle ceremonies before purging community + meetup_time_offset: 0, + _config: Default::default(), + }, + encointer_communities: EncointerCommunitiesConfig { + min_solar_trip_time_s: 1, // [s] + max_speed_mps: 1, // [m/s] suggested would be 83m/s for security, + _config: Default::default(), + }, + encointer_balances: EncointerBalancesConfig { + fee_conversion_factor: 7_143u128, + _config: Default::default(), + }, + encointer_faucet: EncointerFaucetConfig{ + reserve_amount: 10_000_000_000_000u128, + _config: Default::default(), + }, + encointer_democracy: Default::default(), + }; - 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..51a43c24fe 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -19,8 +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 { system: Default::default(), @@ -30,10 +28,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 fb35867390..1522c3bf72 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -67,10 +67,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 d59f215f7b..45d66b6d1a 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -67,10 +67,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 { From 67369512d264ad7146a1c2298c902ab6c791369a Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Sat, 12 Oct 2024 18:08:48 +0100 Subject: [PATCH 15/20] remove serde_json from toml --- Cargo.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d0e091b201..4f4d467771 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14998,7 +14998,6 @@ dependencies = [ "polkadot-core-primitives", "polkadot-primitives", "polkadot-runtime-constants", - "serde_json", "smallvec", "sp-core 34.0.0", "sp-runtime 38.0.0", From f725e7a2e3bb179b57c9a22cae04f22dd2c7a308 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Sat, 12 Oct 2024 21:35:15 +0100 Subject: [PATCH 16/20] bring back remove_phantom_fields for now --- Cargo.lock | 1 + .../src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 5 ++++- system-parachains/constants/Cargo.toml | 1 + .../constants/src/genesis_presets.rs | 18 ++++++++++++++++++ .../src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 5 ++++- .../encointer/src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 7 ++++++- .../src/genesis_config_presets.rs | 5 ++++- .../src/genesis_config_presets.rs | 5 ++++- 12 files changed, 58 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f4d467771..d0e091b201 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14998,6 +14998,7 @@ dependencies = [ "polkadot-core-primitives", "polkadot-primitives", "polkadot-runtime-constants", + "serde_json", "smallvec", "sp-core 34.0.0", "sp-runtime 38.0.0", 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 95e36ec6ad..53c72864dc 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 @@ -70,7 +70,10 @@ fn bridge_hub_kusama_genesis( bridge_polkadot_messages: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 b5d5cbb605..def7ec31a0 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 @@ -75,7 +75,10 @@ fn bridge_hub_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 49dafbf123..8baac3b588 100644 --- a/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/collectives/collectives-polkadot/src/genesis_config_presets.rs @@ -71,7 +71,10 @@ fn collectives_polkadot_genesis( ambassador_treasury: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 17582f7785..40de8e9141 100644 --- a/system-parachains/constants/Cargo.toml +++ b/system-parachains/constants/Cargo.toml @@ -20,6 +20,7 @@ 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 abb1f8b955..8ef68e6ec5 100644 --- a/system-parachains/constants/src/genesis_presets.rs +++ b/system-parachains/constants/src/genesis_presets.rs @@ -17,6 +17,7 @@ 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,3 +67,20 @@ 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); + }, + _ => {}, + } +} 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 5c90bdb26d..9ef7d7d578 100644 --- a/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-kusama/src/genesis_config_presets.rs @@ -70,7 +70,10 @@ fn coretime_kusama_genesis( broker: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 fd34a77840..0b03d824a1 100644 --- a/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/coretime/coretime-polkadot/src/genesis_config_presets.rs @@ -70,7 +70,10 @@ fn coretime_polkadot_genesis( broker: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 c9e1c1008d..c09eb07069 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -104,7 +104,10 @@ fn encointer_kusama_genesis( encointer_democracy: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 51a43c24fe..108a9cb020 100644 --- a/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs +++ b/system-parachains/gluttons/glutton-kusama/src/genesis_config_presets.rs @@ -19,6 +19,8 @@ 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 { system: Default::default(), @@ -28,7 +30,10 @@ fn glutton_kusama_genesis(id: ParaId) -> serde_json::Value { sudo: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 1522c3bf72..fb35867390 100644 --- a/system-parachains/people/people-kusama/src/genesis_config_presets.rs +++ b/system-parachains/people/people-kusama/src/genesis_config_presets.rs @@ -67,7 +67,10 @@ fn people_kusama_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } 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 45d66b6d1a..d59f215f7b 100644 --- a/system-parachains/people/people-polkadot/src/genesis_config_presets.rs +++ b/system-parachains/people/people-polkadot/src/genesis_config_presets.rs @@ -67,7 +67,10 @@ fn people_polkadot_genesis( transaction_payment: Default::default(), }; - serde_json::to_value(config).expect("Could not build genesis config.") + let mut config_values = serde_json::to_value(config).expect("Could not build genesis config."); + remove_phantom_fields(&mut config_values); + + config_values } pub fn people_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value { From ef78c8ea52769418f1bafbf9485755d13c62905f Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Sat, 12 Oct 2024 22:40:41 +0100 Subject: [PATCH 17/20] fmt --- rust-toolchain.toml | 2 ++ .../encointer/src/genesis_config_presets.rs | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000..c45546b643 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.77.0" \ No newline at end of file diff --git a/system-parachains/encointer/src/genesis_config_presets.rs b/system-parachains/encointer/src/genesis_config_presets.rs index c09eb07069..5cb44aa922 100644 --- a/system-parachains/encointer/src/genesis_config_presets.rs +++ b/system-parachains/encointer/src/genesis_config_presets.rs @@ -72,15 +72,14 @@ fn encointer_kusama_genesis( phase_durations: vec![ (CeremonyPhaseType::Registering, 604800000u64), //7d (CeremonyPhaseType::Assigning, 86400000u64), // 1d - (CeremonyPhaseType::Attesting, 172800000u64), // 2d - + (CeremonyPhaseType::Attesting, 172800000u64), // 2d ], _config: Default::default(), }, encointer_ceremonies: EncointerCeremoniesConfig { ceremony_reward: BalanceType::from_num(1), - time_tolerance: 600_000u64, // +-10min - location_tolerance: 1_000, // [m] + time_tolerance: 600_000u64, // +-10min + location_tolerance: 1_000, // [m] endorsement_tickets_per_bootstrapper: 10, endorsement_tickets_per_reputable: 5, reputation_lifetime: 5, @@ -97,7 +96,7 @@ fn encointer_kusama_genesis( fee_conversion_factor: 7_143u128, _config: Default::default(), }, - encointer_faucet: EncointerFaucetConfig{ + encointer_faucet: EncointerFaucetConfig { reserve_amount: 10_000_000_000_000u128, _config: Default::default(), }, From b83513acfb10ec701fcd0360dbd64567691aa75b Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Sat, 12 Oct 2024 22:41:52 +0100 Subject: [PATCH 18/20] fmt --- rust-toolchain.toml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 rust-toolchain.toml diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index c45546b643..0000000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "1.77.0" \ No newline at end of file From de274404bf169e474249acf8a29768355488d61b Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Thu, 26 Dec 2024 11:16:16 +0100 Subject: [PATCH 19/20] 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 { From ceedebb5e13ca680b49e8a23c07edb402219fe82 Mon Sep 17 00:00:00 2001 From: dharjeezy Date: Thu, 26 Dec 2024 11:16:43 +0100 Subject: [PATCH 20/20] fmt --- system-parachains/constants/src/genesis_presets.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-parachains/constants/src/genesis_presets.rs b/system-parachains/constants/src/genesis_presets.rs index a06ebb1943..abb1f8b955 100644 --- a/system-parachains/constants/src/genesis_presets.rs +++ b/system-parachains/constants/src/genesis_presets.rs @@ -65,4 +65,4 @@ where } /// The default XCM version to set in genesis config. -pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; \ No newline at end of file +pub const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;