Skip to content

fix(hotblocks): keep the finalized head when retention passes it - #127

Merged
mo4islona merged 1 commit into
masterfrom
fix/hotblocks-retain-finalized-head
Nov 4, 2026
Merged

mo4islona merged 1 commit into
masterfrom
fix/hotblocks-retain-finalized-head

Conversation

@mo4islona

Copy link
Copy Markdown
Contributor

Closes #126

Problem

When a Head(n) retention window advanced past the finalized head, the
trim dropped the watermark from the dataset label. Finality does not move
back, so the deleted watermark was still a true claim about the chain —
but every response until finality climbed back into the window reported
no finalized head at all, and /finalized-stream answered 204 without
the watermark headers.

Change

  • The write path keeps the watermark when a trim passes it (RS-2): only
    a RESET clears it. Clients read the whole window as unfinalized while
    the head sits below it.
  • NO_DATA answers carry the watermark (RP-5): the bounded-wait timeout
    maps to QueryIsAboveTheHead with the current head instead of none,
    and a finalized-only query whose range starts above the head reads as
    NO_DATA, never an empty 200.
  • Finality reports below the window neither clear nor lower the kept
    head; a report back inside the window raises it again.
  • Spec INV-5/INV-6, WP §2.5, RS-2 and the conformance pseudocode relax
    to match; the harness model and comparator updated accordingly.
  • New black-box test CT-10 (ct10_finality_below_window) covers: the
    200 from the window keeps reporting the head below it, both NO_DATA
    paths (live above the head, finalized-only from the window start)
    carry the watermark, and finality climbing back raises it.

The open question from the issue — a dataset clear dropping the head —
stays unchanged; that path is a RESET and keeps clearing the watermark.

🤖 Generated with Claude Code

Finality does not move back, so dropping the watermark when a trim left
it below the window stripped finality information from every response
until the chain's finality climbed back in. The watermark now survives
below the window as a claim about the chain (RS-2) and NO_DATA answers
carry it too (RP-5); only a RESET — or a trim that empties the window
(INV-5) — clears it. The conformance model matches the service on both
edges: the emptying trim clears its watermark, and the fork fallback
under finality below the window resumes at the window start (WP-6), a
position INV-14 permits.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@mo4islona
mo4islona force-pushed the fix/hotblocks-retain-finalized-head branch from 5b28ffc to 617e6db Compare November 4, 2026 12:33
@mo4islona
mo4islona merged commit ab6951b into master Nov 4, 2026
3 checks passed
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.

hotblocks: stream responses lose the finalized head when retention passes it

1 participant