backing: Remove redundant erasure encoding (#7469)

* Remove redundant erasure encoding

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Review feedback

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix comments

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

---------

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
This commit is contained in:
Andrei Sandu
2023-07-07 11:20:30 +03:00
committed by GitHub
parent 518773a943
commit e8d567a1f5
9 changed files with 213 additions and 62 deletions
+14 -3
View File
@@ -462,9 +462,10 @@ pub enum AvailabilityStoreMessage {
tx: oneshot::Sender<Result<(), ()>>,
},
/// Store a `AvailableData` and all of its chunks in the AV store.
/// Computes and checks the erasure root of `AvailableData` before storing all of its chunks in
/// the AV store.
///
/// Return `Ok(())` if the store operation succeeded, `Err(())` if it failed.
/// Return `Ok(())` if the store operation succeeded, `Err(StoreAvailableData)` if it failed.
StoreAvailableData {
/// A hash of the candidate this `available_data` belongs to.
candidate_hash: CandidateHash,
@@ -472,11 +473,21 @@ pub enum AvailabilityStoreMessage {
n_validators: u32,
/// The `AvailableData` itself.
available_data: AvailableData,
/// Erasure root we expect to get after chunking.
expected_erasure_root: Hash,
/// Sending side of the channel to send result to.
tx: oneshot::Sender<Result<(), ()>>,
tx: oneshot::Sender<Result<(), StoreAvailableDataError>>,
},
}
/// The error result type of a [`AvailabilityStoreMessage::StoreAvailableData`] request.
#[derive(Error, Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum StoreAvailableDataError {
#[error("The computed erasure root did not match expected one")]
InvalidErasureRoot,
}
/// A response channel for the result of a chain API request.
pub type ChainApiResponseChannel<T> = oneshot::Sender<Result<T, crate::errors::ChainApiError>>;