From e61473f1780b1a8d53fb179662c5c3f611a6aa6a Mon Sep 17 00:00:00 2001 From: Manuel Mauro Date: Thu, 23 Jan 2025 13:17:20 +0100 Subject: [PATCH] refactor: :recycle: correctly use with_genesis_config_preset_name in client code --- Cargo.lock | 1 + node/service/Cargo.toml | 1 + node/service/src/chain_spec/moonbase.rs | 43 +----------------------- node/service/src/chain_spec/moonbeam.rs | 41 +--------------------- node/service/src/chain_spec/moonriver.rs | 41 +--------------------- 5 files changed, 5 insertions(+), 122 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 952f4b6cf5..6a8ca31c0b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7046,6 +7046,7 @@ dependencies = [ "sp-consensus", "sp-core", "sp-externalities", + "sp-genesis-builder", "sp-inherents", "sp-io", "sp-keystore", diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index a749ab2307..068340ac79 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -93,6 +93,7 @@ sp-block-builder = { workspace = true, features = ["std"] } sp-blockchain = { workspace = true } sp-consensus = { workspace = true } sp-core = { workspace = true, features = ["std"] } +sp-genesis-builder = { workspace = true, features = ["std"] } sp-inherents = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } sp-keystore = { workspace = true, features = ["std"] } diff --git a/node/service/src/chain_spec/moonbase.rs b/node/service/src/chain_spec/moonbase.rs index 02d2e11a48..b2a90873f2 100644 --- a/node/service/src/chain_spec/moonbase.rs +++ b/node/service/src/chain_spec/moonbase.rs @@ -114,48 +114,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { ) .expect("Provided valid json map"), ) - .with_genesis_config(testnet_genesis( - // Alith is Sudo - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - // Treasury Council members: Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - // Open Tech committee members: Alith and Baltathar - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - ], - // Collator Candidates - vec![ - // Alice -> Alith - ( - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - get_from_seed::("Alice"), - 1_000 * UNIT, - ), - // Bob -> Baltathar - ( - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - get_from_seed::("Bob"), - 1_000 * UNIT, - ), - ], - // Delegations - vec![], - // Endowed: Alith, Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - 3_000_000 * UNIT, - para_id, - 1280, //ChainId - )) + .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) .build() } diff --git a/node/service/src/chain_spec/moonbeam.rs b/node/service/src/chain_spec/moonbeam.rs index 0a458a9fd3..7a2ee3dc67 100644 --- a/node/service/src/chain_spec/moonbeam.rs +++ b/node/service/src/chain_spec/moonbeam.rs @@ -108,46 +108,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { ) .expect("Provided valid json map"), ) - .with_genesis_config(testnet_genesis( - // Treasury Council members: Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - // Open Tech committee members: Alith and Baltathar - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - ], - // Collator Candidates - vec![ - // Alice -> Alith - ( - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - get_from_seed::("Alice"), - 20_000 * GLMR * SUPPLY_FACTOR, - ), - // Bob -> Baltathar - ( - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - get_from_seed::("Bob"), - 20_000 * GLMR * SUPPLY_FACTOR, - ), - ], - // Delegations - vec![], - // Endowed: Alith, Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - 1_500_000 * GLMR * SUPPLY_FACTOR, - para_id, - 1280, //ChainId - )) + .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) .build() } diff --git a/node/service/src/chain_spec/moonriver.rs b/node/service/src/chain_spec/moonriver.rs index 364d80e86a..e35b3b0c00 100644 --- a/node/service/src/chain_spec/moonriver.rs +++ b/node/service/src/chain_spec/moonriver.rs @@ -106,46 +106,7 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec { ) .expect("Provided valid json map"), ) - .with_genesis_config(testnet_genesis( - // Treasury Council members: Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - // Open Tech committee members: Alith and Baltathar - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - ], - // Collator Candidates - vec![ - // Alice -> Alith - ( - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - get_from_seed::("Alice"), - 100_000 * MOVR, - ), - // Bob -> Baltathar - ( - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - get_from_seed::("Bob"), - 100_000 * MOVR, - ), - ], - // Delegations - vec![], - // Endowed: Alith, Baltathar, Charleth and Dorothy - vec![ - AccountId::from(hex!("f24FF3a9CF04c71Dbc94D0b566f7A27B94566cac")), - AccountId::from(hex!("3Cd0A705a2DC65e5b1E1205896BaA2be8A07c6e0")), - AccountId::from(hex!("798d4Ba9baf0064Ec19eB4F0a1a45785ae9D6DFc")), - AccountId::from(hex!("773539d4Ac0e786233D90A233654ccEE26a613D9")), - ], - 3_000_000 * MOVR, - para_id, - 1280, //ChainId - )) + .with_genesis_config_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET) .build() }