mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
Availability recovery subsystem (#2122)
* Adds message types * Add code skeleton * Adds subsystem code. * Adds a first test * Adds interaction result to availability_lru * Use LruCache instead of a HashMap * Whitespaces to tabs * Do not ignore errors * Change error type * Add a timeout to chunk requests * Add custom errors and log them * Adds replace_availability_recovery method * recovery_threshold computed by erasure crate * change core to std * adds docs to error type * Adds a test for invalid reconstruction * refactors interaction run into multiple methods * Cleanup AwaitedChunks * Even more fixes * Test that recovery with wrong root is an error * Break to launch another requests * Styling fixes * Add SessionIndex to API * Proper relay parents for MakeRequest * Remove validator_discovery and use message * Remove a stream on exhaustion * On cleanup free the request streams * Fix merge and refactor
This commit is contained in:
@@ -282,7 +282,7 @@ impl View {
|
||||
pub mod v1 {
|
||||
use polkadot_primitives::v1::{
|
||||
Hash, CollatorId, Id as ParaId, ErasureChunk, CandidateReceipt,
|
||||
SignedAvailabilityBitfield, PoV, CandidateHash,
|
||||
SignedAvailabilityBitfield, PoV, CandidateHash, ValidatorIndex,
|
||||
};
|
||||
use polkadot_node_primitives::SignedFullStatement;
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
@@ -297,6 +297,16 @@ pub mod v1 {
|
||||
Chunk(CandidateHash, ErasureChunk),
|
||||
}
|
||||
|
||||
/// Network messages used by the availability recovery subsystem.
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
pub enum AvailabilityRecoveryMessage {
|
||||
/// Request a chunk for a given candidate hash and validator index.
|
||||
RequestChunk(RequestId, CandidateHash, ValidatorIndex),
|
||||
/// Respond with chunk for a given candidate hash and validator index.
|
||||
/// The response may be `None` if the requestee does not have the chunk.
|
||||
Chunk(RequestId, Option<ErasureChunk>),
|
||||
}
|
||||
|
||||
/// Network messages used by the bitfield distribution subsystem.
|
||||
#[derive(Debug, Clone, Encode, Decode, PartialEq)]
|
||||
pub enum BitfieldDistributionMessage {
|
||||
@@ -359,6 +369,9 @@ pub mod v1 {
|
||||
/// Statement distribution messages
|
||||
#[codec(index = "3")]
|
||||
StatementDistribution(StatementDistributionMessage),
|
||||
/// Availability recovery messages
|
||||
#[codec(index = "4")]
|
||||
AvailabilityRecovery(AvailabilityRecoveryMessage),
|
||||
}
|
||||
|
||||
impl_try_from!(ValidationProtocol, AvailabilityDistribution, AvailabilityDistributionMessage);
|
||||
|
||||
Reference in New Issue
Block a user