Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mq pallet] Custom next queue selectors #6059

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Oct 14, 2024

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.

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]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
@ggwpez ggwpez marked this pull request as ready for review October 17, 2024 20:50
@ggwpez ggwpez requested a review from a team as a code owner October 17, 2024 20:50
@ggwpez ggwpez added the T2-pallets This PR/Issue is related to a particular pallet. label Oct 17, 2024
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
Status: Backlog
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants