mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 01:38:04 +00:00
relay chain selection and dispute-coordinator fixes and improvements (#4752)
* Dont error in finality_target_with_longest_chain Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add error flag Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Add error flag in dispute-coordinator Make sure to send errors to subsystems requesting data depending on missing session info Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Scrape ancestors Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix naming Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * review feedback Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * 💬 fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * consume Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * review fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Bump scraped blocks LRU capacity Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * 🧯 🔥 Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove prints Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Increase scraped blocks cache size Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * more review fixes Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * another fix Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * fix target_ancestor Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Scrape up to max finalized block Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * undo comment change Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Limit ancestry lookup to last finalized block or max finality lag Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * debug damage Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
@@ -34,8 +34,8 @@ use polkadot_node_subsystem::{
|
||||
use thiserror::Error;
|
||||
|
||||
/// Sessions unavailable in state to cache.
|
||||
#[derive(Debug)]
|
||||
pub enum SessionsUnavailableKind {
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum SessionsUnavailableReason {
|
||||
/// Runtime API subsystem was unavailable.
|
||||
RuntimeApiUnavailable(oneshot::Canceled),
|
||||
/// The runtime API itself returned an error.
|
||||
@@ -45,7 +45,7 @@ pub enum SessionsUnavailableKind {
|
||||
}
|
||||
|
||||
/// Information about the sessions being fetched.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SessionsUnavailableInfo {
|
||||
/// The desired window start.
|
||||
pub window_start: SessionIndex,
|
||||
@@ -56,10 +56,10 @@ pub struct SessionsUnavailableInfo {
|
||||
}
|
||||
|
||||
/// Sessions were unavailable to fetch from the state for some reason.
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug, Error, Clone)]
|
||||
pub struct SessionsUnavailable {
|
||||
/// The error kind.
|
||||
kind: SessionsUnavailableKind,
|
||||
kind: SessionsUnavailableReason,
|
||||
/// The info about the session window, if any.
|
||||
info: Option<SessionsUnavailableInfo>,
|
||||
}
|
||||
@@ -229,12 +229,12 @@ async fn get_session_index_for_head(
|
||||
Ok(Ok(s)) => Ok(s),
|
||||
Ok(Err(e)) =>
|
||||
return Err(SessionsUnavailable {
|
||||
kind: SessionsUnavailableKind::RuntimeApi(e),
|
||||
kind: SessionsUnavailableReason::RuntimeApi(e),
|
||||
info: None,
|
||||
}),
|
||||
Err(e) =>
|
||||
return Err(SessionsUnavailable {
|
||||
kind: SessionsUnavailableKind::RuntimeApiUnavailable(e),
|
||||
kind: SessionsUnavailableReason::RuntimeApiUnavailable(e),
|
||||
info: None,
|
||||
}),
|
||||
}
|
||||
@@ -245,7 +245,7 @@ async fn load_all_sessions(
|
||||
block_hash: Hash,
|
||||
start: SessionIndex,
|
||||
end_inclusive: SessionIndex,
|
||||
) -> Result<Vec<SessionInfo>, SessionsUnavailableKind> {
|
||||
) -> Result<Vec<SessionInfo>, SessionsUnavailableReason> {
|
||||
let mut v = Vec::new();
|
||||
for i in start..=end_inclusive {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
@@ -257,9 +257,9 @@ async fn load_all_sessions(
|
||||
|
||||
let session_info = match rx.await {
|
||||
Ok(Ok(Some(s))) => s,
|
||||
Ok(Ok(None)) => return Err(SessionsUnavailableKind::Missing(i)),
|
||||
Ok(Err(e)) => return Err(SessionsUnavailableKind::RuntimeApi(e)),
|
||||
Err(canceled) => return Err(SessionsUnavailableKind::RuntimeApiUnavailable(canceled)),
|
||||
Ok(Ok(None)) => return Err(SessionsUnavailableReason::Missing(i)),
|
||||
Ok(Err(e)) => return Err(SessionsUnavailableReason::RuntimeApi(e)),
|
||||
Err(canceled) => return Err(SessionsUnavailableReason::RuntimeApiUnavailable(canceled)),
|
||||
};
|
||||
|
||||
v.push(session_info);
|
||||
|
||||
Reference in New Issue
Block a user