mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Port availability recovery to use req/res (#2694)
* add AvailableDataFetchingRequest * rename AvailabilityFetchingRequest to ChunkFetchingRequest * rename AvailabilityFetchingResponse to Chunk_ * add AvailableDataFetching request * add available data fetching request to availability recovery message * remove availability recovery message * fix * update network bridge * port availability recovery to request/response * use validators.len(), not shuffling * fix availability recovery tests * update guide * Update node/network/availability-recovery/src/lib.rs Co-authored-by: Bernhard Schuster <bernhard@ahoi.io> * Update node/network/availability-recovery/src/lib.rs Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com> * remove println Co-authored-by: Bernhard Schuster <bernhard@ahoi.io> Co-authored-by: Arkadiy Paronyan <arkady.paronyan@gmail.com>
This commit is contained in:
committed by
GitHub
parent
349879df6b
commit
8a396c678f
@@ -267,7 +267,7 @@ impl NetworkBridgeMessage {
|
||||
#[derive(Debug, derive_more::From)]
|
||||
pub enum AvailabilityDistributionMessage {
|
||||
/// Incoming network request for an availability chunk.
|
||||
AvailabilityFetchingRequest(IncomingRequest<req_res_v1::AvailabilityFetchingRequest>)
|
||||
ChunkFetchingRequest(IncomingRequest<req_res_v1::ChunkFetchingRequest>)
|
||||
}
|
||||
|
||||
/// Availability Recovery Message.
|
||||
@@ -280,16 +280,16 @@ pub enum AvailabilityRecoveryMessage {
|
||||
Option<GroupIndex>, // Optional backing group to request from first.
|
||||
oneshot::Sender<Result<AvailableData, crate::errors::RecoveryError>>,
|
||||
),
|
||||
/// Event from the network bridge.
|
||||
/// Incoming network request for available data.
|
||||
#[from]
|
||||
NetworkBridgeUpdateV1(NetworkBridgeEvent<protocol_v1::AvailabilityRecoveryMessage>),
|
||||
AvailableDataFetchingRequest(IncomingRequest<req_res_v1::AvailableDataFetchingRequest>),
|
||||
}
|
||||
|
||||
impl AvailabilityDistributionMessage {
|
||||
/// If the current variant contains the relay parent hash, return it.
|
||||
pub fn relay_parent(&self) -> Option<Hash> {
|
||||
match self {
|
||||
Self::AvailabilityFetchingRequest(_) => None,
|
||||
Self::ChunkFetchingRequest(_) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -707,6 +707,7 @@ pub enum AllMessages {
|
||||
#[skip]
|
||||
AvailabilityDistribution(AvailabilityDistributionMessage),
|
||||
/// Message for the availability recovery subsystem.
|
||||
#[skip]
|
||||
AvailabilityRecovery(AvailabilityRecoveryMessage),
|
||||
/// Message for the bitfield distribution subsystem.
|
||||
BitfieldDistribution(BitfieldDistributionMessage),
|
||||
@@ -740,8 +741,8 @@ pub enum AllMessages {
|
||||
GossipSupport(GossipSupportMessage),
|
||||
}
|
||||
|
||||
impl From<IncomingRequest<req_res_v1::AvailabilityFetchingRequest>> for AllMessages {
|
||||
fn from(req: IncomingRequest<req_res_v1::AvailabilityFetchingRequest>) -> Self {
|
||||
impl From<IncomingRequest<req_res_v1::ChunkFetchingRequest>> for AllMessages {
|
||||
fn from(req: IncomingRequest<req_res_v1::ChunkFetchingRequest>) -> Self {
|
||||
From::<AvailabilityDistributionMessage>::from(From::from(req))
|
||||
}
|
||||
}
|
||||
@@ -755,3 +756,8 @@ impl From<IncomingRequest<req_res_v1::CollationFetchingRequest>> for CollatorPro
|
||||
Self::CollationFetchingRequest(req)
|
||||
}
|
||||
}
|
||||
impl From<IncomingRequest<req_res_v1::AvailableDataFetchingRequest>> for AllMessages {
|
||||
fn from(req: IncomingRequest<req_res_v1::AvailableDataFetchingRequest>) -> Self {
|
||||
From::<AvailabilityRecoveryMessage>::from(From::from(req))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user