mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 01:11:10 +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:
@@ -304,6 +304,11 @@ pub struct RunCmd {
|
||||
alias = "relay-chain-rpc-url"
|
||||
)]
|
||||
pub relay_chain_rpc_urls: Vec<Url>,
|
||||
|
||||
/// EXPERIMENTAL: Embed a light client for the relay chain. Only supported for full-nodes.
|
||||
/// Will use the specified relay chain chainspec.
|
||||
#[arg(long, conflicts_with_all = ["relay_chain_rpc_urls", "collator"])]
|
||||
pub relay_chain_light_client: bool,
|
||||
}
|
||||
|
||||
impl RunCmd {
|
||||
@@ -319,15 +324,33 @@ impl RunCmd {
|
||||
|
||||
/// Create [`CollatorOptions`] representing options only relevant to parachain collator nodes
|
||||
pub fn collator_options(&self) -> CollatorOptions {
|
||||
CollatorOptions { relay_chain_rpc_urls: self.relay_chain_rpc_urls.clone() }
|
||||
let relay_chain_mode =
|
||||
match (self.relay_chain_light_client, !self.relay_chain_rpc_urls.is_empty()) {
|
||||
(true, _) => RelayChainMode::LightClient,
|
||||
(_, true) => RelayChainMode::ExternalRpc(self.relay_chain_rpc_urls.clone()),
|
||||
_ => RelayChainMode::Embedded,
|
||||
};
|
||||
|
||||
CollatorOptions { relay_chain_mode }
|
||||
}
|
||||
}
|
||||
|
||||
/// Possible modes for the relay chain to operate in.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum RelayChainMode {
|
||||
/// Spawn embedded relay chain node
|
||||
Embedded,
|
||||
/// Connect to remote relay chain node via websocket RPC
|
||||
ExternalRpc(Vec<Url>),
|
||||
/// Spawn embedded relay chain light client
|
||||
LightClient,
|
||||
}
|
||||
|
||||
/// Options only relevant for collator nodes
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct CollatorOptions {
|
||||
/// Location of relay chain full node
|
||||
pub relay_chain_rpc_urls: Vec<Url>,
|
||||
/// How this collator retrieves relay chain information
|
||||
pub relay_chain_mode: RelayChainMode,
|
||||
}
|
||||
|
||||
/// A non-redundant version of the `RunCmd` that sets the `validator` field when the
|
||||
|
||||
Reference in New Issue
Block a user