Alpha/Baker: Add DAL attestable slots worker
What
Parent MR: !19948 (merged)
This MR introduces a DAL attestable slots worker module that:
- Subscribes per-delegate to the DAL node’s
monitor_attestable_slotsstream. - Delivers a
Backfillas the first event per subscriber, then processes live events. - Maintains an in-memory cache keyed by attestation level with per-delegate values.
- Exposes some small public APIs:
create,update_streams_subscriptions,get_dal_attestable_slots, andshutdown_worker. - No changes to the baker pipeline in this MR - only new module + wiring where necessary (types, events, mli).
Why
We want a dedicated, reusable component that tracks attestable slots incrementally (via streams) instead of polling from static RPCs. Having this worker land first keeps the next MRs small: later we will:
- update subscriptions from the baker;
- swap the baker's getter to the worker getter, without mixing concerns.
How
On subscribe, the stream wrapper returns exactly one Backfill event to that subscriber, then yields live events. Events update a mutex-protected cache mapping attestation_level -> delegate_id -> {published_level; slots} | Not_in_committee. attestation_level is computed as slot_level + attestation_lag - 1 (without worrying about the protocol migration cases, which are handled by the DAL node, therefore the stream only contains "safe" information) to match on-chain attestation time.
Manually testing the MR
CI green (this is a no-op for the baker or DAL node, we just have a background worker ready to be used in the next MRs, so we basically test it there).
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR