Skip to content
Snippets Groups Projects
Commit 59fb7ff5 authored by Sebastian Kunert's avatar Sebastian Kunert Committed by GitHub
Browse files

help text examples + clean up (#2418)

parent a79096f1
No related merge requests found
......@@ -1324,6 +1324,27 @@ dependencies = [
"xcm-executor",
]
[[package]]
name = "color-print"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2a5e6504ed8648554968650feecea00557a3476bc040d0ffc33080e66b646d0"
dependencies = [
"color-print-proc-macro",
]
[[package]]
name = "color-print-proc-macro"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51beaa537d73d2d1ff34ee70bc095f170420ab2ec5d687ecd3ec2b0d092514b"
dependencies = [
"nom",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "comfy-table"
version = "6.0.0"
......@@ -7204,6 +7225,7 @@ name = "parachain-template-node"
version = "0.1.0"
dependencies = [
"clap 4.1.13",
"color-print",
"cumulus-client-cli",
"cumulus-client-consensus-aura",
"cumulus-client-consensus-common",
......@@ -8464,6 +8486,7 @@ dependencies = [
"bridge-hub-rococo-runtime",
"clap 4.1.13",
"collectives-polkadot-runtime",
"color-print",
"contracts-rococo-runtime",
"cumulus-client-cli",
"cumulus-client-consensus-aura",
......
......@@ -114,7 +114,7 @@ fn build_overseer<'a>(
.collation_generation(CollationGenerationSubsystem::new(Metrics::register(registry)?))
.collator_protocol({
let side = ProtocolSide::Collator(
network_service.local_peer_id().clone(),
network_service.local_peer_id(),
collator_pair,
collation_req_receiver,
Metrics::register(registry)?,
......@@ -129,8 +129,8 @@ fn build_overseer<'a>(
peer_set_protocol_names.clone(),
))
.network_bridge_tx(NetworkBridgeTxSubsystem::new(
network_service.clone(),
authority_discovery_service.clone(),
network_service,
authority_discovery_service,
network_bridge_metrics,
req_protocol_names,
peer_set_protocol_names,
......@@ -170,7 +170,7 @@ pub(crate) fn spawn_overseer(
e
})?;
let overseer_handle = Handle::new(overseer_handle.clone());
let overseer_handle = Handle::new(overseer_handle);
{
let handle = overseer_handle.clone();
task_manager.spawn_essential_handle().spawn_blocking(
......
......@@ -69,7 +69,7 @@ fn build_authority_discovery_service<Block: BlockT>(
network.clone(),
Box::pin(dht_event_stream),
authority_discovery_role,
prometheus_registry.clone(),
prometheus_registry,
);
task_manager.spawn_handle().spawn(
......@@ -150,9 +150,10 @@ async fn new_minimal_relay_chain(
let (collation_req_receiver, available_data_req_receiver) =
build_request_response_protocol_receivers(&request_protocol_names, &mut config);
let best_header = relay_chain_rpc_client.chain_get_header(None).await?.ok_or_else(|| {
RelayChainError::RpcCallError("Unable to fetch best header".to_string().into())
})?;
let best_header = relay_chain_rpc_client
.chain_get_header(None)
.await?
.ok_or_else(|| RelayChainError::RpcCallError("Unable to fetch best header".to_string()))?;
let (network, network_starter, sync_oracle) =
build_collator_network(&config, task_manager.spawn_handle(), genesis_hash, best_header)
.map_err(|e| RelayChainError::Application(Box::new(e) as Box<_>))?;
......
......@@ -381,7 +381,7 @@ impl ReconnectingWebsocketWorker {
}
if client_manager.connect_to_new_rpc_server().await.is_err() {
return Err(format!("Unable to find valid external RPC server, shutting down."))
return Err("Unable to find valid external RPC server, shutting down.".to_string())
};
for item in requests_to_retry.into_iter() {
......
......@@ -52,7 +52,7 @@ substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "master", features = ["rococo-native"] }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
......@@ -64,6 +64,7 @@ cumulus-client-service = { path = "../../client/service" }
cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" }
cumulus-relay-chain-interface = { path = "../../client/relay-chain-interface" }
color-print = "0.3.4"
[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -44,12 +44,25 @@ pub enum Subcommand {
TryRuntime,
}
const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
r#"<bold><underline>Examples:</></>
<bold>parachain-template-node build-spec --disable-default-bootnode > plain-parachain-chainspec.json</>
Export a chainspec for a local testnet in json format.
<bold>parachain-template-node --chain plain-parachain-chainspec.json --tmp -- --chain rococo-local</>
Launch a full node with chain specification loaded from plain-parachain-chainspec.json.
<bold>parachain-template-node</>
Launch a full node with default parachain <italic>local-testnet</> and relay chain <italic>rococo-local</>.
<bold>parachain-template-node --collator</>
Launch a collator with default parachain <italic>local-testnet</> and relay chain <italic>rococo-local</>.
"#
);
#[derive(Debug, clap::Parser)]
#[command(
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
)]
#[clap(after_help = AFTER_HELP_EXAMPLE)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
......
......@@ -87,6 +87,7 @@ cumulus-client-service = { path = "../client/service" }
cumulus-primitives-core = { path = "../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../primitives/parachain-inherent" }
cumulus-relay-chain-interface = { path = "../client/relay-chain-interface" }
color-print = "0.3.4"
[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
......
......@@ -64,12 +64,22 @@ pub enum Subcommand {
TryRuntime,
}
const AFTER_HELP_EXAMPLE: &str = color_print::cstr!(
r#"<bold><underline>Examples:</></>
<bold>polkadot-parachain --chain statemint --sync warp -- --chain polkadot --sync warp</>
Launch a warp-syncing full node of the <italic>statemint</> parachain on the <italic>polkadot</> relay chain.
<bold>polkadot-parachain --chain statemint --sync warp --relay-chain-rpc-url ws://rpc.example.com -- --chain polkadot</>
Launch a warp-syncing full node of the <italic>statemint</> parachain on the <italic>polkadot</> relay chain.
Uses <italic>ws://rpc.example.com</> as remote relay chain node.
"#
);
#[derive(Debug, clap::Parser)]
#[command(
propagate_version = true,
args_conflicts_with_subcommands = true,
subcommand_negates_reqs = true
)]
#[clap(after_help = AFTER_HELP_EXAMPLE)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment