From 2144701307529619116e563024e5735d6e46e6c5 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Mon, 5 Aug 2024 13:56:45 +0300 Subject: [PATCH 1/6] net_params: Request for public-addr when starting a validator node Signed-off-by: Alexandru Vasile --- substrate/client/cli/src/config.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/substrate/client/cli/src/config.rs b/substrate/client/cli/src/config.rs index 283148a6d6ad..81582e8cd647 100644 --- a/substrate/client/cli/src/config.rs +++ b/substrate/client/cli/src/config.rs @@ -172,7 +172,7 @@ pub trait CliConfiguration: Sized { node_key: NodeKeyConfig, default_listen_port: u16, ) -> Result { - 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, @@ -185,7 +185,17 @@ pub trait CliConfiguration: Sized { ) } else { NetworkConfiguration::new(node_name, client_id, node_key, Some(net_config_dir)) - }) + }; + + if is_validator && network_config.public_addresses.is_empty() { + eprintln!( + "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. From dc5f96dc6166494c54feb92b0137265d657a0949 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Mon, 5 Aug 2024 15:32:47 +0300 Subject: [PATCH 2/6] Add prdoc Signed-off-by: Alexandru Vasile --- polkadot/prdoc/pr_5240.prdoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 polkadot/prdoc/pr_5240.prdoc diff --git a/polkadot/prdoc/pr_5240.prdoc b/polkadot/prdoc/pr_5240.prdoc new file mode 100644 index 000000000000..3622a6ada76b --- /dev/null +++ b/polkadot/prdoc/pr_5240.prdoc @@ -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 From c02d7b32b319bfca42d7ebb2c279f4c57d77de05 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Mon, 5 Aug 2024 17:15:20 +0300 Subject: [PATCH 3/6] cli: Place warns after logger init Signed-off-by: Alexandru Vasile --- substrate/client/cli/src/config.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/substrate/client/cli/src/config.rs b/substrate/client/cli/src/config.rs index 81582e8cd647..9a05f0d9288e 100644 --- a/substrate/client/cli/src/config.rs +++ b/substrate/client/cli/src/config.rs @@ -187,13 +187,8 @@ pub trait CliConfiguration: Sized { NetworkConfiguration::new(node_name, client_id, node_key, Some(net_config_dir)) }; - if is_validator && network_config.public_addresses.is_empty() { - eprintln!( - "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." - ); - } + // TODO: Return error here in the next release. + if is_validator && network_config.public_addresses.is_empty() {} Ok(network_config) } @@ -648,6 +643,14 @@ pub trait CliConfiguration: Sized { logger.init()?; + if config.role.is_authority() && config.network.public_addresses.is_empty() { + warn!( + "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." + ); + } + match fdlimit::raise_fd_limit() { Ok(fdlimit::Outcome::LimitRaised { to, .. }) => if to < RECOMMENDED_OPEN_FILE_DESCRIPTOR_LIMIT { From 5b0295fdcd165bf3d095491d5f5f2747f1d2d59b Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Mon, 5 Aug 2024 17:18:09 +0300 Subject: [PATCH 4/6] Update prdoc location Signed-off-by: Alexandru Vasile --- {polkadot/prdoc => prdoc}/pr_5240.prdoc | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {polkadot/prdoc => prdoc}/pr_5240.prdoc (100%) diff --git a/polkadot/prdoc/pr_5240.prdoc b/prdoc/pr_5240.prdoc similarity index 100% rename from polkadot/prdoc/pr_5240.prdoc rename to prdoc/pr_5240.prdoc From 2c34fb4cbda9c7c593053ef9921ad996e36eb428 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Tue, 6 Aug 2024 16:33:42 +0300 Subject: [PATCH 5/6] cli: Fix clippy Signed-off-by: Alexandru Vasile --- substrate/client/cli/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substrate/client/cli/src/config.rs b/substrate/client/cli/src/config.rs index 9a05f0d9288e..b3c1d0f95159 100644 --- a/substrate/client/cli/src/config.rs +++ b/substrate/client/cli/src/config.rs @@ -188,7 +188,7 @@ pub trait CliConfiguration: Sized { }; // TODO: Return error here in the next release. - if is_validator && network_config.public_addresses.is_empty() {} + // if is_validator && network_config.public_addresses.is_empty() {} Ok(network_config) } From 4f801e9c3a7c9c330d309da75cb44ec23d137478 Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Tue, 6 Aug 2024 19:24:50 +0300 Subject: [PATCH 6/6] cli: Link github issue Signed-off-by: Alexandru Vasile --- substrate/client/cli/src/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/substrate/client/cli/src/config.rs b/substrate/client/cli/src/config.rs index b3c1d0f95159..406d1fb264dd 100644 --- a/substrate/client/cli/src/config.rs +++ b/substrate/client/cli/src/config.rs @@ -187,7 +187,8 @@ pub trait CliConfiguration: Sized { NetworkConfiguration::new(node_name, client_id, node_key, Some(net_config_dir)) }; - // TODO: Return error here in the next release. + // TODO: Return error here in the next release: + // https://github.com/paritytech/polkadot-sdk/issues/5266 // if is_validator && network_config.public_addresses.is_empty() {} Ok(network_config)