hotshot_new_protocol/vid.rs
1//! Verifiable information dispersal (VID) for the new protocol.
2//!
3//! A block's payload is erasure-coded per namespace and spread across the
4//! committee so the block can be recovered from any subset of storage nodes
5//! whose shards cover the recovery threshold. This module owns the three stages
6//! of that lifecycle, one per submodule:
7//!
8//! - [`disperse`] -- the leader side. [`VidDisperser`] erasure-codes each
9//! namespace, coalesces namespaces into size-balanced buckets, and unicasts
10//! to every node a stream of [`AvidmGf2DisperseShareFragment`] messages
11//! (one per bucket), each carrying that node's shares for the bucket's
12//! namespaces.
13//!
14//! - [`fragments`] -- the receive side of dispersal, the mirror of
15//! [`VidDisperser`]. [`VidFragmentAccumulator`] buffers the fragments a node
16//! receives for its *own* share and, once every namespace has arrived,
17//! reassembles them into a complete [`VidDisperseShare2`]. That share is then
18//! verified, attached to this node's vote, and fed to the reconstructor.
19//!
20//! - [`reconstruct`] -- block recovery. [`VidReconstructor`] collects the
21//! verified shares contributed by *many* voters (each node's own share,
22//! carried on its vote) and decodes the payload once their shards cover the
23//! recovery threshold.
24//!
25//! [`AvidmGf2DisperseShareFragment`]: hotshot_types::data::vid_disperse::AvidmGf2DisperseShareFragment
26//! [`VidDisperseShare2`]: hotshot_types::data::VidDisperseShare2
27
28mod disperse;
29mod fragments;
30mod reconstruct;
31
32pub use disperse::{VidDisperseError, VidDisperseOutput, VidDisperseRequest, VidDisperser};
33pub use fragments::{VidFragmentAccumulator, VidFragmentError};
34pub use reconstruct::{
35 VidReconstructError, VidReconstructErrorKind, VidReconstructOutput, VidReconstructor,
36};