This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Breakdown the Router module on Dmp, Ump, Hrmp modules #1939
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2915d79
Guide: Split router module in guide.
pepyakin 5195118
Add a glossary entry for what used to be called Router
pepyakin 08fc261
Extract DMP
pepyakin 6bdf541
Extract UMP
pepyakin a97fc34
Extract HRMP
pepyakin c88bdc9
Switch over to new modules
pepyakin a870f71
Router: goodbye sweet prince
pepyakin 8e37d00
Link to messaging overview for details.
pepyakin 536a914
Update missed rococo and test runtimes.
pepyakin eb43e4c
Commit destroyed by rebase changes
pepyakin 3800729
Don't deprecate Router but rather make it a meta-project
pepyakin 2069f6e
Fix typos suggestion
pepyakin 64aa82c
Fix repetition in the impl guide
pepyakin d205269
Clarify that processed_downward_messages has the u32 type
pepyakin 02f65ac
Remove the router subdir.
pepyakin da1e56e
Deabbreviate DMP,UMP,HRMP
pepyakin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # DMP Module | ||
|
|
||
| A module responsible for DMP. See [Messaging Overview](../messaging.md) for more details. | ||
|
|
||
| ## Storage | ||
|
|
||
| General storage entries | ||
|
|
||
| ```rust | ||
| /// Paras that are to be cleaned up at the end of the session. | ||
| /// The entries are sorted ascending by the para id. | ||
| OutgoingParas: Vec<ParaId>; | ||
| ``` | ||
|
|
||
| Storage layout required for implementation of DMP. | ||
|
|
||
| ```rust | ||
| /// The downward messages addressed for a certain para. | ||
| DownwardMessageQueues: map ParaId => Vec<InboundDownwardMessage>; | ||
| /// A mapping that stores the downward message queue MQC head for each para. | ||
| /// | ||
| /// Each link in this chain has a form: | ||
| /// `(prev_head, B, H(M))`, where | ||
| /// - `prev_head`: is the previous head hash or zero if none. | ||
| /// - `B`: is the relay-chain block number in which a message was appended. | ||
| /// - `H(M)`: is the hash of the message being appended. | ||
| DownwardMessageQueueHeads: map ParaId => Hash; | ||
| ``` | ||
|
|
||
| ## Initialization | ||
|
|
||
| No initialization routine runs for this module. | ||
|
|
||
| ## Routines | ||
|
|
||
| Candidate Acceptance Function: | ||
|
|
||
| * `check_processed_downward_messages(P: ParaId, processed_downward_messages: u32)`: | ||
| 1. Checks that `DownwardMessageQueues` for `P` is at least `processed_downward_messages` long. | ||
| 1. Checks that `processed_downward_messages` is at least 1 if `DownwardMessageQueues` for `P` is not empty. | ||
|
|
||
| Candidate Enactment: | ||
|
|
||
| * `prune_dmq(P: ParaId, processed_downward_messages: u32)`: | ||
| 1. Remove the first `processed_downward_messages` from the `DownwardMessageQueues` of `P`. | ||
|
|
||
| Utility routines. | ||
|
|
||
| `queue_downward_message(P: ParaId, M: DownwardMessage)`: | ||
| 1. Check if the size of `M` exceeds the `config.max_downward_message_size`. If so, return an error. | ||
| 1. Wrap `M` into `InboundDownwardMessage` using the current block number for `sent_at`. | ||
| 1. Obtain a new MQC link for the resulting `InboundDownwardMessage` and replace `DownwardMessageQueueHeads` for `P` with the resulting hash. | ||
| 1. Add the resulting `InboundDownwardMessage` into `DownwardMessageQueues` for `P`. | ||
|
|
||
| ## Session Change | ||
|
|
||
| 1. Drain `OutgoingParas`. For each `P` happened to be in the list: | ||
| 1. Remove all `DownwardMessageQueues` of `P`. | ||
| 1. Remove `DownwardMessageQueueHeads` for `P`. | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.