Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Yieldable queues for pallet MessageQueue #13424

Merged
merged 15 commits into from
Feb 25, 2023
Merged

Conversation

ggwpez
Copy link
Member

@ggwpez ggwpez commented Feb 20, 2023

Preparation for: paritytech/cumulus#2157

Changes:

  • 🚨 Adds a Yield variant to the ProcessMessageError enum. This indicates that a queue wants to yield its service slot.
    Can be used to "pause" queues in a trivial way; the MQ pallet does not need to store any additional state about paused queues and the processor needs to re-check his paused-condition on each invocation anyway.
  • Adds a NoopServiceQueues impl, since ServiceQueues cannot be implemented for () due to its associated type.
  • 🚨 Changes process_message to use a &mut WeightMeter instead of Weight return to also consume weight in the error case.
  1. and 3. are breaking changes, but AFAIK the MQ pallet is not yet used downstream, therefore no migration is provided.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez marked this pull request as ready for review February 21, 2023 17:50
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. B1-note_worthy Changes should be noted in the release notes T1-runtime This PR/Issue is related to the topic “runtime”. labels Feb 23, 2023
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez ggwpez added the E0-runtime_migration PR introduces code that might require downstream chains to run a runtime upgrade. label Feb 24, 2023
@ggwpez
Copy link
Member Author

ggwpez commented Feb 24, 2023

bot bench $ pallet dev pallet_message_queue

@command-bot
Copy link

command-bot bot commented Feb 24, 2023

@ggwpez https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2442244 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_message_queue. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 76-49674869-4b50-40c3-856e-8e4373964168 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Feb 24, 2023

@ggwpez Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_message_queue has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2442244 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2442244/artifacts/download.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@ggwpez
Copy link
Member Author

ggwpez commented Feb 25, 2023

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 9526f04 into master Feb 25, 2023
@paritytech-processbot paritytech-processbot bot deleted the oty-mp-queue branch February 25, 2023 16:13
@redzsina redzsina added D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Mar 2, 2023
@Polkadot-Forum
Copy link

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-40/2468/1

ukint-vs pushed a commit to gear-tech/substrate that referenced this pull request Apr 10, 2023
* Add Yield message processing error

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add NoopServiceQueues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Implement temporary error aka Yield

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make NoopMessageProcessor generic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Mock pausable message processor

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Test paused queues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Integration test paused queues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use WeightMeter instead of weight return

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_message_queue

* Fix test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
* Add Yield message processing error

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add NoopServiceQueues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Implement temporary error aka Yield

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make NoopMessageProcessor generic

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Mock pausable message processor

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Test paused queues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Integration test paused queues

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use WeightMeter instead of weight return

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* fix

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Make compile

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add tests

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_message_queue

* Fix test

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B1-note_worthy Changes should be noted in the release notes C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited E0-runtime_migration PR introduces code that might require downstream chains to run a runtime upgrade. T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants