Skip to content

feat(#85): header-propagation integrity gate + running-head divergence monitor#86

Merged
Reiers merged 1 commit into
mainfrom
fix/85-chain-head-reliability
Jul 1, 2026
Merged

feat(#85): header-propagation integrity gate + running-head divergence monitor#86
Reiers merged 1 commit into
mainfrom
fix/85-chain-head-reliability

Conversation

@Reiers

@Reiers Reiers commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Closes the two concrete asks in #85 and the deferred half of #80.

#85 item 1 — header propagation

gossipsub already forwards a message to our mesh peers once the registered TopicValidator returns ValidationAccept, so Lantern already propagates headers. This tightens that gate: the validator now (a) requires the message to consume the entire payload (rejects trailing bytes after a valid block) and (b) re-derives the header CID from a canonical CBOR re-encode. Propagation and ingestion now share one integrity bar, so a malformed header or a block under a fake CID is never re-gossiped. Full BLS / election-proof validation stays the consumer's job (needs ffi, out of scope for an F3-anchored light client — see TRUST-MODEL.md).

#85 item 2 / #80 part 2 — robust head discovery

New chain/headcheck package: a periodic running-head divergence monitor.

  • Polls a diversity of independent head sources, counted by source Kind (so N URLs of the same upstream count once — genuine independence, mirroring the bootstrap quorum policy).
  • Agreement is measured within a 3-block lookback (the snadrus#85 ask).
  • On a quorum of independent sources diverging from our gossip head beyond the lookback, it raises an eclipse/fork alarm (logged; dashboard hook via OnResult).
  • It never moves our head and never makes a trusted RPC the head oracle — gossip + Running-head fork choice: heaviest-ParentWeight + periodic re-quorum (not boot-only) #79 heaviest-ParentWeight fork choice still own head selection. headcheck only corroborates or disputes the head we already derived.

Wired best-effort into pkg/daemon via Config.HeadCheckRPCs (disabled when empty, so it can't sink head-tracking).

Trust model

TRUST-MODEL.md threat-model row for gossipsub eclipse updated to reflect the stacked tip defenses: #79 weight fork choice → must out-weight the real chain, #80 un-evictable trusted-peer floor → can't crowd out the peer table, #85 propagation gate + divergence monitor, and F3 fully closing the unfinalized tip on mainnet activation.

Tests

  • chain/headcheck: agreement, same-kind diversity collapse, divergence alarm, insufficient-sources, median, start/stop.
  • blockpub: trailing-garbage + nil-header rejection through the propagation gate.
  • Full suite 44 packages green (-short, LANTERN_OFFLINE=1), build + vet + gofmt clean.

Follow-ups (not in this PR)

…e monitor

#85 item 1 (header propagation): tighten the block gossipsub TopicValidator
so Lantern only ValidationAccepts - and therefore only re-propagates - blocks
that fully consume the payload (no trailing bytes) and whose header round-trips
through canonical CBOR to its declared CID. Propagation and ingestion now share
one integrity bar; Lantern can't be turned into an amplifier for a malformed or
fake-CID header.

#85 item 2 / #80 part 2 (robust head discovery): new chain/headcheck package -
a periodic running-head divergence monitor. It asks a diversity of INDEPENDENT
head sources (counted by source Kind, so N URLs of one upstream count once) what
epoch the head is at and checks agreement within a 3-block lookback. On a quorum
of independent sources diverging from our gossip head it raises an eclipse/fork
alarm. It never moves our head (gossip + #79 fork choice do that) and never makes
a trusted RPC the head oracle - it only corroborates or disputes.

Wired best-effort into pkg/daemon (Config.HeadCheckRPCs); disabled when empty so
it can't sink head-tracking. TRUST-MODEL.md threat-model row updated to reflect
the stacked tip defenses (#79 weight fork choice, #80 peer floor, #85 propagation
gate + divergence monitor; F3 closes it on mainnet).

Tests: chain/headcheck full suite (agreement, kind-diversity collapse, divergence
alarm, insufficient-sources, median, start/stop); blockpub validator trailing-
garbage + nil-header rejection. Full suite 44 pkgs green (-short, LANTERN_OFFLINE=1),
build+vet+gofmt clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant