Skip to main content

Module orchestration

Module orchestration 

Source
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:

  1. Compute flag deltas over participation’s previous-epoch flags.
  2. Update inactivity scores over the same previous-epoch flags.
  3. Compute inactivity-leak penalties for the ending epoch.
  4. Finalise expired slashes (correlation penalty + reporter- bond release + exit lock).
  5. Rotate ParticipationTracker to current_epoch_ending + 1.
  6. Advance SlashingManager epoch.
  7. Resize trackers if validator_count changed.
  8. Prune old processed evidence + correlation-window entries.

§Why this order

  • 1 before 2update_for_epoch reads 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 5finalise_expired_slashes reads correlation_window entries 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§

EpochBoundaryReport
Summary produced by run_epoch_boundary. Carries every side-effect the caller needs to route downstream (logging, reward payouts, state snapshots).
ReorgReport
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§

JustificationView
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.