Don't wait for dispute coordinator (#5157)

* Don't wait for dispute coordinator

in backing and approval-voting - we are single threaded there, so this
is blocking everything.

* Add missing import.

* Don't warn on dropped receiver.
This commit is contained in:
Robert Klotzner
2022-03-18 16:15:50 +01:00
committed by GitHub
parent 495b6cc937
commit 3688e46d1b
5 changed files with 14 additions and 26 deletions
+4 -11
View File
@@ -35,7 +35,7 @@ use polkadot_node_subsystem::{
ApprovalVotingMessage, AssignmentCheckError, AssignmentCheckResult,
AvailabilityRecoveryMessage, BlockDescription, CandidateValidationMessage, ChainApiMessage,
ChainSelectionMessage, DisputeCoordinatorMessage, HighestApprovedAncestorBlock,
ImportStatementsResult, RuntimeApiMessage, RuntimeApiRequest,
RuntimeApiMessage, RuntimeApiRequest,
},
overseer::{self, SubsystemSender as _},
FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext, SubsystemError,
@@ -950,7 +950,9 @@ async fn handle_actions(
dispute_statement,
validator_index,
} => {
let (pending_confirmation, confirmation_rx) = oneshot::channel();
// TODO: Log confirmation results in an efficient way:
// https://github.com/paritytech/polkadot/issues/5156
let (pending_confirmation, _confirmation_rx) = oneshot::channel();
ctx.send_message(DisputeCoordinatorMessage::ImportStatements {
candidate_hash,
candidate_receipt,
@@ -959,15 +961,6 @@ async fn handle_actions(
pending_confirmation,
})
.await;
match confirmation_rx.await {
Err(oneshot::Canceled) => {
gum::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
},
Ok(ImportStatementsResult::ValidImport) => {},
Ok(ImportStatementsResult::InvalidImport) =>
gum::warn!(target: LOG_TARGET, "Failed to import statements of validity",),
}
},
Action::NoteApprovedInChainSelection(block_hash) => {
ctx.send_message(ChainSelectionMessage::Approved(block_hash)).await;
@@ -25,6 +25,7 @@ use polkadot_node_primitives::{
use polkadot_node_subsystem::{
messages::{
AllMessages, ApprovalVotingMessage, AssignmentCheckResult, AvailabilityRecoveryMessage,
ImportStatementsResult,
},
ActivatedLeaf, ActiveLeavesUpdate, LeafStatus,
};
+5 -13
View File
@@ -50,8 +50,8 @@ use polkadot_subsystem::{
messages::{
AllMessages, AvailabilityDistributionMessage, AvailabilityStoreMessage,
CandidateBackingMessage, CandidateValidationMessage, CollatorProtocolMessage,
DisputeCoordinatorMessage, ImportStatementsResult, ProvisionableData, ProvisionerMessage,
RuntimeApiRequest, StatementDistributionMessage, ValidationFailed,
DisputeCoordinatorMessage, ProvisionableData, ProvisionerMessage, RuntimeApiRequest,
StatementDistributionMessage, ValidationFailed,
},
overseer, ActivatedLeaf, PerLeafSpan, Stage, SubsystemSender,
};
@@ -891,7 +891,9 @@ impl CandidateBackingJob {
if let (Some(candidate_receipt), Some(dispute_statement)) =
(maybe_candidate_receipt, maybe_signed_dispute_statement)
{
let (pending_confirmation, confirmation_rx) = oneshot::channel();
// TODO: Log confirmation results in an efficient way:
// https://github.com/paritytech/polkadot/issues/5156
let (pending_confirmation, _confirmation_rx) = oneshot::channel();
sender
.send_message(DisputeCoordinatorMessage::ImportStatements {
candidate_hash,
@@ -901,16 +903,6 @@ impl CandidateBackingJob {
pending_confirmation,
})
.await;
match confirmation_rx.await {
Err(oneshot::Canceled) => {
gum::debug!(target: LOG_TARGET, "Dispute coordinator confirmation lost",)
},
Ok(ImportStatementsResult::ValidImport) => {},
Ok(ImportStatementsResult::InvalidImport) => {
gum::warn!(target: LOG_TARGET, "Failed to import statements of validity",)
},
}
}
Ok(())
+3 -1
View File
@@ -27,7 +27,9 @@ use polkadot_primitives::v2::{
CollatorId, GroupRotationInfo, HeadData, PersistedValidationData, ScheduledCore,
};
use polkadot_subsystem::{
messages::{CollatorProtocolMessage, RuntimeApiMessage, RuntimeApiRequest},
messages::{
CollatorProtocolMessage, ImportStatementsResult, RuntimeApiMessage, RuntimeApiRequest,
},
ActivatedLeaf, ActiveLeavesUpdate, FromOverseer, LeafStatus, OverseerSignal,
};
use sp_application_crypto::AppKey;
@@ -118,7 +118,7 @@ impl JfyiError {
pub fn log(self) {
match self {
// don't spam the log with spurious errors
Self::Runtime(_) | Self::Oneshot(_) => {
Self::Runtime(_) | Self::Oneshot(_) | Self::DisputeImportOneshotSend => {
gum::debug!(target: LOG_TARGET, error = ?self)
},
// it's worth reporting otherwise