From 76deccd239191d89812ea4db566be5776e56359d Mon Sep 17 00:00:00 2001 From: Sander Bosma Date: Tue, 6 Jun 2023 13:39:36 +0200 Subject: [PATCH] chore: deprecate testnet runtimes --- parachain/src/chain_spec/interlay.rs | 2 +- parachain/src/chain_spec/kintsugi.rs | 4 +- parachain/src/chain_spec/testnet_interlay.rs | 73 +++++++++++++++++++ parachain/src/chain_spec/testnet_kintsugi.rs | 75 ++++++++++++++++++++ parachain/src/command.rs | 2 + 5 files changed, 153 insertions(+), 3 deletions(-) diff --git a/parachain/src/chain_spec/interlay.rs b/parachain/src/chain_spec/interlay.rs index 774e9e051d..cf5e64b065 100644 --- a/parachain/src/chain_spec/interlay.rs +++ b/parachain/src/chain_spec/interlay.rs @@ -123,7 +123,7 @@ pub fn interlay_mainnet_config() -> InterlayChainSpec { ) } -fn interlay_mainnet_genesis( +pub fn interlay_mainnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, authorized_oracles: Vec<(AccountId, interlay_runtime::OracleName)>, endowed_accounts: Vec, diff --git a/parachain/src/chain_spec/kintsugi.rs b/parachain/src/chain_spec/kintsugi.rs index 49f3ac4b5c..6f8c50914f 100644 --- a/parachain/src/chain_spec/kintsugi.rs +++ b/parachain/src/chain_spec/kintsugi.rs @@ -4,7 +4,7 @@ use primitives::Rate; pub const PARA_ID: u32 = 2092; -fn kintsugi_properties() -> Map { +pub fn kintsugi_properties() -> Map { let mut properties = Map::new(); let mut token_symbol: Vec = vec![]; let mut token_decimals: Vec = vec![]; @@ -127,7 +127,7 @@ pub fn kintsugi_mainnet_config() -> KintsugiChainSpec { ) } -fn kintsugi_mainnet_genesis( +pub fn kintsugi_mainnet_genesis( invulnerables: Vec<(AccountId, AuraId)>, authorized_oracles: Vec<(AccountId, kintsugi_runtime::OracleName)>, endowed_accounts: Vec, diff --git a/parachain/src/chain_spec/testnet_interlay.rs b/parachain/src/chain_spec/testnet_interlay.rs index 5021259024..bf232a8692 100644 --- a/parachain/src/chain_spec/testnet_interlay.rs +++ b/parachain/src/chain_spec/testnet_interlay.rs @@ -2,6 +2,7 @@ use primitives::Rate; use testnet_interlay_runtime::LoansConfig; use super::*; +use crate::chain_spec::interlay::interlay_mainnet_genesis; fn testnet_properties(bitcoin_network: &str) -> Map { let mut properties = Map::new(); @@ -275,3 +276,75 @@ fn testnet_genesis( }, } } + +pub fn staging_mainnet_config(benchmarking: bool) -> InterlayChainSpec { + InterlayChainSpec::from_genesis( + "interBTC", + "staging_testnet", + ChainType::Live, + move || { + let mut genesis = interlay_mainnet_genesis( + vec![ + // 5EqCiRZGFZ88JCK9FNmak2SkRHSohWpEFpx28vwo5c1m98Xe (//authority/1) + get_authority_keys_from_public_key(hex![ + "7a6868acf544dc5c3f2f9f6f9a5952017bbefb51da41819307fc21cf3efb554d" + ]), + // 5DbwRgYTAtjJ8Mys8ta8RXxWPcSmiyx4dPRsvU1k4TYyk4jq (//authority/2) + get_authority_keys_from_public_key(hex![ + "440e84dd3604be606f3110c21f93a0e981fb93b28288270dcdce8a43c68ff36e" + ]), + // 5GVtSRJmnFxVcFz7jejbCrY2SREhZJZUHuJkm2KS75bTqRF2 (//authority/3) + get_authority_keys_from_public_key(hex![ + "c425b0d9fed64d3bd5be0a6d06053d2bfb72f4983146788f5684aec9f5eb0c7f" + ]), + ], + vec![( + // 5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq (//oracle/1) + get_account_id_from_string("5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq"), + BoundedVec::truncate_from("Interlay".as_bytes().to_vec()), + )], + vec![ + // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) + get_account_id_from_string("5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv"), + // 5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq (//oracle/1) + get_account_id_from_string("5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq"), + // 5FgWDuxgS8VasP6KtvESHUuuDn6L8BTCqbYyFW9mDwAaLtbY (//account/1) + get_account_id_from_string("5FgWDuxgS8VasP6KtvESHUuuDn6L8BTCqbYyFW9mDwAaLtbY"), + // 5H3n25VshwPeMzKhn4gnVEjCEndFsjt85ydW2Vvo8ysy7CnZ (//account/2) + get_account_id_from_string("5H3n25VshwPeMzKhn4gnVEjCEndFsjt85ydW2Vvo8ysy7CnZ"), + // 5GKciEHZWSGxtAihqGjXC6XpXSGNoudDxACuDLbYF1ipygZj (//account/3) + get_account_id_from_string("5GKciEHZWSGxtAihqGjXC6XpXSGNoudDxACuDLbYF1ipygZj"), + // 5GjJ26ffHApgUFLgxKWpWL5T5ppxWjSRJe42PjPNATLvjcJK (//account/4) + get_account_id_from_string("5GjJ26ffHApgUFLgxKWpWL5T5ppxWjSRJe42PjPNATLvjcJK"), + // 5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7 (//account/5) + get_account_id_from_string("5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7"), + ] + .into_iter() + .chain(if benchmarking { + vec![get_account_id_from_seed::("Alice")] + } else { + vec![] + }) + .collect(), + crate::chain_spec::interlay::PARA_ID.into(), + DEFAULT_BITCOIN_CONFIRMATIONS, + ); + + // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) + genesis.sudo.key = Some(get_account_id_from_string( + "5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv", + )); + + genesis + }, + Vec::new(), + None, + None, + None, + Some(testnet_properties(BITCOIN_TESTNET)), + Extensions { + relay_chain: "staging".into(), + para_id: crate::chain_spec::interlay::PARA_ID.into(), + }, + ) +} diff --git a/parachain/src/chain_spec/testnet_kintsugi.rs b/parachain/src/chain_spec/testnet_kintsugi.rs index 1cafa0eb92..40f3dc9288 100644 --- a/parachain/src/chain_spec/testnet_kintsugi.rs +++ b/parachain/src/chain_spec/testnet_kintsugi.rs @@ -2,6 +2,7 @@ use primitives::Rate; use testnet_kintsugi_runtime::LoansConfig; use super::*; +use crate::chain_spec::kintsugi::kintsugi_mainnet_genesis; fn testnet_properties(bitcoin_network: &str) -> Map { let mut properties = Map::new(); @@ -469,3 +470,77 @@ fn testnet_genesis( }, } } + +pub fn staging_mainnet_config(benchmarking: bool) -> KintsugiChainSpec { + KintsugiChainSpec::from_genesis( + "interBTC", + "staging_testnet", + ChainType::Live, + move || { + let mut genesis = kintsugi_mainnet_genesis( + // // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) + // get_account_id_from_string("5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv"), + vec![ + // 5EqCiRZGFZ88JCK9FNmak2SkRHSohWpEFpx28vwo5c1m98Xe (//authority/1) + get_authority_keys_from_public_key(hex![ + "7a6868acf544dc5c3f2f9f6f9a5952017bbefb51da41819307fc21cf3efb554d" + ]), + // 5DbwRgYTAtjJ8Mys8ta8RXxWPcSmiyx4dPRsvU1k4TYyk4jq (//authority/2) + get_authority_keys_from_public_key(hex![ + "440e84dd3604be606f3110c21f93a0e981fb93b28288270dcdce8a43c68ff36e" + ]), + // 5GVtSRJmnFxVcFz7jejbCrY2SREhZJZUHuJkm2KS75bTqRF2 (//authority/3) + get_authority_keys_from_public_key(hex![ + "c425b0d9fed64d3bd5be0a6d06053d2bfb72f4983146788f5684aec9f5eb0c7f" + ]), + ], + vec![( + // 5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq (//oracle/1) + get_account_id_from_string("5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq"), + BoundedVec::truncate_from("Interlay".as_bytes().to_vec()), + )], + vec![ + // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) + get_account_id_from_string("5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv"), + // 5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq (//oracle/1) + get_account_id_from_string("5ECj4iBBi3h8kYzhqLFmzVLafC64UpsXvK7H4ZZyXoVQJdJq"), + // 5FgWDuxgS8VasP6KtvESHUuuDn6L8BTCqbYyFW9mDwAaLtbY (//account/1) + get_account_id_from_string("5FgWDuxgS8VasP6KtvESHUuuDn6L8BTCqbYyFW9mDwAaLtbY"), + // 5H3n25VshwPeMzKhn4gnVEjCEndFsjt85ydW2Vvo8ysy7CnZ (//account/2) + get_account_id_from_string("5H3n25VshwPeMzKhn4gnVEjCEndFsjt85ydW2Vvo8ysy7CnZ"), + // 5GKciEHZWSGxtAihqGjXC6XpXSGNoudDxACuDLbYF1ipygZj (//account/3) + get_account_id_from_string("5GKciEHZWSGxtAihqGjXC6XpXSGNoudDxACuDLbYF1ipygZj"), + // 5GjJ26ffHApgUFLgxKWpWL5T5ppxWjSRJe42PjPNATLvjcJK (//account/4) + get_account_id_from_string("5GjJ26ffHApgUFLgxKWpWL5T5ppxWjSRJe42PjPNATLvjcJK"), + // 5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7 (//account/5) + get_account_id_from_string("5DqzGaydetDXGya818gyuHA7GAjEWRsQN6UWNKpvfgq2KyM7"), + ] + .into_iter() + .chain(if benchmarking { + vec![get_account_id_from_seed::("Alice")] + } else { + vec![] + }) + .collect(), + crate::chain_spec::kintsugi::PARA_ID.into(), + DEFAULT_BITCOIN_CONFIRMATIONS, + ); + + // 5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv (//sudo/1) + genesis.sudo.key = Some(get_account_id_from_string( + "5Ec37KSdjSbGKoQN4evLXrZskjc7jxXYrowPHEtH2MzRC7mv", + )); + + genesis + }, + Vec::new(), + None, + None, + None, + Some(testnet_properties(BITCOIN_TESTNET)), + Extensions { + relay_chain: "staging".into(), + para_id: crate::chain_spec::kintsugi::PARA_ID.into(), + }, + ) +} diff --git a/parachain/src/command.rs b/parachain/src/command.rs index 4b04cc0f2c..36e36bbef3 100644 --- a/parachain/src/command.rs +++ b/parachain/src/command.rs @@ -120,6 +120,8 @@ fn load_spec(id: &str) -> std::result::Result, St DEFAULT_PARA_ID.into(), false, )), + "kintsugi-staging" => Box::new(chain_spec::testnet_kintsugi::staging_mainnet_config(false)), + "interlay-staging" => Box::new(chain_spec::testnet_interlay::staging_mainnet_config(false)), "moonbase-alpha" => Box::new(chain_spec::testnet_kintsugi::staging_testnet_config(1002.into(), false)), path => { if let Some(matches) = Regex::new(r"^rococo-local-([0-9]+)$").unwrap().captures(path) {