Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/net_params: Warn on empty public-addr when starting a validator node #5240

Merged
merged 6 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions polkadot/prdoc/pr_5240.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
title: Warn on empty public-addr when starting a validator node

doc:
- audience: Node Operator
description: |
This PR shows a warning when the `--public-addr` CLI parameter is missing for validators.
In the future, we'll transform this warning into a hard failure.
Validators are encouraged to provide this parameter for better availability over the network.

crates:
- name: sc-cli
bump: patch
14 changes: 12 additions & 2 deletions substrate/client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
node_key: NodeKeyConfig,
default_listen_port: u16,
) -> Result<NetworkConfiguration> {
Ok(if let Some(network_params) = self.network_params() {
let network_config = if let Some(network_params) = self.network_params() {
network_params.network_config(
chain_spec,
is_dev,
Expand All @@ -185,7 +185,17 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
)
} else {
NetworkConfiguration::new(node_name, client_id, node_key, Some(net_config_dir))
})
};

if is_validator && network_config.public_addresses.is_empty() {
eprintln!(
lexnv marked this conversation as resolved.
Show resolved Hide resolved
"WARNING: No public address specified, validator node may not be reachable.
Consider setting `--public-addr` to the public IP address of this node.
This will become a hard requirement in future versions."
);
}

Ok(network_config)
}

/// Get the keystore configuration.
Expand Down
Loading