Introducing a new way to review your PRs.

Read the announcement

celestiaorg / celestia-core

A fork of CometBFT

View on GitHub

20 documents · Updated Nov 23, 2026

docs / consensus-propagation

Consensus propagation

Consensus propagation moves proposal commitments and block parts between peers so the consensus engine can inspect a proposal and obtain the exact block data named by it. It combines signed compact block metadata with peer-specific part exchange, bounded proposer pushes, recovery from parity data or the mempool, catch-up for committed heights, and limits that keep recovery traffic from consuming the node.

Propagation role

The propagation reactor is the block-data side of consensus. It receives the active height, round, and proposer from consensus, sends locally created proposals to peers, and returns verified proposals and original block parts to consensus through its boundary channels. See Consensus for the round state and Consensus messages and signing for the wider message and signature model.

Consensus context

The reactor validates a compact proposal against one complete consensus context: height, round, proposer key, and the block-size limit for that height. Consensus installs these values together before cached proposals are checked. This prevents a proposal from one round from being checked with the proposer or block limit of another round.

The reactor starts normal data processing only after the node is ready to process consensus. It can still hold future proposals while the node catches up. Consensus reads verified proposal notices and original parts from the reactor, so block data follows the same proposal identity that consensus uses.

References: consensus/…/reactor.go• L369-409 consensus/…/propagator.go• L10-31 consensus/state.go• L3131-3160

Commitment and block data

Propagation separates the small commitment that describes a block from the block parts that carry its bytes. The commitment lets peers learn what to fetch before they exchange the full block.

Compact block commitments

The compact block is a proposal plus the information needed to recover its parts. It carries the original part hashes, parity part hashes, the parity root, the final-part length, and transaction locations that may be rebuilt from local mempool data. The proposer signs this complete commitment before it is broadcast.

Peers check the proposal context, signature, part count, roots, and transaction ranges. The reactor binds an accepted commitment to its height, round, block hash, and part-set header. A conflicting compact block cannot replace or mix with an accepted entry. A commitment or complete block supplied by consensus can replace an incomplete entry, but the reactor clears peer state for the old identity first. A duplicate is forwarded to consensus at most once.

The first broadcast spreads the compact block. It may also push a small set of parts that transaction data cannot rebuild. Later broadcasts spread HaveParts inventories that identify useful parts. This keeps the large block payload on demand rather than sending every part to every peer.

References: consensus/…/commitment.go• L26-132 consensus/…/commitment.go• L180-270 consensus/…/commitment.go• L455-518 consensus/…/commitment_state.go• L62-114 consensus/…/types.go• L62-146

Proposer part push

The proposer gives the peer that received a compact block a one-time allowance for unrequested parts. It uses this path for block bytes that no mempool can rebuild, such as header or commit data. The allowance is limited to three parts per peer and is consumed once per part.

When transaction locations form one continuous range, the proposer pushes the uncovered parts and advertises them before peers request data. If the layout is not safe to infer or more than three parts need a push, it sends no unrequested parts and advertises a small set of original parts for normal want exchange instead. A peer accepts an unrequested part only when the compact block granted that part. Requested parts remain acceptable from any peer.

References: consensus/…/uncovered_parts.go• L7-60 consensus/…/commitment.go• L80-164 consensus/…/peer_state.go• L540-576 consensus/…/have_wants.go• L542-557 consensus/…/have_wants.go• L711-725

Part recovery

The reactor tracks original block parts and parity parts as one recovery set. A peer needs enough combined parts to rebuild the block, but consensus receives only the verified original parts. This lets parity repair missing data without changing the block representation consumed by consensus.

Transactions named in a compact block can also provide local original parts when the node still has those transactions in its mempool. The reactor rebuilds only parts fully covered by the known transaction byte ranges, including the short final part. Recovered parts are checked against the commitment before they are stored or announced. Once enough combined parts exist, the reactor rebuilds missing original parts, then creates parity only if the result matches the committed parity root.

References: consensus/…/combined_partset.go• L18-27 consensus/…/combined_partset.go• L120-158 consensus/…/unmarshalling.go• L40-141 consensus/…/commitment.go• L273-400 consensus/…/have_wants.go• L516-680 consensus/…/commitment_test.go• L194-334

Peer inventories and wants

Each peer has a separate view of block-part knowledge. The reactor uses this view to request parts that the peer reports and to serve parts that the peer wants, while the consensus reactor receives matching peer knowledge for its own vote and proposal gossip.

Peer inventories

For each height and round, peer state records three inventories:

  • Haves identify parts the peer reports that it has.
  • Wants identify parts the peer still needs from this node.
  • Requests identify parts this node already requested from that peer.

The reactor updates these inventories as HaveParts, WantParts, and recovery-part messages arrive. It also remembers parts ever requested from a peer, even after the active request expires, so a late reply is still treated as requested. It prunes old state after a commit or height change. State stays bounded across heights and rounds, with lower heights retained for catch-up and the newest round retained after a long stall.

A peer can also keep a bounded set of unverified future proposals. These are held until the local consensus context makes validation possible. The cache keeps the nearest heights first and allows one cached proposal per height for each peer.

The propagation and consensus reactors share a small peer-state interface. When propagation learns that a peer knows a proposal or part, it updates the consensus view as well. This avoids separate reactors making the same peer the target of duplicate data.

References: consensus/…/peer_state.go• L17-37 consensus/…/peer_state.go• L46-100 consensus/…/peer_state.go• L131-235 consensus/…/peer_state.go• L258-334 consensus/…/peer_state.go• L459-606 consensus/…/propagator.go• L39-51 consensus/…/peer_state_test.go• L449-602

Want exchange

The want flow is pull based. A node first learns a peer's inventory, subtracts parts already stored or already requested elsewhere, and sends a want for the remaining useful parts. The peer sends available recovery parts and keeps the rest as wants to serve when those parts arrive. A request is recorded before its message is sent, then rolled back if the send fails, so a fast reply cannot race the request record.

The reactor limits repeated requests for one part and tracks active requests so they can expire and be retried. Receiving a valid part clears matching wants and may immediately satisfy other peers that asked for that part. Request concurrency is shared across peers and scales with the current peer count and proposal size. Full input queues do not block the reactor's message path.

When a peer wants a committed height that is no longer cached, the reactor serves original parts from the block store. Wants for uncached non-committed rounds do not grow long-lived peer state. A peer can still receive a valid want response when its tracked state is full, but the response remains bounded by the request's missing-part count.

When a node processes a want exchange, it follows this sequence:

  1. Validate the proposal or committed block identity and the requested part-set size.
  2. Select parts that this node holds and that the peer requests.
  3. Send those parts within the peer's remaining request allowance.
  4. Keep unsent wants for later recovery when the entry is locally cached.
sequenceDiagram
    participant A as Node A
    participant B as Node B
    A->>B: Compact block
    B->>A: HaveParts(inventory)
    A->>B: WantParts(missing indexes)
    B-->>A: RecoveryPart(data and proof)
    A-->>B: HaveParts(newly available parts)
    Note over A: Rebuild block and pass original parts to consensus

References: consensus/…/have_wants.go• L20-118 consensus/…/have_wants.go• L120-261 consensus/…/have_wants.go• L358-514 consensus/…/have_wants.go• L516-680 consensus/…/peer_state.go• L289-334 consensus/…/peer_state.go• L644-660 consensus/…/have_wants_test.go• L81-269

Catch-up behavior

Catch-up handles two related gaps: a node may know a committed part-set identity but not its data, or it may receive a future proposal before consensus reaches that height and round. The reactor keeps these cases separate from normal active-round exchange while using the same proof and identity checks.

Commitment catch-up

When consensus learns a commit for a block whose parts are missing, it adds the part-set header to propagation. The reactor creates a catch-up record and asks peers for the missing original parts with proofs. It prefers peers near the required height and retries requests after old requests expire. If the same commitment already exists, the reactor marks that entry for catch-up instead of creating a second identity.

The block store can serve original parts for already committed heights. These serves use a shared stored-part budget. Catch-up does not treat a complete recovered block as a completed consensus proposal until consensus receives and processes the proposal state that binds the block to the active flow.

A complete block handed over by consensus also fills a matching incomplete entry and serves wants that peers already parked on it. A complete block for the node's own proposal does not replace another block at the same height and round.

When a commitment replaces a different block at the same height and round, the reactor removes the old per-peer haves, wants, and requests before it starts recovery for the new identity. This prevents old request bits from suppressing requests for the committed block.

References: consensus/…/catchup.go• L15-190 consensus/…/catchup.go• L192-240 consensus/…/have_wants.go• L358-514 consensus/state.go• L1815-1830 consensus/…/have_wants_test.go• L188-269

Future proposal catch-up

If a compact proposal cannot yet be checked because its height, round, or proposer is not active, the reactor stores it per peer. The cache is bounded and favors lower heights so the node works toward the nearest missing consensus state.

After consensus installs a new context, the reactor checks cached proposals from all peers for that height and round. It applies the first valid proposal, forwards it to consensus at most once, recovers local mempool parts, and starts part requests without blocking the consensus receive path. A failed cached proposal remains available while another peer's proposal is tried, and a successful cache entry is removed only after it is applied. A conflicting proposal is rejected before it can replace the accepted block or reach consensus. Only cached senders whose proposal is independently valid and matches the applied block receive the one-time push allowance. Reapplying an identical proposal does not forward it a second time.

The reactor also forwards a validated compact block before local mempool recovery finishes. This lets other peers continue the exchange while local recovery runs in parallel. Tests and fuzz checks cover duplicate delivery, conflicting identities, changed proposers, changed block-size limits, and recovery that cannot block the consensus path.

References: consensus/…/peer_state.go• L17-20 consensus/…/peer_state.go• L486-576 consensus/…/catchup.go• L238-374 consensus/…/commitment_state.go• L91-114 consensus/…/commitment_test.go• L453-725 consensus/…/reactor_fuzz_test.go• L728-835

Bandwidth budgeting

Propagation budgets both request concurrency and block-store reads. These limits preserve progress when many peers request the same block or when a peer does not consume data fast enough.

Request limits

The reactor spreads requests across peers instead of allowing one peer to serve the whole block. The concurrent limit depends on the number of peers and the number of combined parts in the current proposal. Each part also has a request cap, so repeated advertisements cannot create unbounded duplicate traffic. Proposer pushes use a separate small allowance and do not bypass part validation.

The data and want channels have separate high-priority paths. Per-peer queues and request counters prevent one slow or noisy peer from stopping other peers from making progress. Requests that are not answered can be retried after the request timeout.

Stored-part budget

Serving a committed height may require reads from the block store rather than the in-memory proposal cache. A shared token bucket limits those reads across all peers to 2,000 parts per second and allows one maximum-size block as the burst. The budget is charged only for original parts that the store can serve. When the budget is empty, later retry cycles can serve the remaining wants.

References: consensus/…/reactor.go• L28-51 consensus/…/reactor.go• L392-418 consensus/…/have_wants.go• L109-118 consensus/…/have_wants.go• L120-245 consensus/…/have_wants.go• L455-514 consensus/…/budget.go• L8-47 consensus/…/peer_state_test.go• L505-566

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep compact block roots, part counts, transaction ranges, signatures, and block identity aligned with part recovery and the proposal sent to consensus.
  • Keep proposer push allowances aligned with the transaction coverage rule, the three-part cap, and the have advertisement fallback.
  • Keep peer haves, wants, requests, ever-requested state, push allowances, and the consensus peer-state view aligned when changing any gossip path.
  • Keep commitment replacement tied to deletion of old per-peer part state so stale requests cannot suppress committed-block recovery.
  • Keep complete committed-block handoff distinct from own-proposal handoff so a parked want is served without replacing the wrong proposal.
  • Keep cached proposal limits, sender validation, push grants, and replay rules aligned with atomic height, round, proposer, and block-size-limit updates.
  • Keep request caps, retry expiry, channel priorities, and the stored-part token bucket aligned with the desired peer and disk-load limits.
  • Keep the propagation wire messages aligned with basic validation and proof checks before accepting data.

Important failure modes

TriggerConsequenceGuard
A compact block is checked against the wrong height, round, proposer, or block-size limit.A valid proposal can be rejected or an invalid proposal can enter gossip.Install the complete consensus context together before validation.
A commitment has invalid roots, part counts, or overlapping transaction ranges.Peers can reconstruct data that does not match the proposal.Validate the commitment and derive proofs from its roots before storing it.
A part arrives without a matching proposal or proof.Unbound data can enter the recovery set or be relayed.Require known proposal state and verify the part against its commitment.
A peer pushes a part outside its one-time allowance.Unrequested data can consume recovery work or mix with an unrelated block.Admit only requested parts or parts explicitly allowed by the sender's validated compact block.
Transaction locations have gaps or require too many non-transaction parts.A peer can receive an unsafe inferred push or wait for data that cannot come from its mempool.Push only contiguous transaction-covered layouts within the three-part cap; otherwise use have/want exchange.
Per-peer request state survives a commitment replacement.Stale requests can stop the reactor from requesting the new committed parts.Delete the old height-round peer state when the identity changes.
A peer state fills with distant heights or too many rounds.The node can lose state for the next height or current round.Bound state and retain lower heights plus the newest round needed for progress.
A future proposal cache fills with distant heights.The node delays the nearest height needed for consensus catch-up.Bound the cache and retain lower heights first.
A peer or send queue drops a requested part.The node remains incomplete after one request pass.Expire requests and retry across eligible peers.
Stored-part serving exceeds the shared read budget.Catch-up traffic can overload block-store reads and peer service.Consume a token for each stored part and retry later when tokens refill.
A duplicate or conflicting proposal reaches the consensus channel.Consensus can process the same proposal twice or mix data from different blocks.Bind entries to block identity and claim forwarding only once.
Cached proposal recovery waits on a full consensus proposal or part channel.Consensus cannot finish installing the new height or round.Apply the cache entry first, then deliver the proposal and recovered parts from a separate path.
A peer sends undecodable or invalid propagation data.The peer can consume reactor work with malformed state or proofs.Validate wire messages before processing them and stop the sender on invalid input.

Key files

FileWhy to read it
consensus/…/reactor.goDefines the reactor lifecycle, peer set, channels, consensus-context handoff, request limits, and catch-up scheduling.
consensus/…/propagator.goDefines the boundary between propagation and the consensus state machine.
consensus/…/commitment.goShows compact commitment creation, validation, broadcast, and mempool recovery.
consensus/…/commitment_state.goDefines proposal identity, cached block data, request state, and one-time forwarding.
consensus/…/peer_state.goDefines per-peer haves, wants, requests, retry expiry, push allowances, and bounded future-proposal storage.
consensus/…/have_wants.goShows inventory exchange, part requests, serving, proof handling, stored-block catch-up, and request limits.
consensus/…/uncovered_parts.goDefines which non-transaction parts may be pushed and the safe fallback advertisement.
consensus/…/catchup.goShows commitment-driven catch-up, stored-block recovery, and replay of cached proposals.
consensus/…/budget.goDefines the shared rate limit for block-store part reads.
consensus/…/types.goDefines compact blocks, inventories, wants, recovery parts, and their wire checks.
consensus/…/combined_partset.goExplains the original-plus-parity recovery view used to rebuild block data.
consensus/…/unmarshalling.goExplains how known transaction bytes reconstruct only fully covered block parts.
consensus/…/commitment_test.goCovers proposer propagation, mempool recovery, proposal identity, context updates, duplicate forwarding, and non-blocking recovery.
consensus/…/have_wants_test.goCovers bounded want state, stored-block serving, relay parity, and parked-want recovery.
consensus/…/peer_state_test.goCovers bounded height and round state, request ordering, cache priority, and late-round recovery.
consensus/…/reactor_fuzz_test.goExercises mixed peer input and consensus transitions while checking proof, identity, state-bound, and liveness invariants.
consensus/state.goShows when consensus installs propagation state, submits proposals, adds commitments, and consumes recovered data.
proto/…/types.protoDefines the propagation messages exchanged between peers.
docs/consensus.mdParent page for the consensus state machine and its reactor.
docs/consensus-messages-and-signing.mdRelated page for consensus message validation and signing boundaries.