From d985b9aa02818fcbd6ed48d793c5566e02b687c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 9 Oct 2020 16:55:26 +0200 Subject: [PATCH] Remove `collating_for` argument from service (#1802) The collator is now enabled in a different way and we don't require this argument anymore. --- polkadot/cli/src/command.rs | 3 +-- polkadot/node/service/src/lib.rs | 10 +--------- polkadot/node/test-service/src/lib.rs | 8 ++------ 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/polkadot/cli/src/command.rs b/polkadot/cli/src/command.rs index 2c5d06434b..d4fcb5aaab 100644 --- a/polkadot/cli/src/command.rs +++ b/polkadot/cli/src/command.rs @@ -148,7 +148,6 @@ pub fn run() -> Result<()> { Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager), _ => service::build_full( config, - None, authority_discovery_enabled, grandpa_pause, ).map(|full| full.task_manager), @@ -189,7 +188,7 @@ pub fn run() -> Result<()> { network_status_sinks, .. } = service::build_full( - config, None, authority_discovery_enabled, grandpa_pause, + config, authority_discovery_enabled, grandpa_pause, )?; let client = Arc::new(client); diff --git a/polkadot/node/service/src/lib.rs b/polkadot/node/service/src/lib.rs index 7a62b73e49..b82ecaa21a 100644 --- a/polkadot/node/service/src/lib.rs +++ b/polkadot/node/service/src/lib.rs @@ -328,7 +328,6 @@ impl NewFull { #[cfg(feature = "full-node")] pub fn new_full( mut config: Configuration, - collating_for: Option<(CollatorId, ParaId)>, authority_discovery_enabled: bool, grandpa_pause: Option<(u32, u32)>, ) -> Result>>, Error> @@ -338,9 +337,7 @@ pub fn new_full( RuntimeApiCollection>, Executor: NativeExecutionDispatch + 'static, { - let is_collator = collating_for.is_some(); let role = config.role.clone(); - let is_authority = role.is_authority() && !is_collator; let force_authoring = config.force_authoring; let disable_grandpa = config.disable_grandpa; let name = config.network.node_name.clone(); @@ -470,7 +467,7 @@ pub fn new_full( // if the node isn't actively participating in consensus then it doesn't // need a keystore, regardless of which protocol we use below. - let keystore_opt = if is_authority { + let keystore_opt = if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None @@ -746,35 +743,30 @@ pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers), #[cfg(feature = "full-node")] pub fn build_full( config: Configuration, - collating_for: Option<(CollatorId, ParaId)>, authority_discovery_enabled: bool, grandpa_pause: Option<(u32, u32)>, ) -> Result, ServiceError> { if config.chain_spec.is_rococo() { new_full::( config, - collating_for, authority_discovery_enabled, grandpa_pause, ).map(|full| full.with_client(Client::Rococo)) } else if config.chain_spec.is_kusama() { new_full::( config, - collating_for, authority_discovery_enabled, grandpa_pause, ).map(|full| full.with_client(Client::Kusama)) } else if config.chain_spec.is_westend() { new_full::( config, - collating_for, authority_discovery_enabled, grandpa_pause, ).map(|full| full.with_client(Client::Westend)) } else { new_full::( config, - collating_for, authority_discovery_enabled, grandpa_pause, ).map(|full| full.with_client(Client::Polkadot)) diff --git a/polkadot/node/test-service/src/lib.rs b/polkadot/node/test-service/src/lib.rs index a6d50c611b..939b065cd3 100644 --- a/polkadot/node/test-service/src/lib.rs +++ b/polkadot/node/test-service/src/lib.rs @@ -23,9 +23,7 @@ mod chain_spec; pub use chain_spec::*; use futures::future::Future; use polkadot_overseer::OverseerHandler; -use polkadot_primitives::v0::{ - Block, CollatorId, Id as ParaId, -}; +use polkadot_primitives::v1::Block; use polkadot_runtime_common::BlockHashCount; use polkadot_service::{ new_full, NewFull, FullClient, AbstractClient, ClientHandle, ExecuteWithClient, @@ -63,7 +61,6 @@ native_executor_instance!( /// Create a new Polkadot test service for a full node. pub fn polkadot_test_new_full( config: Configuration, - collating_for: Option<(CollatorId, ParaId)>, authority_discovery_enabled: bool, ) -> Result< NewFull>>, @@ -71,7 +68,6 @@ pub fn polkadot_test_new_full( > { new_full::( config, - collating_for, authority_discovery_enabled, None, ).map_err(Into::into) @@ -198,7 +194,7 @@ pub fn run_test_node( let multiaddr = config.network.listen_addresses[0].clone(); let authority_discovery_enabled = false; let NewFull {task_manager, client, network, rpc_handlers, node_handles, ..} = - polkadot_test_new_full(config, None, authority_discovery_enabled) + polkadot_test_new_full(config, authority_discovery_enabled) .expect("could not create Polkadot test service"); let peer_id = network.local_peer_id().clone();