This repository has been 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
Guide: router module #1279
Merged
Merged
Guide: router module #1279
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1c1cd40
Router module initial commit
montekki 46fa5d1
Add the router.md itself
montekki c431b45
Enqueue only on enact_candidate
montekki b21b6db
Initialization concerns
montekki 588d309
Ignore the snippet
montekki 72d0886
Merge branch 'master' into fs-guide-routing
montekki 88bf5f5
Update roadmap/implementors-guide/src/runtime/router.md
montekki b29789f
Dispatch messages on finalization
montekki 2460e53
More fixes from review
montekki 8d750f2
Update roadmap/implementors-guide/src/SUMMARY.md
montekki 861010e
Adds router to initializer order
montekki 3cf5e8f
Adds messages.md
montekki 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 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 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 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 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,35 @@ | ||
# Router Module | ||
|
||
The Router module is responsible for storing and dispatching Upward and Downward messages from and to parachains respectively. It is intended to later handle the XCMP logic as well. | ||
|
||
For each enacted block the `queue_upward_messages` entry-point is called. | ||
|
||
## Storage | ||
|
||
Storage layout: | ||
|
||
```rust,ignore | ||
/// Messages ready to be dispatched onto the relay chain. | ||
/// This is subject to `max_upward_queue_count` and | ||
/// `watermark_queue_size` from `HostConfiguration`. | ||
RelayDispatchQueues: map ParaId => Vec<UpwardMessage>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should give the definition for |
||
/// Size of the dispatch queues. Caches sizes of the queues in `RelayDispatchQueue`. | ||
/// First item in the tuple is the count of messages and second | ||
/// is the total length (in bytes) of the message payloads. | ||
RelayDispatchQueueSize: map ParaId => (u32, u32); | ||
/// The ordered list of `ParaId`s that have a `RelayDispatchQueue` entry. | ||
NeedsDispatch: Vec<ParaId>; | ||
``` | ||
|
||
## Initialization | ||
|
||
No initialization routine runs for this module. | ||
|
||
## Routines | ||
|
||
* `queue_upward_messages(AbridgedCandidateReceipt)`: | ||
montekki marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. Updates `NeedsDispatch`, and enqueues upward messages into `RelayDispatchQueue` and modifies the respective entry in `RelayDispatchQueueSize`. | ||
|
||
## Finalization | ||
|
||
1. Dispatch queued upward messages from `RelayDispatchQueues` in a FIFO order applying the `config.watermark_upward_queue_size` and `config.max_upward_queue_count` limits. |
This file contains 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,28 @@ | ||
# Message types | ||
|
||
Types of messages that are passed between parachains and the relay chain: UMP, DMP, XCMP. | ||
|
||
## Upward Message | ||
|
||
A type of messages dispatched from a parachain to the relay chain. | ||
|
||
```rust,ignore | ||
enum ParachainDispatchOrigin { | ||
/// As a simple `Origin::Signed`, using `ParaId::account_id` as its value. This is good when | ||
/// interacting with standard modules such as `balances`. | ||
Signed, | ||
/// As the special `Origin::Parachain(ParaId)`. This is good when interacting with parachain- | ||
/// aware modules which need to succinctly verify that the origin is a parachain. | ||
Parachain, | ||
/// As the simple, superuser `Origin::Root`. This can only be done on specially permissioned | ||
/// parachains. | ||
Root, | ||
} | ||
|
||
struct UpwardMessage { | ||
/// The origin for the message to be sent from. | ||
pub origin: ParachainDispatchOrigin, | ||
/// The message data. | ||
pub data: Vec<u8>, | ||
} | ||
``` |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Messages file is added but doesn't seem to be committed