mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 00:41:03 +00:00
Allow integrated relay chain light client (#2270)
* Add embedded light client to cli * Prepare for light-client-worker * First working version * Clean up * Remove unwanted logs * Simplify subscription code * Let jsonrpsee handle rpc management * Simplify implementation * Reorganize crate structure * Use relay chain arg chainspec for light-client * Clean up command line * Add light client worker file * Use smoldot master to avoid wasmtime conflict * Remove sleep * Improve naming of cli option * Remove conflict with `validator` * Improve docs * Update smoldot, remove unwanted change * Apply suggestions from code review Co-authored-by: Dmitry Markin <dmitry@markin.tech> * Disable collation * Reviewer comments * Update smoldot and tokio-platform * Update smoldot * Update smoldot * Adjust to new version * Patch substrate * Use constants * Add readme entry, improve zombienet tests * Apply suggestions from code review Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> * Make execution mode an enum * Update smoldot, remove substrate patch * Update client/relay-chain-rpc-interface/src/rpc_client.rs Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> * Reduce duplicate code * Update smoldot * Update smoldot * Fix build * Update smoldot * Make platform compile * Clean up dependencies * Use crates.io instead of github for smoldot * Apply suggestions from code review Co-authored-by: Davide Galassi <davxy@datawok.net> * Docs * Improve docs * Remove `RpcFrontend` --------- Co-authored-by: Dmitry Markin <dmitry@markin.tech> Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> Co-authored-by: Davide Galassi <davxy@datawok.net>
This commit is contained in:
@@ -25,7 +25,9 @@ use cumulus_client_pov_recovery::{PoVRecovery, RecoveryDelayRange, RecoveryHandl
|
||||
use cumulus_primitives_core::{CollectCollationInfo, ParaId};
|
||||
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
|
||||
use cumulus_relay_chain_interface::{RelayChainInterface, RelayChainResult};
|
||||
use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
|
||||
use cumulus_relay_chain_minimal_node::{
|
||||
build_minimal_relay_chain_node_light_client, build_minimal_relay_chain_node_with_rpc,
|
||||
};
|
||||
use futures::{
|
||||
channel::{mpsc, oneshot},
|
||||
FutureExt, StreamExt,
|
||||
@@ -342,28 +344,30 @@ pub fn prepare_node_config(mut parachain_config: Configuration) -> Configuration
|
||||
/// Will return a minimal relay chain node with RPC
|
||||
/// client or an inprocess node, based on the [`CollatorOptions`] passed in.
|
||||
pub async fn build_relay_chain_interface(
|
||||
polkadot_config: Configuration,
|
||||
relay_chain_config: Configuration,
|
||||
parachain_config: &Configuration,
|
||||
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
||||
task_manager: &mut TaskManager,
|
||||
collator_options: CollatorOptions,
|
||||
hwbench: Option<sc_sysinfo::HwBench>,
|
||||
) -> RelayChainResult<(Arc<(dyn RelayChainInterface + 'static)>, Option<CollatorPair>)> {
|
||||
if !collator_options.relay_chain_rpc_urls.is_empty() {
|
||||
build_minimal_relay_chain_node(
|
||||
polkadot_config,
|
||||
task_manager,
|
||||
collator_options.relay_chain_rpc_urls,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
build_inprocess_relay_chain(
|
||||
polkadot_config,
|
||||
match collator_options.relay_chain_mode {
|
||||
cumulus_client_cli::RelayChainMode::Embedded => build_inprocess_relay_chain(
|
||||
relay_chain_config,
|
||||
parachain_config,
|
||||
telemetry_worker_handle,
|
||||
task_manager,
|
||||
hwbench,
|
||||
)
|
||||
),
|
||||
cumulus_client_cli::RelayChainMode::ExternalRpc(rpc_target_urls) =>
|
||||
build_minimal_relay_chain_node_with_rpc(
|
||||
relay_chain_config,
|
||||
task_manager,
|
||||
rpc_target_urls,
|
||||
)
|
||||
.await,
|
||||
cumulus_client_cli::RelayChainMode::LightClient =>
|
||||
build_minimal_relay_chain_node_light_client(relay_chain_config, task_manager).await,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user