From ac23b3f96c1202eeb6bd1c0d8e8669e7669137e5 Mon Sep 17 00:00:00 2001 From: Robert Klotzner Date: Thu, 28 Apr 2022 17:10:14 +0200 Subject: [PATCH] Quick'n dirty Versi chainspec config. (#5412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Quick'n dirty Versi chainspec config. * Right order * Fix wrong variable usage * Fix weird typo. * Update node/service/src/chain_spec.rs Co-authored-by: Bastian Köcher Co-authored-by: Bastian Köcher --- polkadot/cli/src/command.rs | 2 ++ polkadot/node/service/src/chain_spec.rs | 28 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index de6e035520..15f3d18350 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -132,6 +132,8 @@ impl SubstrateCli for Cli { "versi-dev" => Box::new(service::chain_spec::versi_development_config()?), #[cfg(feature = "rococo-native")] "versi-local" => Box::new(service::chain_spec::versi_local_testnet_config()?), + #[cfg(feature = "rococo-native")] + "versi-staging" => Box::new(service::chain_spec::versi_staging_testnet_config()?), #[cfg(not(feature = "rococo-native"))] name if name.starts_with("versi-") => Err(format!("`{}` only supported with `rococo-native` feature enabled.", name))?, diff --git a/polkadot/node/service/src/chain_spec.rs b/polkadot/node/service/src/chain_spec.rs index f87ad97c2e..f12879291a 100644 --- a/polkadot/node/service/src/chain_spec.rs +++ b/polkadot/node/service/src/chain_spec.rs @@ -54,6 +54,8 @@ const KUSAMA_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/" const WESTEND_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; #[cfg(feature = "rococo-native")] const ROCOCO_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; +#[cfg(feature = "rococo-native")] +const VERSI_STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; const DEFAULT_PROTOCOL_ID: &str = "dot"; /// Node `ChainSpec` extensions. @@ -1190,6 +1192,32 @@ pub fn rococo_staging_testnet_config() -> Result { )) } +/// Versi staging testnet config. +#[cfg(feature = "rococo-native")] +pub fn versi_staging_testnet_config() -> Result { + let wasm_binary = rococo::WASM_BINARY.ok_or("Versi development wasm not available")?; + let boot_nodes = vec![]; + + Ok(RococoChainSpec::from_genesis( + "Versi Staging Testnet", + "versi_staging_testnet", + ChainType::Live, + move || RococoGenesisExt { + runtime_genesis_config: rococo_staging_testnet_config_genesis(wasm_binary), + session_length_in_blocks: Some(100), + }, + boot_nodes, + Some( + TelemetryEndpoints::new(vec![(VERSI_STAGING_TELEMETRY_URL.to_string(), 0)]) + .expect("Versi Staging telemetry url is valid; qed"), + ), + Some(DEFAULT_PROTOCOL_ID), + None, + None, + Default::default(), + )) +} + /// Helper function to generate a crypto pair from seed pub fn get_from_seed(seed: &str) -> ::Public { TPublic::Pair::from_string(&format!("//{}", seed), None)