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

Prune messages from on-idle callback #1650

Merged
merged 8 commits into from
Nov 21, 2022
Merged

Conversation

svyatonik
Copy link
Contributor

part of #1647

Pruning from on-idle isn't that easy, since we support multiple lanes and (I believe) we may actually use other lanes in the future - e.g. to prioritize some bridge over others or to increase bridge bandwidth. But then to prune messages we need to iterate all lanes and check if those have unpruned messages. Iterating = db read and if we'll be reading lane state it at every on-idle call, we may run out of remaining weight without doing any actual work. So instead I've added ActiveOutboundLanes to the messages pallet configuration and we're pruning only one lane per block (block_number % lanes_len). This still may cause troubles in the future, but for our start it is fine

@svyatonik svyatonik added P-Runtime PR-audit-needed A PR has to be audited before going live. PR-breaksruntime A PR that is going to break runtime bridge compatibility. We need to be careful with upgrade. labels Nov 18, 2022
modules/messages/src/lib.rs Outdated Show resolved Hide resolved
@svyatonik svyatonik enabled auto-merge (squash) November 21, 2022 10:12
@svyatonik svyatonik merged commit 82a849d into master Nov 21, 2022
@svyatonik svyatonik deleted the prune-messages-from-on-idle branch November 21, 2022 10:29
jiguantong pushed a commit to darwinia-network/darwinia-messages-substrate that referenced this pull request Apr 18, 2023
serban300 pushed a commit to serban300/parity-bridges-common that referenced this pull request Mar 27, 2024
* prune messages from on-idle callback

* no more secondary lanes at deployments

* clippy

* Update modules/messages/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* sub -> add

* more tests + check that message is sent using one of ActiveOutboundLanes

* ensure spent_weight is correct

Co-authored-by: Adrian Catangiu <adrian@parity.io>
serban300 pushed a commit to serban300/parity-bridges-common that referenced this pull request Apr 8, 2024
* prune messages from on-idle callback

* no more secondary lanes at deployments

* clippy

* Update modules/messages/src/lib.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>

* sub -> add

* more tests + check that message is sent using one of ActiveOutboundLanes

* ensure spent_weight is correct

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-Runtime PR-audit-needed A PR has to be audited before going live. PR-breaksruntime A PR that is going to break runtime bridge compatibility. We need to be careful with upgrade.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants