ChainSafe / ChainSafe/gossamer

AvailabilityRecovery: Implement FullFetch recovery strategy

Open
#4,299 0 comments 0 reactions 0 assignees View on GitHub
S-subsystems-availability
Dominant language
Go
Stars
454
Forks
144
PR merge metrics
No merged PRs in 30d

Description

## Issue summary
Implementing this issue assumes that we have already implemented FetchChunks. We should call this strategy first BEFORE the fetch chunks strategy if constraints (look design) are met.
_This strategy tries requesting the full available data from the validators in the backing group to which the node is already connected.
They are tried one by one in a random order. It is very performant if there's enough network bandwidth and the backing group is not overloaded. The costly reed-solomon reconstruction is not needed._
**NOTE: there are some part os the code that are only necessary for collators so we can skip them for now.**

This strategy requires `Reencode` the data into erasure chunks in order to verify the root hash of the provided Merkle tree,
which is built on-top of the encoded chunks.
This (expensive) check is necessary, as otherwise, we can't be sure that some chunks won't have been tampered with by the backers,
which would result in some validators considering the data valid and some.
That depends on the `erasure_coding.obtain_chunks_v1` method and is available to call from the `lib/erasure` module

**Main loop**
- take the next validator from an array
- create data request
- send message NetworkBridgeTxMessage::SendRequests with data request
- We await the full data to be returned. If so, data to be Reencoded and validated
- repeat until data is available or all validators are requested.

## Other information and links
- [Implementers' Guide](https://paritytech.github.io/polkadot-sdk/book/node/availability/availability-recovery.html#fetchfull)
- [example code](https://github.com/paritytech/polkadot-sdk/blob/6f96f7219ac3414db847c6fbade7e0841f9088de/polkadot/node/network/availability-recovery/src/task/strategy/full.rs#L54)
- [design doc](https://github.com/ChainSafe/gossamer/blob/development/docs/docs/design/availability-recovery.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.