Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ pub struct RunCmd {
#[structopt(long = "force-rococo")]
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:
///
Expand All @@ -94,8 +97,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 = "enable-authority-discovery")]
pub authority_discovery_enabled: bool,
#[structopt(long = "disable-authority-discovery")]
pub authority_discovery_disabled: bool,

/// Setup a GRANDPA scheduled voting pause.
///
Expand Down
8 changes: 4 additions & 4 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn run() -> Result<()> {

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() {
None
} else {
Expand All @@ -148,7 +148,7 @@ pub fn run() -> Result<()> {
Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager),
_ => service::build_full(
config,
authority_discovery_enabled,
authority_discovery_disabled,
grandpa_pause,
).map(|full| full.task_manager),
}
Expand All @@ -164,7 +164,7 @@ pub fn run() -> Result<()> {

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() {
None
} else {
Expand All @@ -188,7 +188,7 @@ pub fn run() -> Result<()> {
network_status_sinks,
..
} = service::build_full(
config, authority_discovery_enabled, grandpa_pause,
config, authority_discovery_disabled, grandpa_pause,
)?;
let client = Arc::new(client);

Expand Down
14 changes: 7 additions & 7 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl<C> NewFull<C> {
#[cfg(feature = "full-node")]
pub fn new_full<RuntimeApi, Executor>(
mut config: Configuration,
authority_discovery_enabled: bool,
authority_discovery_disabled: bool,
grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
where
Expand Down Expand Up @@ -536,7 +536,7 @@ pub fn new_full<RuntimeApi, Executor>(
use sc_network::Event;
use futures::StreamExt;

if authority_discovery_enabled {
if !authority_discovery_disabled {
let (sentries, authority_discovery_role) = match role {
Role::Authority { ref sentry_nodes } => (
sentry_nodes.clone(),
Expand Down Expand Up @@ -743,31 +743,31 @@ pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers),
#[cfg(feature = "full-node")]
pub fn build_full(
config: Configuration,
authority_discovery_enabled: bool,
authority_discovery_disabled: bool,
grandpa_pause: Option<(u32, u32)>,
) -> Result<NewFull<Client>, ServiceError> {
if config.chain_spec.is_rococo() {
new_full::<rococo_runtime::RuntimeApi, RococoExecutor>(
config,
authority_discovery_enabled,
authority_discovery_disabled,
grandpa_pause,
).map(|full| full.with_client(Client::Rococo))
} else if config.chain_spec.is_kusama() {
new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
config,
authority_discovery_enabled,
authority_discovery_disabled,
grandpa_pause,
).map(|full| full.with_client(Client::Kusama))
} else if config.chain_spec.is_westend() {
new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
config,
authority_discovery_enabled,
authority_discovery_disabled,
grandpa_pause,
).map(|full| full.with_client(Client::Westend))
} else {
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
config,
authority_discovery_enabled,
authority_discovery_disabled,
grandpa_pause,
).map(|full| full.with_client(Client::Polkadot))
}
Expand Down
8 changes: 4 additions & 4 deletions node/test-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ native_executor_instance!(
/// Create a new Polkadot test service for a full node.
pub fn polkadot_test_new_full(
config: Configuration,
authority_discovery_enabled: bool,
authority_discovery_disabled: bool,
) -> Result<
NewFull<Arc<FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>>>,
ServiceError,
> {
new_full::<polkadot_test_runtime::RuntimeApi, PolkadotTestExecutor>(
config,
authority_discovery_enabled,
authority_discovery_disabled,
None,
).map_err(Into::into)
}
Expand Down Expand Up @@ -192,9 +192,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_enabled = false;
let authority_discovery_disabled = true;
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");

let peer_id = network.local_peer_id().clone();
Expand Down