Revert "revert enabling authority discovery by default (#1532)" (#1807)

This reverts commit a7b6c91f80.

The authority discovery module was initially enabled by default on
validator and sentry nodes with commit 59f5eb4. This change was later on
reverted in a7b6c91. With this commit the authority discovery module is
again enabled by default.
This commit is contained in:
Max Inden
2020-10-13 14:09:10 +02:00
committed by GitHub
parent 23b7542fee
commit 60e66f6af0
4 changed files with 21 additions and 18 deletions
+6 -3
View File
@@ -83,7 +83,10 @@ pub struct RunCmd {
#[structopt(long = "force-rococo")] #[structopt(long = "force-rococo")]
pub force_rococo: bool, pub force_rococo: bool,
/// Enable the authority discovery module on validator or sentry nodes. /// 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.
/// ///
/// When enabled: /// When enabled:
/// ///
@@ -94,8 +97,8 @@ pub struct RunCmd {
/// (2) As a validator or sentry node: Discover addresses of validators or /// (2) As a validator or sentry node: Discover addresses of validators or
/// addresses of their sentry nodes and maintain a permanent connection /// addresses of their sentry nodes and maintain a permanent connection
/// to a subset. /// to a subset.
#[structopt(long = "enable-authority-discovery")] #[structopt(long = "disable-authority-discovery")]
pub authority_discovery_enabled: bool, pub authority_discovery_disabled: bool,
/// Setup a GRANDPA scheduled voting pause. /// Setup a GRANDPA scheduled voting pause.
/// ///
+4 -4
View File
@@ -126,7 +126,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec); set_default_ss58_version(chain_spec);
let authority_discovery_enabled = cli.run.authority_discovery_enabled; let authority_discovery_disabled = cli.run.authority_discovery_disabled;
let grandpa_pause = if cli.run.grandpa_pause.is_empty() { let grandpa_pause = if cli.run.grandpa_pause.is_empty() {
None None
} else { } else {
@@ -148,7 +148,7 @@ pub fn run() -> Result<()> {
Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager), Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager),
_ => service::build_full( _ => service::build_full(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
grandpa_pause, grandpa_pause,
).map(|full| full.task_manager), ).map(|full| full.task_manager),
} }
@@ -164,7 +164,7 @@ pub fn run() -> Result<()> {
set_default_ss58_version(chain_spec); set_default_ss58_version(chain_spec);
let authority_discovery_enabled = cli.run.authority_discovery_enabled; let authority_discovery_disabled = cli.run.authority_discovery_disabled;
let grandpa_pause = if cli.run.grandpa_pause.is_empty() { let grandpa_pause = if cli.run.grandpa_pause.is_empty() {
None None
} else { } else {
@@ -188,7 +188,7 @@ pub fn run() -> Result<()> {
network_status_sinks, network_status_sinks,
.. ..
} = service::build_full( } = service::build_full(
config, authority_discovery_enabled, grandpa_pause, config, authority_discovery_disabled, grandpa_pause,
)?; )?;
let client = Arc::new(client); let client = Arc::new(client);
+7 -7
View File
@@ -329,7 +329,7 @@ impl<C> NewFull<C> {
#[cfg(feature = "full-node")] #[cfg(feature = "full-node")]
pub fn new_full<RuntimeApi, Executor>( pub fn new_full<RuntimeApi, Executor>(
mut config: Configuration, mut config: Configuration,
authority_discovery_enabled: bool, authority_discovery_disabled: bool,
grandpa_pause: Option<(u32, u32)>, grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error> ) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
where where
@@ -537,7 +537,7 @@ pub fn new_full<RuntimeApi, Executor>(
use sc_network::Event; use sc_network::Event;
use futures::StreamExt; use futures::StreamExt;
if authority_discovery_enabled { if !authority_discovery_disabled {
let (sentries, authority_discovery_role) = match role { let (sentries, authority_discovery_role) = match role {
Role::Authority { ref sentry_nodes } => ( Role::Authority { ref sentry_nodes } => (
sentry_nodes.clone(), sentry_nodes.clone(),
@@ -744,31 +744,31 @@ pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers),
#[cfg(feature = "full-node")] #[cfg(feature = "full-node")]
pub fn build_full( pub fn build_full(
config: Configuration, config: Configuration,
authority_discovery_enabled: bool, authority_discovery_disabled: bool,
grandpa_pause: Option<(u32, u32)>, grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Client>, ServiceError> { ) -> Result<NewFull<Client>, ServiceError> {
if config.chain_spec.is_rococo() { if config.chain_spec.is_rococo() {
new_full::<rococo_runtime::RuntimeApi, RococoExecutor>( new_full::<rococo_runtime::RuntimeApi, RococoExecutor>(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
grandpa_pause, grandpa_pause,
).map(|full| full.with_client(Client::Rococo)) ).map(|full| full.with_client(Client::Rococo))
} else if config.chain_spec.is_kusama() { } else if config.chain_spec.is_kusama() {
new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>( new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
grandpa_pause, grandpa_pause,
).map(|full| full.with_client(Client::Kusama)) ).map(|full| full.with_client(Client::Kusama))
} else if config.chain_spec.is_westend() { } else if config.chain_spec.is_westend() {
new_full::<westend_runtime::RuntimeApi, WestendExecutor>( new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
grandpa_pause, grandpa_pause,
).map(|full| full.with_client(Client::Westend)) ).map(|full| full.with_client(Client::Westend))
} else { } else {
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>( new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
grandpa_pause, grandpa_pause,
).map(|full| full.with_client(Client::Polkadot)) ).map(|full| full.with_client(Client::Polkadot))
} }
+4 -4
View File
@@ -61,14 +61,14 @@ native_executor_instance!(
/// Create a new Polkadot test service for a full node. /// Create a new Polkadot test service for a full node.
pub fn polkadot_test_new_full( pub fn polkadot_test_new_full(
config: Configuration, config: Configuration,
authority_discovery_enabled: bool, authority_discovery_disabled: bool,
) -> Result< ) -> Result<
NewFull<Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>>, NewFull<Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>>,
ServiceError, ServiceError,
> { > {
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>( new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config, config,
authority_discovery_enabled, authority_discovery_disabled,
None, None,
).map_err(Into::into) ).map_err(Into::into)
} }
@@ -192,9 +192,9 @@ pub fn run_test_node(
> { > {
let config = node_config(storage_update_func, task_executor, key, boot_nodes); let config = node_config(storage_update_func, task_executor, key, boot_nodes);
let multiaddr = config.network.listen_addresses[0].clone(); let multiaddr = config.network.listen_addresses[0].clone();
let authority_discovery_enabled = false; let authority_discovery_disabled = true;
let NewFull {task_manager, client, network, rpc_handlers, overseer_handler, ..} = let NewFull {task_manager, client, network, rpc_handlers, overseer_handler, ..} =
polkadot_test_new_full(config, authority_discovery_enabled) polkadot_test_new_full(config, authority_discovery_disabled)
.expect("could not create Polkadot test service"); .expect("could not create Polkadot test service");
let peer_id = network.local_peer_id().clone(); let peer_id = network.local_peer_id().clone();