Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Cleanup light client leftovers #1456

Merged
merged 4 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
49 changes: 22 additions & 27 deletions client/relay-chain-inprocess-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use futures::{FutureExt, Stream, StreamExt};
use parking_lot::Mutex;
use polkadot_client::{ClientHandle, ExecuteWithClient, FullBackend};
use polkadot_service::{
AuxStore, BabeApi, CollatorPair, Configuration, Handle, NewFull, Role, TaskManager,
AuxStore, BabeApi, CollatorPair, Configuration, Handle, NewFull, TaskManager,
};
use sc_cli::SubstrateCli;
use sc_client_api::{
Expand Down Expand Up @@ -330,33 +330,28 @@ fn build_polkadot_full_node(
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
hwbench: Option<sc_sysinfo::HwBench>,
) -> Result<(NewFull<polkadot_client::Client>, Option<CollatorPair>), polkadot_service::Error> {
let is_light = matches!(config.role, Role::Light);
if is_light {
Err(polkadot_service::Error::Sub("Light client not supported.".into()))
let (is_collator, maybe_collator_key) = if parachain_config.role.is_authority() {
let collator_key = CollatorPair::generate().0;
(polkadot_service::IsCollator::Yes(collator_key.clone()), Some(collator_key))
} else {
let (is_collator, maybe_collator_key) = if parachain_config.role.is_authority() {
let collator_key = CollatorPair::generate().0;
(polkadot_service::IsCollator::Yes(collator_key.clone()), Some(collator_key))
} else {
(polkadot_service::IsCollator::No, None)
};

let relay_chain_full_node = polkadot_service::build_full(
config,
is_collator,
None,
// Disable BEEFY. It should not be required by the internal relay chain node.
false,
None,
telemetry_worker_handle,
true,
polkadot_service::RealOverseerGen,
None,
hwbench,
)?;

Ok((relay_chain_full_node, maybe_collator_key))
}
(polkadot_service::IsCollator::No, None)
};

let relay_chain_full_node = polkadot_service::build_full(
config,
is_collator,
None,
// Disable BEEFY. It should not be required by the internal relay chain node.
false,
None,
telemetry_worker_handle,
true,
polkadot_service::RealOverseerGen,
None,
hwbench,
)?;

Ok((relay_chain_full_node, maybe_collator_key))
}

/// Builds a relay chain interface by constructing a full relay chain node
Expand Down
2 changes: 1 addition & 1 deletion docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ the notification the so-called candidate message. This candidate message is issu
validator after approving a block. This proof of possible inclusion prevents spamming other collators
of the network with useless blocks.
The Collator joins the relay-chain network for two reasons. First, the Collator uses it to send the
Parachain blocks to the Parachain validators. Secondly, the Collator participates as light/full-node
Parachain blocks to the Parachain validators. Secondly, the Collator participates as a full-node
of the relay chain to be informed of new relay-chain blocks. This information will be used for the
consensus and the block production logic.

Expand Down
6 changes: 1 addition & 5 deletions parachain-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use cumulus_relay_chain_rpc_interface::RelayChainRPCInterface;
use sc_client_api::ExecutorProvider;
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkService;
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::ConstructRuntimeApi;
use sp_keystore::SyncCryptoStorePtr;
Expand Down Expand Up @@ -257,10 +257,6 @@ where
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into())
}

let parachain_config = prepare_node_config(parachain_config);

let params = new_partial::<RuntimeApi, Executor, BIQ>(&parachain_config, build_import_queue)?;
Expand Down
14 changes: 1 addition & 13 deletions polkadot-parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use sc_consensus::{
};
use sc_executor::WasmExecutor;
use sc_network::NetworkService;
use sc_service::{Configuration, PartialComponents, Role, TFullBackend, TFullClient, TaskManager};
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::{ApiExt, ConstructRuntimeApi};
use sp_consensus::CacheKeyId;
Expand Down Expand Up @@ -374,10 +374,6 @@ where
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into())
}

let parachain_config = prepare_node_config(parachain_config);

let params = new_partial::<RuntimeApi, BIQ>(&parachain_config, build_import_queue)?;
Expand Down Expand Up @@ -576,10 +572,6 @@ where
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into())
}

let parachain_config = prepare_node_config(parachain_config);

let params = new_partial::<RuntimeApi, BIQ>(&parachain_config, build_import_queue)?;
Expand Down Expand Up @@ -1400,10 +1392,6 @@ where
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into())
}

let parachain_config = prepare_node_config(parachain_config);

let params = new_partial::<RuntimeApi, BIQ>(&parachain_config, build_import_queue)?;
Expand Down
4 changes: 0 additions & 4 deletions test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ pub async fn start_node_impl<RB>(
where
RB: Fn(Arc<Client>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error> + Send + 'static,
{
if matches!(parachain_config.role, Role::Light) {
return Err("Light client not supported!".into())
}

let mut parachain_config = prepare_node_config(parachain_config);

let params = new_partial(&mut parachain_config)?;
Expand Down