Skip to content

fix(host-rpc): ingest [from, tip] when backfill_from is above ceiling#148

Open
prestwich wants to merge 2 commits into
mainfrom
prestwich/eng-2280
Open

fix(host-rpc): ingest [from, tip] when backfill_from is above ceiling#148
prestwich wants to merge 2 commits into
mainfrom
prestwich/eng-2280

Conversation

@prestwich
Copy link
Copy Markdown
Member

Summary

Fixes the sidecar crash-loop on restart described in ENG-2280.

When the sidecar restarted with its persisted host height within buffer_capacity/2 blocks of tip, drain_backfill declared backfill complete without fetching any blocks. The first subsequent handle_new_head then walked from an empty chain_view, returning a single-block segment whose RU parent was not in the DB — crashing the processor with parent ru block not present in DB at block-processor/src/v1/processor.rs:161. The loop self-healed after 5–10 minutes once the chain advanced past the ceiling.

The /2 ceiling exists to leave hash-walk headroom on new tips, but it must not drop blocks the node has already committed to ingesting. When from > backfill_ceiling but from <= tip, ingest up to tip in this batch instead of skipping.

Test plan

  • cargo clippy -p signet-host-rpc --all-features --all-targets -- -D warnings
  • cargo t -p signet-host-rpc
  • RUSTDOCFLAGS="-D warnings" cargo doc -p signet-host-rpc --no-deps --all-features
  • Deploy to testnet sidecar; restart while at tip; confirm no crash-loop and clean transition through drain_backfillhandle_new_head.

🤖 Generated with Claude Code

When the sidecar restarted with its persisted host height within
`buffer_capacity/2` blocks of tip, `drain_backfill` declared backfill
complete without fetching any blocks. The first subsequent
`handle_new_head` then walked from an empty `chain_view`, returning a
single-block segment whose RU parent was not in the DB — crashing the
processor with "parent ru block not present in DB" until the chain
advanced past the ceiling (5–10 minutes).

The `/2` ceiling exists to leave hash-walk headroom on new tips, but it
must not drop blocks the node has already committed to ingesting. When
`from > backfill_ceiling` but `from <= tip`, ingest up to `tip` in this
batch instead of skipping.

Fixes ENG-2280.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@prestwich prestwich requested a review from a team as a code owner May 21, 2026 07:30
Comment thread crates/host-rpc/src/notifier.rs Outdated
Provider tip regression (reorg, lagging replica) would silently switch
to frontfill from an inconsistent cursor, re-introducing the
parent-not-in-DB crash this branch addresses. Only `from == tip + 1` is
a legitimate completion; `from > tip + 1` now returns
`BackfillContinuityBreak`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@prestwich
Copy link
Copy Markdown
Member Author

[Claude Code]

@Fraser999 addressed in 537a98afrom > tip + 1 now returns BackfillContinuityBreak (with a warn! for visibility); only from == tip + 1 takes the silent completion path. Also added rustdoc to drain_backfill documenting the three return-value cases. Ready for re-review.

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.

3 participants