Expand description
Epoch-boundary orchestration.
Traces to: SPEC §10.
§Role
run_epoch_boundary is the single public entry point an
embedder calls once per epoch-boundary to drive every
per-epoch piece of slashing state forward in a FIXED,
spec-mandated order. Each downstream step depends on the
state produced by earlier steps; reordering is a protocol
error and pinned by DSL-127’s order tests.
Spec-mandated step order:
- Compute flag deltas over
participation’s previous-epoch flags. - Update inactivity scores over the same previous-epoch flags.
- Compute inactivity-leak penalties for the ending epoch.
- Finalise expired slashes (correlation penalty + reporter- bond release + exit lock).
- Rotate
ParticipationTrackertocurrent_epoch_ending + 1. - Advance
SlashingManagerepoch. - Resize trackers if
validator_countchanged. - Prune old processed evidence + correlation-window entries.
§Why this order
- 1 before 2 —
update_for_epochreads the same previous-epoch flags the flag-delta computation reads. Running the update first would rotate the tracker before the delta pass, losing the previous-epoch data permanently. - 3 before 4 — finalise uses correlation data that must reflect the most recent inactivity update; if penalties were computed after finalise, the cohort would use stale scores.
- 4 before 5 —
finalise_expired_slashesreadscorrelation_windowentries keyed by the CURRENT epoch; rotating the participation tracker first would confuse other consumers into believing the new epoch is active while the manager is still mid-finalise. - 8 last — pruning drops evidence and correlation rows that would otherwise be needed by earlier steps.
Structs§
- Epoch
Boundary Report - Summary produced by
run_epoch_boundary. Carries every side-effect the caller needs to route downstream (logging, reward payouts, state snapshots). - Reorg
Report - Summary produced by
rewind_all_on_reorg. Carries per- subsystem rewind outcomes so the caller (a chain-shell orchestrator) can log or emit metrics without re-deriving the rewind scope from internal tracker state.
Traits§
- Justification
View - Per-epoch finality view. Returns the epoch of the most
recently FINALIZED Casper-FFG checkpoint. DSL-127 consults
this to derive
in_finality_stall; the orchestrator does not require a full Casper view, only the finalized-epoch height.
Functions§
- rewind_
all_ on_ reorg - Global reorg orchestrator. Rewinds every slashing-state subsystem in a fixed order.
- run_
epoch_ boundary - Drive one epoch-boundary pass. See module docs for order.