forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mq pallet] Custom next queue selectors (paritytech#6059)
Changes: - Expose a `force_set_head` function from the `MessageQueue` pallet via a new trait: `ForceSetHead`. This can be used to force the MQ pallet to process this queue next. - The change only exposes an internal function through a trait, no audit is required. ## Context For the Asset Hub Migration (AHM) we need a mechanism to prioritize the inbound upward messages and the inbound downward messages on the AH. To achieve this, a minimal (and no breaking) change is done to the MQ pallet in the form of adding the `force_set_head` function. An example use of how to achieve prioritization is then demonstrated in `integration_test.rs::AhmPrioritizer`. Normally, all queues are scheduled round-robin like this: `| Relay | Para(1) | Para(2) | ... | Relay | ... ` The prioritizer listens to changes to its queue and triggers if either: - The queue processed in the last block (to keep the general round-robin scheduling) - The queue did not process since `n` blocks (to prevent starvation if there are too many other queues) In either situation, it schedules the queue for a streak of three consecutive blocks, such that it would become: `| Relay | Relay | Relay | Para(1) | Para(2) | ... | Relay | Relay | Relay | ... ` It basically transforms the round-robin into an elongated round robin. Although different strategies can be injected into the pallet at runtime, this one seems to strike a good balance between general service level and prioritization. --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: muharem <[email protected]>
- Loading branch information
1 parent
d114004
commit 7aac886
Showing
22 changed files
with
1,922 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.