mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 07:41:02 +00:00
Add prospective-parachain subsystem to minimal-relay-node + QoL improvements (#2223)
This PR contains some fixes and cleanups for parachain nodes: 1. When using async backing, node no longer complains about being unable to reach the prospective-parachain subsystem. 2. Parachain warp sync now informs users that the finalized para block has been retrieved. ``` 2023-11-08 13:24:42 [Parachain] 🎉 Received finalized parachain header #5747719 (0xa0aa…674b) from the relay chain. ``` 3. When a user supplied an invalid `--relay-chain-rpc-url`, we were crashing with a very verbose message. Removed the `expect` and improved the error message. ``` 2023-11-08 13:57:56 [Parachain] No valid RPC url found. Stopping RPC worker. 2023-11-08 13:57:56 [Parachain] Essential task `relay-chain-rpc-worker` failed. Shutting down service. Error: Service(Application(WorkerCommunicationError("RPC worker channel closed. This can hint and connectivity issues with the supplied RPC endpoints. Message: oneshot canceled"))) ```
This commit is contained in:
@@ -49,7 +49,7 @@ use sc_utils::mpsc::TracingUnboundedSender;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_blockchain::{HeaderBackend, HeaderMetadata};
|
||||
use sp_core::{traits::SpawnNamed, Decode};
|
||||
use sp_runtime::traits::{Block as BlockT, BlockIdTo};
|
||||
use sp_runtime::traits::{Block as BlockT, BlockIdTo, Header};
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
// Given the sporadic nature of the explicit recovery operation and the
|
||||
@@ -505,11 +505,11 @@ where
|
||||
None,
|
||||
async move {
|
||||
log::debug!(
|
||||
target: "cumulus-network",
|
||||
target: LOG_TARGET_SYNC,
|
||||
"waiting for announce block in a background task...",
|
||||
);
|
||||
|
||||
let _ = wait_for_target_block::<B, _>(sender, para_id, relay_chain_interface)
|
||||
let _ = wait_for_finalized_para_head::<B, _>(sender, para_id, relay_chain_interface)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
log::error!(
|
||||
@@ -527,7 +527,7 @@ where
|
||||
|
||||
/// Waits for the relay chain to have finished syncing and then gets the parachain header that
|
||||
/// corresponds to the last finalized relay chain block.
|
||||
async fn wait_for_target_block<B, RCInterface>(
|
||||
async fn wait_for_finalized_para_head<B, RCInterface>(
|
||||
sender: oneshot::Sender<<B as BlockT>::Header>,
|
||||
para_id: ParaId,
|
||||
relay_chain_interface: RCInterface,
|
||||
@@ -560,11 +560,15 @@ where
|
||||
.map_err(|e| format!("{e:?}"))?
|
||||
.ok_or("Could not find parachain head in relay chain")?;
|
||||
|
||||
let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..])
|
||||
let finalized_header = B::Header::decode(&mut &validation_data.parent_head.0[..])
|
||||
.map_err(|e| format!("Failed to decode parachain head: {e}"))?;
|
||||
|
||||
log::debug!(target: LOG_TARGET_SYNC, "Target block reached {:?}", target_block);
|
||||
let _ = sender.send(target_block);
|
||||
log::info!(
|
||||
"🎉 Received target parachain header #{} ({}) from the relay chain.",
|
||||
finalized_header.number(),
|
||||
finalized_header.hash()
|
||||
);
|
||||
let _ = sender.send(finalized_header);
|
||||
return Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user