Draft: Baker: Use streamed RPC for forging DAL attestation
What
Parent MR: !19786 (merged)
Based on the streamed RPC GET /profiles/<pkh>/monitor/attestable_slots, we remove the next_level_dal_attestable_slots mechanism from the baker, to ultimately make the baker obtain the attestable slots used for forging attestations one level in advance, instead of two.
Plug the baker into the streamed DAL RPC GET /profiles/<pkh>/monitor/attestable_slots via a new attestable_slots worker, and remove the legacy (next_level_)dal_attestable_slots arguments from the level_state.
Why
Previously the baker queried at n + lag − 2 and carried that status forward to be included at n + lag − 1 and finally baked at n + lag (where n is the published_level).
With the worker, the baker obtains attestable slots at n + lag − 1 directly from the DAL stream (i.e., one level in advance, not two). This reduces look-ahead, aligns timing with when the info is actually available, and avoids extra polling.
How
By introducing a per-delegate worker that:
- Maintains a subscription to
monitor/attestable_slotsstreams for each delegate. - Consumes the initial
Backfillevent synchronously, then processes live events continuously. - Safely handles re-Backfill mid-stream on resubscriptions (e.g., protocol migration, reconnects).
- Populates an internal, level-keyed cache (with pruning) read by the baker at
n + lag − 1. - Handles stream/open failures gracefully (log + skip opening that delegate’s stream); no crashes if the DAL node is down or profiles are missing.
Manually testing the MR
-
CI green
-
tezt-cloudexperiments - journal -
Manual testing
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