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

DMP Queue pallet #416

Merged
merged 51 commits into from
May 2, 2021
Merged

DMP Queue pallet #416

merged 51 commits into from
May 2, 2021

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Apr 28, 2021

Part of paritytech/polkadot#2841.

A bit similar to the XCMP Queue pallet, but for DMP messages.

  • Tests
    • Service-queued (weight limit greater than queued message weight)
    • Service-inline (nothing queued, weight limit greater than incoming message weight)
    • Enqueue (nothing queued, weight limit less than incoming message weight)
    • Service-inline-then-Enqueue (nothing queued, multiple incoming messages, weight limit greater than first incoming message weight, less than total incoming message weight)
    • Service-queued-then-service-inline (incoming message(s) and queued messages(s); weight-limit greater than total of all messages' weight)
    • Service-queued-partially-then-enqueue (queued messages and incoming messages; weight-limit less than total of queued messages weight and incoming message weight)
    • Service-queued-completely-then-enqueue (queued messages and incoming messages; weight-limit greater than total of queued messages weight but less than total of queued messages weight plus the first incoming message weight)
    • Service-queued-then-service-inline-then-enqueue (queued messages and incoming messages; weight limit greater than queued message weights plus one incoming message's weight but less than sum of all message weights)
    • Overweight should queue (overweight messages should be enqueued in the above situations without affecting results)
    • Overweight can be dispatched be correct origin
    • OnIdle should service queue

pallets/dmp-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Outdated Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Show resolved Hide resolved
pallets/dmp-queue/src/lib.rs Outdated Show resolved Hide resolved
gavofyork and others added 7 commits April 30, 2021 17:12
@gavofyork
Copy link
Member Author

@apopiak final approval?

@shawntabrizi shawntabrizi self-requested a review April 30, 2021 16:19
_,
Blake2_128Concat,
PageCounter,
Vec<(RelayBlockNumber, Vec<u8>)>,
Copy link
Member

@shawntabrizi shawntabrizi May 2, 2021

Choose a reason for hiding this comment

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

Suggested change
Vec<(RelayBlockNumber, Vec<u8>)>,
BoundedVec<(RelayBlockNumber, Vec<u8>)>,

is it possible to already use BoundedVec here?

Would prevent having to backport those changes

Copy link
Member Author

Choose a reason for hiding this comment

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

will take a while yet :)

_,
Blake2_128Concat,
OverweightIndex,
(RelayBlockNumber, Vec<u8>),
Copy link
Member

@shawntabrizi shawntabrizi May 2, 2021

Choose a reason for hiding this comment

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

Suggested change
(RelayBlockNumber, Vec<u8>),
(RelayBlockNumber, BoundedVec<u8>),

here too

iter: impl Iterator<Item=(RelayBlockNumber, Vec<u8>)>,
_max_weight: Weight,
) -> Weight {
for _ in iter {}
Copy link
Member

@shawntabrizi shawntabrizi May 2, 2021

Choose a reason for hiding this comment

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

maybe dumb question, but this gets optimized away by the compiler?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so as next() can have side effects.

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

high level review looks good

@gavofyork gavofyork merged commit 3f68717 into master May 2, 2021
@gavofyork gavofyork deleted the gav-dmp-queue branch May 2, 2021 14:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants