Nitride.xyz
Learn · Updated November 17, 2026

The repair protocol

Nitride.xyz team

The Solana repair protocol is how a validator fetches shreds it failed to receive through Turbine. When a block has holes that erasure coding cannot fill, the validator sends signed UDP requests to peers that hold the slot, naming the slot and shred it needs, and the peers answer with the stored shred.

What is the Solana repair protocol?#

Shreds reach a validator through Turbine, a tree of nodes passing UDP packets to each other. UDP gives no delivery guarantee, so some packets never arrive. The first line of defence is erasure coding: in current Agave, each batch of 32 data shreds travels with 32 coding shreds, and any 32 of the 64 are enough to rebuild the batch. FEC sets and erasure coding covers how that works.

When fewer than 32 shreds of a batch arrive, or when a node learns of a slot but not of the slot before it, coding cannot help. The node then asks other validators directly. That request and reply exchange is the repair protocol. The Anza design notes list two reasons it exists: packets lost to network failures, and slots that a node holds but cannot link to any fork it knows.

What can a validator ask for?#

The request messages are defined in Agave's serve_repair.rs. The main ones in release v4.4.1 are:

  • WindowIndex: "send me data shred number N of slot S". The peer looks it up in its ledger store and returns it if present. This fills specific holes.
  • HighestWindowIndex: "send me your highest shred for slot S, if it is at or past index N". The peer answers when its highest received shred meets that bar, or when it carries the last-in-slot flag. This tells a node how far a slot extends when it does not yet know where the slot ends.
  • Orphan: "slot S arrived but I don't know its parent". The peer walks back through the parent chain and returns the highest shred it holds for each ancestor, up to 11 responses in v4.4.1. That reveals the missing links.
  • AncestorHashes: "what are the hashes of the slots before S?". The peer replies only if it considers S duplicate confirmed, with up to 30 slot and hash pairs. Nodes use this to sort out which version of a slot to keep after a leader has produced two.

v4.4.1 also defines requests keyed by a block ID, a hash naming one specific version of a slot, so that a node can repair the exact version it is following.

How are requests secured?#

Each modern request starts with a header holding a signature, the sender's public key, the intended recipient's public key, a timestamp and a 32-bit nonce. A serving node rejects the request if the recipient key is not its own, if the timestamp is more than 10 minutes away from its own clock, or if the signature does not verify. Older unsigned request formats are still listed in the source but are refused.

Before answering, a serving node may reply with a ping instead of data. The requester must answer with a signed pong, and until a valid pong from that key and address is on record, its requests are dropped. The check ties each request to an address that really belongs to the sender, so a node cannot be made to send responses to an address that never asked.

Responses are the stored shred bytes with the request's 4-byte nonce appended, which lets the requester match each reply to an outstanding request and ignore unsolicited ones. The shred still carries the leader's signature, so the requester verifies it like any other shred.

Whom does a validator ask, and when?#

Peers are not picked uniformly. Agave weights the choice either by stake or by what each peer has announced through gossip about the slots it holds. The Anza design notes say requests should go to validators that have marked the slot as complete.

Timing is a tradeoff between asking too early and waiting too long. Agave v4.4.1 holds off repairing shreds of a FEC set for 250 ms after it sees that set start arriving, since the missing shreds may still be in flight or recoverable from coding shreds. It waits 150 ms for a reply before asking again. Work across forks is ordered by the stake that has voted on each fork, so the heaviest fork gets repaired first.

Repaired shreds are stored and replayed, but they are not retransmitted down the Turbine tree. Each node repairs for itself.

Why does repair matter if you only read shreds?#

A program that listens to raw shreds without running a validator does not take part in repair. If a shred never arrives and the coding shreds of its batch cannot rebuild it, that gap stays open on your side, even though validators will fill it for themselves a little later. The causes are usually ordinary UDP packet loss on the path or a socket buffer that overflowed.

So it pays to count what you miss. The guide to detecting gaps and duplicates shows how to track shred indexes per slot and FEC set, which tells you whether gaps come from your own receiver or from upstream.

Repair also explains a pattern you may see in data: a slot whose shreds arrived only partly through Turbine can still become a complete block on validators, because they repaired it. Completeness on a validator and completeness at a shred listener are different things.

Questions#

Does repair use Turbine?#

No. Repair is a separate request and response exchange between two nodes over UDP. Turbine pushes shreds outward from the leader, while repair pulls specific shreds on demand.

Can a repaired shred be forged by the peer that sends it?#

Not without the leader's key. A repaired shred carries the original leader signature over its batch's Merkle root, and the requester checks it before storing the shred.

Why not just request every missing shred at once?#

Many missing shreds arrive moments later or can be rebuilt from coding shreds. Requesting too early wastes bandwidth on both ends, which is why Agave waits briefly before repairing a set that is still arriving.

Sources#