Expand description
Daemon slash-detection watcher (#1032, G-NODE-05).
Surfaces every still-appealable slash minted against this node’s own operator
so the operator can see it over the admin RPC (admin_v1_slashes) and file
decdn appeal slash within the 30-day window without watching the chain
directly. A counter metric (decdn_slashes_detected_total) mirrors it.
Shape follows the CapacityBond registry watcher
(crate::dht::capacity_bond_registry) — enumerate at a snapshot block,
follow the tail, re-read periodically as the backstop — rather than
replaying logs:
- Enumerate at boot. The in-memory store is rebuilt on every start from
the authoritative
CapacityBond.operatorSlash*enumeration (ADR 019), not by re-scanning theSlashedlog tail from a block floor (#1108). Walking the append-only index backwards and stopping at the first closed record reads only the still-appealable tail. Offense and evidence come straight off the record; the enforced deadline is the record’s baseappealWindowCloseplus the globalpausedTotal, all read at the snapshot block. A transient RPC failure retries on the shared boot budget, like the registry bootstrap on the same contract; a deterministic fault or an exhausted budget fails startup. - Follow
SlashRecordedfrom the snapshot block. The route followsSlashRecordedon the shared multiplexed poller, seeded at the enumeration snapshot block, so there is no historical scan on any boot.SlashRecordedindexesoperatorastopic2, but the merged poller filter cannot scopetopic2, so the route receives every operator’sSlashRecordedanddecode_recorded’soperator == selfguard filters out the rest. The event carries only theslashId; the offense/evidence/deadline are point-read fromgetSlashRecord. - Resync as the backstop. A missed tail event (reorg at the unstable tip,
or a tick lost to RPC backoff) never self-heals otherwise, so the store is
re-enumerated every
SLASH_RESYNC_INTERVALat the snapshot block; this also prunes slashes whose appeal window has since closed. A slash the tail saw above that block survives the resync (fold_resync). The store is deduped byslashId, so the enumeration/tail overlap is harmless.
Structs§
- Detected
Slash - One slash detected against this node’s operator.
Functions§
- bootstrap
- Enumerate this operator’s still-appealable slashes from
CapacityBond, then return the shared detected-slash store (for the admin surface) and theSlashRecordedRoutethe shared poller drives to keep it current.
Type Aliases§
- Slash
Store - Shared, in-memory detected-slash store: appended in detection order and
deduped by
slashId. Cloned intocrate::admin::AdminStatefor the read-onlyadmin_v1_slashessurface.