Skip to main content

Module coding

Module coding 

Source
Expand description

Ordered delivery of erasure-coded blocks.

§Overview

The coding marshal couples the consensus pipeline with erasure-coded block broadcast. Blocks are produced by an application, encoded into types::Shards, fanned out to peers, and later reconstructed when a notarization or finalization proves that the data is needed. Compared to super::standard, this variant makes more efficient usage of the network’s bandwidth by spreading the load of block dissemination across all participants.

§Components

  • crate::marshal::core::Actor: The unified marshal actor that orders finalized blocks, handles acknowledgements from the application, and requests repairs when gaps are detected. Used with Coding as the variant type parameter.
  • crate::marshal::core::Mailbox: Accepts requests from other local subsystems and forwards them to the actor. Used with Coding as the variant type parameter.
  • shards::Engine: Broadcasts shards, verifies locally held fragments, and reconstructs entire types::CodedBlocks on demand.
  • crate::marshal::resolver: Issues outbound fetches to remote peers when marshal is missing a block, notarization, or finalization referenced by consensus.
  • types: Defines commitments, distribution shards, and helper builders used across the module.
  • Marshaled: Wraps an crate::Application implementation so it automatically enforces epoch boundaries and performs erasure encoding before a proposal leaves the application.

§Data Flow

  1. The application produces a block through Marshaled, which encodes the payload and obtains a crate::types::coding::Commitment describing the shard layout.
  2. The block is broadcast via shards::Engine; each participant receives exactly one shard and reshares it to everyone else once it verifies the fragment.
  3. The actor ingests notarizations/finalizations from simplex, pulls reconstructed blocks from the shard engine or backfills them through crate::marshal::resolver, and durably persists the ordered data.
  4. The actor reports finalized blocks to the node’s crate::Reporter at-least-once and drives repair loops whenever notarizations reference yet-to-be-delivered payloads.

§Storage and Repair

Notarized data and certificates live in prunable archives managed internally, while finalized blocks are migrated into immutable archives. Any gaps are filled by asking peers for specific commitments through the resolver pipeline. The shard engine keeps only ephemeral, in-memory caches; once a block is finalized it is evicted from the reconstruction map, reducing memory pressure.

§When to Use

Choose this module when the consensus deployment wants erasure-coded dissemination with the same ordering guarantees provided by super::standard. The API is a breaking change from the standard marshal: applications must adapt to the coding-specific variant type and buffer implementation required by this module.

Modules§

shards
Shard engine for erasure-coded block distribution and reconstruction.
types
Types for erasure coding.

Structs§

Coding
The coding variant of Marshal, which uses erasure coding for block dissemination.
Marshaled
An Application adapter that handles epoch transitions and erasure coded broadcast.
MarshaledConfig
Configuration for initializing Marshaled.