mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 08:51:04 +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,
|
LocalTestnet,
|
||||||
/// The PoC-1 testnet.
|
/// The PoC-1 testnet.
|
||||||
PoC1Testnet,
|
PoC1Testnet,
|
||||||
/// The PoC-2 testnet.
|
/// Whatever the current runtime is with the "global testnet" defaults.
|
||||||
PoC2Testnet,
|
StagingTestnet,
|
||||||
/// Custom Genesis file.
|
/// Custom Genesis file.
|
||||||
Custom(String),
|
Custom(String),
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ impl ChainSpec {
|
|||||||
ChainSpec::PoC1Testnet => service::ChainSpec::poc_1_testnet_config()?,
|
ChainSpec::PoC1Testnet => service::ChainSpec::poc_1_testnet_config()?,
|
||||||
ChainSpec::Development => service::ChainSpec::development_config(),
|
ChainSpec::Development => service::ChainSpec::development_config(),
|
||||||
ChainSpec::LocalTestnet => service::ChainSpec::local_testnet_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))?,
|
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,
|
"dev" => ChainSpec::Development,
|
||||||
"local" => ChainSpec::LocalTestnet,
|
"local" => ChainSpec::LocalTestnet,
|
||||||
"poc-1" => ChainSpec::PoC1Testnet,
|
"poc-1" => ChainSpec::PoC1Testnet,
|
||||||
"poc-2" => ChainSpec::PoC2Testnet,
|
"staging" => ChainSpec::StagingTestnet,
|
||||||
s => ChainSpec::Custom(s.into()),
|
s => ChainSpec::Custom(s.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ impl From<ChainSpec> for String {
|
|||||||
ChainSpec::Development => "dev".into(),
|
ChainSpec::Development => "dev".into(),
|
||||||
ChainSpec::LocalTestnet => "local".into(),
|
ChainSpec::LocalTestnet => "local".into(),
|
||||||
ChainSpec::PoC1Testnet => "poc-1".into(),
|
ChainSpec::PoC1Testnet => "poc-1".into(),
|
||||||
ChainSpec::PoC2Testnet => "poc-2".into(),
|
ChainSpec::StagingTestnet => "staging".into(),
|
||||||
ChainSpec::Custom(f) => format!("custom ({})", f),
|
ChainSpec::Custom(f) => format!("custom ({})", f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ args:
|
|||||||
- chain:
|
- chain:
|
||||||
long: chain
|
long: chain
|
||||||
value_name: CHAIN_SPEC
|
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
|
takes_value: true
|
||||||
- pruning:
|
- pruning:
|
||||||
long: pruning
|
long: pruning
|
||||||
@@ -84,7 +84,11 @@ args:
|
|||||||
- telemetry:
|
- telemetry:
|
||||||
short: t
|
short: t
|
||||||
long: telemetry
|
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
|
takes_value: false
|
||||||
- telemetry-url:
|
- telemetry-url:
|
||||||
long: telemetry-url
|
long: telemetry-url
|
||||||
@@ -102,7 +106,7 @@ subcommands:
|
|||||||
- chain:
|
- chain:
|
||||||
long: chain
|
long: chain
|
||||||
value_name: CHAIN_SPEC
|
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
|
takes_value: true
|
||||||
- export-blocks:
|
- export-blocks:
|
||||||
about: Export blocks to a file
|
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")
|
let chain_spec = matches.value_of("chain")
|
||||||
.map(ChainSpec::from)
|
.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()?;
|
let spec = chain_spec.load()?;
|
||||||
info!("Chain specification: {}", spec.name());
|
info!("Chain specification: {}", spec.name());
|
||||||
Ok(spec)
|
Ok((spec, is_global))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn base_path(matches: &clap::ArgMatches) -> PathBuf {
|
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());
|
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);
|
let mut config = service::Configuration::default_with_spec(spec);
|
||||||
|
|
||||||
if let Some(name) = matches.value_of("name") {
|
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 mut runtime = Runtime::new()?;
|
||||||
let executor = runtime.executor();
|
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 name = config.name.clone();
|
||||||
let chain_name = config.chain_spec.name().to_owned();
|
let chain_name = config.chain_spec.name().to_owned();
|
||||||
Some(init_telemetry(TelemetryConfig {
|
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<()> {
|
fn build_spec(matches: &clap::ArgMatches) -> error::Result<()> {
|
||||||
let spec = load_spec(&matches)?;
|
let (spec, _) = load_spec(&matches)?;
|
||||||
info!("Building chain spec");
|
info!("Building chain spec");
|
||||||
let json = spec.to_json(matches.is_present("raw"))?;
|
let json = spec.to_json(matches.is_present("raw"))?;
|
||||||
print!("{}", json);
|
print!("{}", json);
|
||||||
@@ -301,7 +309,7 @@ fn export_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
|||||||
where E: Future<Item=(),Error=()> + Send + 'static
|
where E: Future<Item=(),Error=()> + Send + 'static
|
||||||
{
|
{
|
||||||
let base_path = base_path(matches);
|
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);
|
let mut config = service::Configuration::default_with_spec(spec);
|
||||||
config.database_path = db_path(&base_path).to_string_lossy().into();
|
config.database_path = db_path(&base_path).to_string_lossy().into();
|
||||||
info!("DB path: {}", config.database_path);
|
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<()>
|
fn import_blocks<E>(matches: &clap::ArgMatches, exit: E) -> error::Result<()>
|
||||||
where E: Future<Item=(),Error=()> + Send + 'static
|
where E: Future<Item=(),Error=()> + Send + 'static
|
||||||
{
|
{
|
||||||
let spec = load_spec(&matches)?;
|
let (spec, _) = load_spec(&matches)?;
|
||||||
let base_path = base_path(matches);
|
let base_path = base_path(matches);
|
||||||
let mut config = service::Configuration::default_with_spec(spec);
|
let mut config = service::Configuration::default_with_spec(spec);
|
||||||
config.database_path = db_path(&base_path).to_string_lossy().into();
|
config.database_path = db_path(&base_path).to_string_lossy().into();
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ impl ChainSpec {
|
|||||||
Self::from_embedded(include_bytes!("../res/poc-1.json"))
|
Self::from_embedded(include_bytes!("../res/poc-1.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn poc_2_testnet_config_genesis() -> Genesis {
|
fn staging_testnet_config_genesis() -> Genesis {
|
||||||
let initial_authorities = vec![
|
let initial_authorities = vec![
|
||||||
hex!["82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5"].into(),
|
hex!["82c39b31a2b79a90f8e66e7a77fdb85a4ed5517f2ae39f6a80565e8ecae85cf5"].into(),
|
||||||
hex!["4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7"].into(),
|
hex!["4de37a07567ebcbf8c64568428a835269a566723687058e017b6d69db00a77e7"].into(),
|
||||||
@@ -200,16 +200,16 @@ impl ChainSpec {
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
/// PoC-2 testnet config.
|
/// Staging testnet config.
|
||||||
pub fn poc_2_testnet_config() -> Self {
|
pub fn staging_testnet_config() -> Self {
|
||||||
let boot_nodes = vec![
|
let boot_nodes = vec![
|
||||||
"enode://a93a29fa68d965452bf0ff8c1910f5992fe2273a72a1ee8d3a3482f68512a61974211ba32bb33f051ceb1530b8ba3527fc36224ba6b9910329025e6d9153cf50@104.211.54.233:30333".into(),
|
"enode://a93a29fa68d965452bf0ff8c1910f5992fe2273a72a1ee8d3a3482f68512a61974211ba32bb33f051ceb1530b8ba3527fc36224ba6b9910329025e6d9153cf50@104.211.54.233:30333".into(),
|
||||||
"enode://051b18f63a316c4c5fef4631f8c550ae0adba179153588406fac3e5bbbbf534ebeda1bf475dceda27a531f6cdef3846ab6a010a269aa643a1fec7bff51af66bd@104.211.48.51:30333".into(),
|
"enode://051b18f63a316c4c5fef4631f8c550ae0adba179153588406fac3e5bbbbf534ebeda1bf475dceda27a531f6cdef3846ab6a010a269aa643a1fec7bff51af66bd@104.211.48.51:30333".into(),
|
||||||
"enode://c831ec9011d2c02d2c4620fc88db6d897a40d2f88fd75f47b9e4cf3b243999acb6f01b7b7343474650b34eeb1363041a422a91f1fc3850e43482983ee15aa582@104.211.48.247:30333".into(),
|
"enode://c831ec9011d2c02d2c4620fc88db6d897a40d2f88fd75f47b9e4cf3b243999acb6f01b7b7343474650b34eeb1363041a422a91f1fc3850e43482983ee15aa582@104.211.48.247:30333".into(),
|
||||||
];
|
];
|
||||||
ChainSpec {
|
ChainSpec {
|
||||||
spec: ChainSpecFile { name: "PoC-2 Testnet".to_owned(), boot_nodes },
|
spec: ChainSpecFile { name: "Staging Testnet".to_owned(), boot_nodes },
|
||||||
genesis: GenesisSource::Factory(Self::poc_2_testnet_config_genesis),
|
genesis: GenesisSource::Factory(Self::staging_testnet_config_genesis),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user