mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 05:11:02 +00:00
Remove request multiplexer (#3624)
* WIP: Get rid of request multiplexer. * WIP * Receiver for handling of incoming requests. * Get rid of useless `Fault` abstraction. The things the type system let us do are not worth getting abstracted in its own type. Instead error handling is going to be merely a pattern. * Make most things compile again. * Port availability distribution away from request multiplexer. * Formatting. * Port dispute distribution over. * Fixup statement distribution. * Handle request directly in collator protocol. + Only allow fatal errors at top level. * Use direct request channel for availability recovery. * Finally get rid of request multiplexer Fixes #2842 and paves the way for more back pressure possibilities. * Fix overseer and statement distribution tests. * Fix collator protocol and network bridge tests. * Fix tests in availability recovery. * Fix availability distribution tests. * Fix dispute distribution tests. * Add missing dependency * Typos. * Review remarks. * More remarks.
This commit is contained in:
@@ -22,15 +22,14 @@
|
||||
//!
|
||||
//! Subsystems' APIs are defined separately from their implementation, leading to easier mocking.
|
||||
|
||||
use futures::channel::{mpsc, oneshot};
|
||||
use futures::channel::oneshot;
|
||||
use thiserror::Error;
|
||||
|
||||
pub use sc_network::IfDisconnected;
|
||||
|
||||
use polkadot_node_network_protocol::{
|
||||
peer_set::PeerSet,
|
||||
request_response::{request::IncomingRequest, v1 as req_res_v1, Requests},
|
||||
v1 as protocol_v1, PeerId, UnifiedReputationChange,
|
||||
peer_set::PeerSet, request_response::Requests, v1 as protocol_v1, PeerId,
|
||||
UnifiedReputationChange,
|
||||
};
|
||||
use polkadot_node_primitives::{
|
||||
approval::{BlockApprovalMeta, IndirectAssignmentCert, IndirectSignedApprovalVote},
|
||||
@@ -165,8 +164,6 @@ pub enum CollatorProtocolMessage {
|
||||
/// Get a network bridge update.
|
||||
#[from]
|
||||
NetworkBridgeUpdateV1(NetworkBridgeEvent<protocol_v1::CollatorProtocolMessage>),
|
||||
/// Incoming network request for a collation.
|
||||
CollationFetchingRequest(IncomingRequest<req_res_v1::CollationFetchingRequest>),
|
||||
/// We recommended a particular candidate to be seconded, but it was invalid; penalize the collator.
|
||||
///
|
||||
/// The hash is the relay parent.
|
||||
@@ -297,9 +294,6 @@ pub enum DisputeDistributionMessage {
|
||||
/// Tell dispute distribution to distribute an explicit dispute statement to
|
||||
/// validators.
|
||||
SendDispute(DisputeMessage),
|
||||
|
||||
/// Get receiver for receiving incoming network requests for dispute sending.
|
||||
DisputeSendingReceiver(mpsc::Receiver<sc_network::config::IncomingRequest>),
|
||||
}
|
||||
|
||||
/// Messages received by the network bridge subsystem.
|
||||
@@ -380,10 +374,6 @@ impl NetworkBridgeMessage {
|
||||
/// Availability Distribution Message.
|
||||
#[derive(Debug)]
|
||||
pub enum AvailabilityDistributionMessage {
|
||||
/// Incoming network request for an availability chunk.
|
||||
ChunkFetchingRequest(IncomingRequest<req_res_v1::ChunkFetchingRequest>),
|
||||
/// Incoming network request for a seconded PoV.
|
||||
PoVFetchingRequest(IncomingRequest<req_res_v1::PoVFetchingRequest>),
|
||||
/// Instruct availability distribution to fetch a remote PoV.
|
||||
///
|
||||
/// NOTE: The result of this fetch is not yet locally validated and could be bogus.
|
||||
@@ -413,9 +403,6 @@ pub enum AvailabilityRecoveryMessage {
|
||||
Option<GroupIndex>, // Optional backing group to request from first.
|
||||
oneshot::Sender<Result<AvailableData, crate::errors::RecoveryError>>,
|
||||
),
|
||||
/// Incoming network request for available data.
|
||||
#[from]
|
||||
AvailableDataFetchingRequest(IncomingRequest<req_res_v1::AvailableDataFetchingRequest>),
|
||||
}
|
||||
|
||||
/// Bitfield distribution message.
|
||||
@@ -666,8 +653,6 @@ pub enum StatementDistributionMessage {
|
||||
/// Event from the network bridge.
|
||||
#[from]
|
||||
NetworkBridgeUpdateV1(NetworkBridgeEvent<protocol_v1::StatementDistributionMessage>),
|
||||
/// Get receiver for receiving incoming network requests for statement fetching.
|
||||
StatementFetchingReceiver(mpsc::Receiver<sc_network::config::IncomingRequest>),
|
||||
}
|
||||
|
||||
/// This data becomes intrinsics or extrinsics which should be included in a future relay chain block.
|
||||
@@ -867,19 +852,3 @@ pub enum ApprovalDistributionMessage {
|
||||
/// Message to the Gossip Support subsystem.
|
||||
#[derive(Debug)]
|
||||
pub enum GossipSupportMessage {}
|
||||
|
||||
impl From<IncomingRequest<req_res_v1::PoVFetchingRequest>> for AvailabilityDistributionMessage {
|
||||
fn from(req: IncomingRequest<req_res_v1::PoVFetchingRequest>) -> Self {
|
||||
Self::PoVFetchingRequest(req)
|
||||
}
|
||||
}
|
||||
impl From<IncomingRequest<req_res_v1::ChunkFetchingRequest>> for AvailabilityDistributionMessage {
|
||||
fn from(req: IncomingRequest<req_res_v1::ChunkFetchingRequest>) -> Self {
|
||||
Self::ChunkFetchingRequest(req)
|
||||
}
|
||||
}
|
||||
impl From<IncomingRequest<req_res_v1::CollationFetchingRequest>> for CollatorProtocolMessage {
|
||||
fn from(req: IncomingRequest<req_res_v1::CollationFetchingRequest>) -> Self {
|
||||
Self::CollationFetchingRequest(req)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user