DAL_node: Backfill mechanism performance optimisations
What
This MR addresses some adjustments necessary for the integration of the monitoring attestable_slots RPC in the baker, which will be done in subsequent MRs.
Why
To increase the performance of the monitoring RPC for attestable_slots.
How
We do the following things:
- avoid using a sequential fold for a parallel map
- return the backfilled attestation levels in increasing order, as it is needed by the following MRs which will use them in a cache with FIFO eviction policy (see relevant MR commit : !19875 (aa5bce24))
- make sure the streams created for each subscriber are independent and all start with a proper
Backfillevent - remove repeated computation in the inner loop of the
Backfillcomputation
Manually testing the MR
With the same scenario presented here, you should notice no change in the result, besides the ordering of the attestation_level in the backfill_payload JSON response:
{
"kind": "backfill",
"backfill_payload": {
"slot_ids": [
{
"slot_level": 16376303,
"slot_index": 8
},
{
"slot_level": 16376304,
"slot_index": 8
},
{
"slot_level": 16376305,
"slot_index": 8
},
{
"slot_level": 16376306,
"slot_index": 8
},
{
"slot_level": 16376307,
"slot_index": 8
},
{
"slot_level": 16376308,
"slot_index": 8
},
{
"slot_level": 16376309,
"slot_index": 8
},
{
"slot_level": 16376310,
"slot_index": 8
},
{
"slot_level": 16376311,
"slot_index": 8
}
],
"no_shards_attestation_levels": []
}
}
...
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