Repository navigation
Description
Follow-up from the #1235 review (#1227). Pre-existing since #1110 — not introduced by #1235, which corrects the docs but leaves the underlying shape.
Problem
CursorPolicy fuses two orthogonal axes:
- Persistence — does the watcher durably record a checkpoint (
store+key)? - Floor derivation — how does the first tick pick its scan floor?
WatcherConfig::seed_cursor is a third mechanism that silently overrides the second. run seeds cursor from it (resumable_watcher.rs:352), and initial_from is only called on the None branch (:304-306); the cursor is only ever written back as Some(..) (:311, :330) and never reset. So a seeded watcher never derives a floor, and its policy's derivation fields are dead.
seed_cursor's own doc already admits this in prose — "When set, the first tick scans from here instead of resolving the policy floor" — which is the tell: prose explaining that fields are meaningless is what #1227 was about.
Who is affected
Two of the six watchers seed their cursor:
| Watcher | Policy | Seeded? | Dead fields |
|---|---|---|---|
payment_settlement |
Persisted |
no | — (the only live reorg_margin consumer) |
dht::chain_origin_directory |
Persisted |
yes (:365) |
none_fallback, reorg_margin |
dht::capacity_bond_registry |
HeadMinusWindow |
yes (:409) |
window_blocks, floor |
blacklist_watcher |
FullReplay |
no | — |
slash_watcher |
HeadMinusWindow |
no | — |
reputation_indexer |
HeadMinusWindow |
no | — |
Origin therefore declares reorg_margin: REORG_MARGIN_BLOCKS and reads it never; its real resume floor is replay_from (chain_origin_directory.rs:316-319) — the raw checkpoint with no rewind. Note this means origin has no across-restart shallow-reorg coverage today. Whether it should is a separate question worth answering (see below).
Why not fixed in #1235
Removing the dead fields is not a deletion. reorg_margin is required by the Persisted variant, so the options were:
- Wrap the derivation fields in an
Option— trades an inert field for a cross-field invariant (Persisted { derive: None }withseed_cursor: Nonebecomes representable and wrong). Worse than today. - Split the axes properly — correct, but touches the shared loop and all six sites; too big for a PR titled "delete the dormant confirmations knob".
Sketch
struct WatcherConfig {
start: CursorStart,
persist: Option<Checkpoint>, // store + key — orthogonal to start
// seed_cursor: DELETED, subsumed by CursorStart::Seeded
}
enum CursorStart {
Seeded(u64), // origin, capacity_bond
FromCheckpoint { none_fallback, reorg_margin }, // settlement
HeadMinusWindow { window_blocks, floor }, // slash, reputation
FullReplay { floor }, // blacklist
}This makes both dead-field cases unrepresentable and removes the seed_cursor/policy overlap.
Decide while doing it
- Should origin rewind on resume? Today it does not. If yes, that is a behavior change (widens origin's boot re-scan by
REORG_MARGIN_BLOCKS) and needs its own test proving the rewind engages. WatcherConfig::from_blockis the same shape. Read only viainitial_from'sPersistedarm (:127); the other arms read their ownfloor. Every site passes the same value into both, so they can silently diverge. Prefer hoisting: deletefloorfrom the variants and let all arms read thefrom_blockparameter — the deploy block is a contract-level fact, not a policy choice.
Guardrail
Whatever lands, pin it with a test that asserts a live production config engages the value — not one that asserts the config merely carries it. That distinction is the whole lesson of #1227: hard-coding 0 at initial_from's call site passed the entire 814-test suite before #1235 added persisted_initial_from_engages_the_configured_margin.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
refactor(node): delete the dormant confirmations knob (#1227) (#1235)
altanoruc commentedon Jul 17, 2026
Triage note for a later run: two design decisions remain explicit in the issue: whether origin resume rewinds by the reorg margin, and whether
from_blockis hoisted out of policy variants. Please resolve both before implementation dispatch.refactor(node): split watcher CursorPolicy into CursorStart + owned C…
refactor(node): WatcherConfig builder with defaults + shared metric-h…