From 8cf82348c9307295d527f04d2d6374a8b97b6f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Tue, 4 Aug 2020 10:47:29 +0100 Subject: [PATCH] revert enabling authority discovery by default --- cli/src/cli.rs | 9 +++------ cli/src/command.rs | 4 ++-- node/service/src/lib.rs | 14 +++++++------- node/test-service/src/lib.rs | 8 ++++---- service/src/lib.rs | 24 ++++++++++++------------ 5 files changed, 28 insertions(+), 31 deletions(-) diff --git a/cli/src/cli.rs b/cli/src/cli.rs index 0287a333123a..d3ec195a97ff 100644 --- a/cli/src/cli.rs +++ b/cli/src/cli.rs @@ -59,10 +59,7 @@ pub struct RunCmd { #[structopt(long = "force-westend")] pub force_westend: bool, - /// Disable the authority discovery module on validator or sentry nodes. - /// - /// Enabled by default on validator and sentry nodes. Always disabled on - /// non validator or sentry nodes. + /// Enable the authority discovery module on validator or sentry nodes. /// /// When enabled: /// @@ -73,8 +70,8 @@ pub struct RunCmd { /// (2) As a validator or sentry node: Discover addresses of validators or /// addresses of their sentry nodes and maintain a permanent connection /// to a subset. - #[structopt(long = "disable-authority-discovery")] - pub authority_discovery_disabled: bool, + #[structopt(long = "enable-authority-discovery")] + pub authority_discovery_enabled: bool, /// Setup a GRANDPA scheduled voting pause. /// diff --git a/cli/src/command.rs b/cli/src/command.rs index 31880768a1bb..cb64ae083865 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -111,7 +111,7 @@ pub fn run() -> Result<()> { set_default_ss58_version(chain_spec); - let authority_discovery_disabled = cli.run.authority_discovery_disabled; + let authority_discovery_enabled = cli.run.authority_discovery_enabled; let grandpa_pause = if cli.run.grandpa_pause.is_empty() { None } else { @@ -135,7 +135,7 @@ pub fn run() -> Result<()> { _ => builder.build_full( None, None, - authority_discovery_disabled, + authority_discovery_enabled, 6000, grandpa_pause, ), diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 01c70f57850b..40e327794db8 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -300,7 +300,7 @@ fn new_full( mut config: Configuration, collating_for: Option<(CollatorId, ParaId)>, _max_block_data_size: Option, - _authority_discovery_disabled: bool, + _authority_discovery_enabled: bool, _slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) -> Result<( @@ -643,7 +643,7 @@ pub fn polkadot_new_full( config: Configuration, collating_for: Option<(CollatorId, ParaId)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) @@ -661,7 +661,7 @@ pub fn polkadot_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, )?; @@ -675,7 +675,7 @@ pub fn kusama_new_full( config: Configuration, collating_for: Option<(CollatorId, ParaId)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) -> Result<( @@ -693,7 +693,7 @@ pub fn kusama_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, )?; @@ -707,7 +707,7 @@ pub fn westend_new_full( config: Configuration, collating_for: Option<(CollatorId, ParaId)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) @@ -725,7 +725,7 @@ pub fn westend_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, )?; diff --git a/node/test-service/src/lib.rs b/node/test-service/src/lib.rs index e45b93146444..6df315570a11 100644 --- a/node/test-service/src/lib.rs +++ b/node/test-service/src/lib.rs @@ -64,7 +64,7 @@ pub fn polkadot_test_new_full( config: Configuration, collating_for: Option<(CollatorId, ParaId)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, ) -> Result< ( @@ -81,7 +81,7 @@ pub fn polkadot_test_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, None, true, @@ -200,9 +200,9 @@ pub fn run_test_node( > { let config = node_config(storage_update_func, task_executor, key, boot_nodes); let multiaddr = config.network.listen_addresses[0].clone(); - let authority_discovery_disabled = true; + let authority_discovery_enabled = false; let (task_manager, client, handles, network, rpc_handlers) = - polkadot_test_new_full(config, None, None, authority_discovery_disabled, 6000) + polkadot_test_new_full(config, None, None, authority_discovery_enabled, 6000) .expect("could not create Polkadot test service"); let peer_id = network.local_peer_id().clone(); diff --git a/service/src/lib.rs b/service/src/lib.rs index 2aaa2971fd21..7ae29255a769 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -271,7 +271,7 @@ pub fn new_full( mut config: Configuration, collating_for: Option<(CollatorId, parachain::Id)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, test: bool, @@ -474,7 +474,7 @@ pub fn new_full( } if matches!(role, Role::Authority{..} | Role::Sentry{..}) { - if !authority_discovery_disabled { + if authority_discovery_enabled { let (sentries, authority_discovery_role) = match role { Role::Authority { ref sentry_nodes } => ( sentry_nodes.clone(), @@ -711,7 +711,7 @@ pub fn polkadot_new_full( config: Configuration, collating_for: Option<(CollatorId, parachain::Id)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) @@ -729,7 +729,7 @@ pub fn polkadot_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false, @@ -744,7 +744,7 @@ pub fn kusama_new_full( config: Configuration, collating_for: Option<(CollatorId, parachain::Id)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) -> Result<( @@ -762,7 +762,7 @@ pub fn kusama_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false, @@ -777,7 +777,7 @@ pub fn westend_new_full( config: Configuration, collating_for: Option<(CollatorId, parachain::Id)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) @@ -795,7 +795,7 @@ pub fn westend_new_full( config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false, @@ -851,7 +851,7 @@ impl NodeBuilder { self, collating_for: Option<(CollatorId, parachain::Id)>, max_block_data_size: Option, - authority_discovery_disabled: bool, + authority_discovery_enabled: bool, slot_duration: u64, grandpa_pause: Option<(u32, u32)>, ) -> Result { @@ -860,7 +860,7 @@ impl NodeBuilder { self.config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false, @@ -870,7 +870,7 @@ impl NodeBuilder { self.config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false, @@ -880,7 +880,7 @@ impl NodeBuilder { self.config, collating_for, max_block_data_size, - authority_discovery_disabled, + authority_discovery_enabled, slot_duration, grandpa_pause, false,