Quick'n dirty Versi chainspec config. (#5412)

* 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 <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Robert Klotzner
2022-04-28 17:10:14 +02:00
committed by GitHub
parent 6a0c11d03c
commit ac23b3f96c
2 changed files with 30 additions and 0 deletions
+2
View File
@@ -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))?,
+28
View File
@@ -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<RococoChainSpec, String> {
))
}
/// Versi staging testnet config.
#[cfg(feature = "rococo-native")]
pub fn versi_staging_testnet_config() -> Result<RococoChainSpec, String> {
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<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)