mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 18:11:10 +00:00
PoC-2 tweaks (#293)
- Rename poc-2 to staging - Make telemetry default for global chains
This commit is contained in:
committed by
Robert Habermeier
parent
a876d656bd
commit
b239fe0acc
@@ -29,8 +29,8 @@ pub enum ChainSpec {
|
||||
LocalTestnet,
|
||||
/// The PoC-1 testnet.
|
||||
PoC1Testnet,
|
||||
/// The PoC-2 testnet.
|
||||
PoC2Testnet,
|
||||
/// Whatever the current runtime is with the "global testnet" defaults.
|
||||
StagingTestnet,
|
||||
/// Custom Genesis file.
|
||||
Custom(String),
|
||||
}
|
||||
@@ -42,7 +42,7 @@ impl ChainSpec {
|
||||
ChainSpec::PoC1Testnet => service::ChainSpec::poc_1_testnet_config()?,
|
||||
ChainSpec::Development => service::ChainSpec::development_config(),
|
||||
ChainSpec::LocalTestnet => service::ChainSpec::local_testnet_config(),
|
||||
ChainSpec::PoC2Testnet => service::ChainSpec::poc_2_testnet_config(),
|
||||
ChainSpec::StagingTestnet => service::ChainSpec::staging_testnet_config(),
|
||||
ChainSpec::Custom(f) => service::ChainSpec::from_json_file(PathBuf::from(f))?,
|
||||
})
|
||||
}
|
||||
@@ -54,7 +54,7 @@ impl<'a> From<&'a str> for ChainSpec {
|
||||
"dev" => ChainSpec::Development,
|
||||
"local" => ChainSpec::LocalTestnet,
|
||||
"poc-1" => ChainSpec::PoC1Testnet,
|
||||
"poc-2" => ChainSpec::PoC2Testnet,
|
||||
"staging" => ChainSpec::StagingTestnet,
|
||||
s => ChainSpec::Custom(s.into()),
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ impl From<ChainSpec> for String {
|
||||
ChainSpec::Development => "dev".into(),
|
||||
ChainSpec::LocalTestnet => "local".into(),
|
||||
ChainSpec::PoC1Testnet => "poc-1".into(),
|
||||
ChainSpec::PoC2Testnet => "poc-2".into(),
|
||||
ChainSpec::StagingTestnet => "staging".into(),
|
||||
ChainSpec::Custom(f) => format!("custom ({})", f),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ args:
|
||||
- chain:
|
||||
long: chain
|
||||
value_name: CHAIN_SPEC
|
||||
help: Specify the chain specification (one of dev, local or poc-2)
|
||||
help: Specify the chain specification (one of poc-1, dev, local or staging)
|
||||
takes_value: true
|
||||
- pruning:
|
||||
long: pruning
|
||||
@@ -84,7 +84,11 @@ args:
|
||||
- telemetry:
|
||||
short: t
|
||||
long: telemetry
|
||||
help: Should connect to the Polkadot telemetry server (off by default)
|
||||
help: Should connect to the Polkadot telemetry server (telemetry is off by default on local chains)
|
||||
takes_value: false
|
||||
- no-telemetry:
|
||||
long: no-telemetry
|
||||
help: Should not connect to the Polkadot telemetry server (telemetry is on by default on global chains)
|
||||
takes_value: false
|
||||
- telemetry-url:
|
||||
long: telemetry-url
|
||||
@@ -102,7 +106,7 @@ subcommands:
|
||||
- chain:
|
||||
long: chain
|
||||
value_name: CHAIN_SPEC
|
||||
help: Specify the chain specification (one of dev, local or poc-2)
|
||||
help: Specify the chain specification (one of poc-1, dev, local or staging)
|
||||
takes_value: true
|
||||
- export-blocks:
|
||||
about: Export blocks to a file
|
||||
|
||||
+16
-8
@@ -106,13 +106,17 @@ impl substrate_rpc::system::SystemApi for SystemConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_spec(matches: &clap::ArgMatches) -> Result<service::ChainSpec, String> {
|
||||
fn load_spec(matches: &clap::ArgMatches) -> Result<(service::ChainSpec, bool), String> {
|
||||
let chain_spec = matches.value_of("chain")
|
||||
.map(ChainSpec::from)
|
||||
.unwrap_or_else(|| if matches.is_present("dev") { ChainSpec::Development } else { ChainSpec::PoC2Testnet });
|
||||
.unwrap_or_else(|| if matches.is_present("dev") { ChainSpec::Development } else { ChainSpec::StagingTestnet });
|
||||
let is_global = match chain_spec {
|
||||
ChainSpec::PoC1Testnet | ChainSpec::StagingTestnet => true,
|
||||
_ => false,
|
||||
};
|
||||
let spec = chain_spec.load()?;
|
||||
info!("Chain specification: {}", spec.name());
|
||||
Ok(spec)
|
||||
Ok((spec, is_global))
|
||||
}
|
||||
|
||||
fn base_path(matches: &clap::ArgMatches) -> PathBuf {
|
||||
@@ -186,7 +190,7 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
|
||||
return import_blocks(matches, worker.exit_only());
|
||||
}
|
||||
|
||||
let spec = load_spec(&matches)?;
|
||||
let (spec, is_global) = load_spec(&matches)?;
|
||||
let mut config = service::Configuration::default_with_spec(spec);
|
||||
|
||||
if let Some(name) = matches.value_of("name") {
|
||||
@@ -260,7 +264,11 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
|
||||
let mut runtime = Runtime::new()?;
|
||||
let executor = runtime.executor();
|
||||
|
||||
let _guard = if matches.is_present("telemetry") || matches.value_of("telemetry-url").is_some() {
|
||||
let telemetry_enabled =
|
||||
matches.is_present("telemetry")
|
||||
|| matches.value_of("telemetry-url").is_some()
|
||||
|| (is_global && !matches.is_present("no-telemetry"));
|
||||
let _guard = if telemetry_enabled {
|
||||
let name = config.name.clone();
|
||||
let chain_name = config.chain_spec.name().to_owned();
|
||||
Some(init_telemetry(TelemetryConfig {
|
||||
@@ -290,7 +298,7 @@ pub fn run<I, T, W>(args: I, worker: W) -> error::Result<()> where
|
||||
}
|
||||
|
||||
fn build_spec(matches: &clap::ArgMatches) -> error::Result<()> {
|
||||
let spec = load_spec(&matches)?;
|
||||
let (spec, _) = load_spec(&matches)?;
|
||||
info!("Building chain spec");
|
||||
let json = spec.to_json(matches.is_present("raw"))?;
|
||||
print!("{}", json);
|
||||
@@ -301,7 +309,7 @@ fn export_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
||||
where E: Future<Item=(),Error=()> + Send + 'static
|
||||
{
|
||||
let base_path = base_path(matches);
|
||||
let spec = load_spec(&matches)?;
|
||||
let (spec, _) = load_spec(&matches)?;
|
||||
let mut config = service::Configuration::default_with_spec(spec);
|
||||
config.database_path = db_path(&base_path).to_string_lossy().into();
|
||||
info!("DB path: {}", config.database_path);
|
||||
@@ -365,7 +373,7 @@ fn export_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
||||
fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
||||
where E: Future<Item=(),Error=()> + Send + 'static
|
||||
{
|
||||
let spec = load_spec(&matches)?;
|
||||
let (spec, _) = load_spec(&matches)?;
|
||||
let base_path = base_path(matches);
|
||||
let mut config = service::Configuration::default_with_spec(spec);
|
||||
config.database_path = db_path(&base_path).to_string_lossy().into();
|
||||
|
||||
Reference in New Issue
Block a user