Crate polkadot_erasure_coding
source ·Expand description
As part of Polkadot’s availability system, certain pieces of data for each block are required to be kept available.
The way we accomplish this is by erasure coding the data into n pieces and constructing a merkle root of the data.
Each of n validators stores their piece of data. We assume n = 3f + k
, 0 < k ≤ 3
.
f is the maximum number of faulty validators in the system.
The data is coded so any f+1 chunks can be used to reconstruct the full data.
Structs§
- An iterator that yields merkle branches and chunk data for all chunks to be sent to other validators.
Enums§
- Errors in erasure coding.
Functions§
- Verify a merkle branch, yielding the chunk hash meant to be present at that index.
- Construct a trie from chunks of an erasure-coded value. This returns the root hash and an iterator of merkle proofs, one for each validator.
- Obtain erasure-coded chunks, one for each validator.
- Obtain erasure-coded chunks for v1
AvailableData
, one for each validator. - Reconstruct decodable data from a set of chunks.
- Reconstruct the available data from the set of systematic chunks.
- Reconstruct the v1 available data from the set of systematic chunks.
- Reconstruct the v1 available data from a set of chunks.
- Obtain a threshold of chunks that should be enough to recover the data.
- Obtain the threshold of systematic chunks that should be enough to recover the data.