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

Implementer's guide: downward messages and HRMP, take 2 #1503

Merged
merged 54 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c90fdf4
First stab at downward messages.
pepyakin Jul 13, 2020
d1ab1fb
Add some structure to the router.
pepyakin Jul 13, 2020
69fe295
Update `ValidationOutputs`
pepyakin Jul 13, 2020
ceaa096
Add `processed_downward_messages` to `ValidationOutputs`.
pepyakin Jul 14, 2020
e952a01
s/AccountId/ParaId
pepyakin Jul 14, 2020
778cc2b
DownwardMessage::ParachainSpecfic
pepyakin Jul 14, 2020
bdb97af
s/ensure_horizontal_messages_fits/ensure_horizontal_messages_fit
pepyakin Jul 14, 2020
921ca3b
Clarify that Router called for each candidate
pepyakin Jul 14, 2020
3fff854
Update the preamble for Router.
pepyakin Jul 14, 2020
8072356
Rewrite the relay-chain extrinsic routines
pepyakin Jul 14, 2020
a622f77
Update gloassary
pepyakin Jul 14, 2020
0309bc5
Add DMP to the glossary
pepyakin Jul 14, 2020
1c75b51
If the queue is empty, `processed_downward_messages` can be 0
pepyakin Jul 14, 2020
c1f8482
Merge remote-tracking branch 'origin/master' into ser-ch-based-hrmp-v…
pepyakin Jul 28, 2020
d781330
WIP
pepyakin Jul 30, 2020
d62803e
Add condemned list
pepyakin Jul 30, 2020
5d09dd8
Pivot to message-storing channel based HRMP
pepyakin Jul 30, 2020
e5f642a
Finished draft
pepyakin Jul 30, 2020
b1e1b28
Tidy up
pepyakin Jul 30, 2020
02ae124
Remove a duplicate glossary entry
pepyakin Jul 30, 2020
5111966
Fix typo
pepyakin Jul 30, 2020
c94ba1d
Fix wording to emphasize that the channel is unidirectional
pepyakin Jul 30, 2020
bf7eb0a
Proper decrement `HrmpOpenChannelRequestCount`
pepyakin Jul 30, 2020
44f9338
Add a comment for `HrmpOpenChannelRequestCount`.
pepyakin Jul 30, 2020
ea1ad39
Remove old configuration values.
pepyakin Jul 30, 2020
012b839
Be more specific about the para{chain,thread} hrmp chan limits.
pepyakin Jul 30, 2020
2edf4c9
Fix indentation so the lists are rendendered properly
pepyakin Jul 30, 2020
50742fd
"to answer **the**" question instead of "a"
pepyakin Jul 30, 2020
09a0c4b
Add a missing call to `check_processed_downward_messages`
pepyakin Jul 30, 2020
7d8abd6
Clean more stuff during offboarding
pepyakin Jul 30, 2020
3f3f051
Fix typo
pepyakin Jul 30, 2020
defd96b
Fix typo for the config
pepyakin Jul 30, 2020
6faf068
Add a call to `prune_dmq`
pepyakin Jul 30, 2020
ca70234
Add explicit invariants for ingress/egress indexes
pepyakin Jul 30, 2020
017885e
Add comments for the sender/reciever deposit config fields
pepyakin Jul 31, 2020
439b02e
Document various fields and structs in Router module
pepyakin Jul 31, 2020
4285e51
More docs
pepyakin Jul 31, 2020
c1b3e0a
Missing docs in Candidate.md
pepyakin Jul 31, 2020
4ea0012
Tabs to spaces in router.md
pepyakin Aug 3, 2020
065f047
Apply Rob's suggestion
pepyakin Aug 3, 2020
0da3cfa
Add the hrmp_ prefix to the router messages
pepyakin Aug 3, 2020
0de4110
Those are entry points
pepyakin Aug 3, 2020
360c518
Use SessionIndex type for the `age` field
pepyakin Aug 3, 2020
3d6195d
Use a struct to represent `HrmpChannelId`
pepyakin Aug 3, 2020
7bd6316
Merge remote-tracking branch 'origin/master' into ser-ch-based-hrmp
pepyakin Aug 3, 2020
ce6e8de
Put only MQCs into the LocalValidationData
pepyakin Aug 4, 2020
eb97502
Close request can be initiated by the runtime directly
pepyakin Aug 4, 2020
5c1f312
Close request can be initiated by the runtime directly
pepyakin Aug 4, 2020
e18b84a
tabs/spaces
pepyakin Aug 4, 2020
1bcfe70
Maintain the list of the outgoing paras in Router
pepyakin Aug 4, 2020
6d42e9b
Update roadmap/implementers-guide/src/runtime/inclusion.md
pepyakin Aug 5, 2020
b1b0fd9
fix typo
pepyakin Aug 5, 2020
c22c5d2
Remove an unnecessary pair of code quotes
pepyakin Aug 5, 2020
ef9dc1e
Merge branch 'ser-ch-based-hrmp' of github.com:paritytech/polkadot in…
pepyakin Aug 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions roadmap/implementers-guide/src/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Here you can find definitions of a bunch of jargon, usually specific to the Polk
- Module: A component of the Runtime logic, encapsulating storage, routines, and entry-points.
- Module Entry Point: A recipient of new information presented to the Runtime. This may trigger routines.
- Module Routine: A piece of code executed within a module by block initialization, closing, or upon an entry point being triggered. This may execute computation, and read or write storage.
- MQC: (Message Queue Chain). A cryptographic data structure that resembles an append-only linked list which doesn't store original values but only their hashes. The whole structure is described by a single hash, referred as a "head". When a value is appended, it's contents hashed with the previous head creating a hash that becomes a new head.
- Node: A participant in the Polkadot network, who follows the protocols of communication and connection to other nodes. Nodes form a peer-to-peer network topology without a central authority.
- Parachain Candidate, or Candidate: A proposed block for inclusion into a parachain.
- Parablock: A block in a parachain.
Expand Down
9 changes: 9 additions & 0 deletions roadmap/implementers-guide/src/runtime/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ struct HrmpChannel {
/// The total size in bytes of all message payloads in the channel.
/// Invariant: should be less or equal to `limit_used_bytes`.
used_bytes: u32,
/// A head of the Message Queue Chain for this channel. Each link in this chain has a form:
/// `(prev_head, B, H(M))`, where
/// - `prev_head`: is the previous value of `mqc_head`.
/// - `B`: is the [relay-chain] block number in which a message was appended
/// - `H(M)`: is the hash of the message being appended.
/// This value is initialized to a special value that consists of all zeroes which indicates
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment about the value of the field when no messages are pending?

Copy link
Contributor Author

@pepyakin pepyakin Aug 4, 2020

Choose a reason for hiding this comment

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

No, this comment refers to the initial state assigned to this field when a new fresh channel is created. One can answer a question if there are pending messages in the channel only having:

  • the mqc head
  • the receiver's watermark
  • the preimage of the latest link (to extract the block number of the latest message)

FWIW, this is similar to what we have in XCMP

/// that no messages were previously added.
mqc_head: Hash,
}
```
HRMP related storage layout
Expand Down Expand Up @@ -164,6 +172,7 @@ Candidate Enactment:
1. Locate or create an entry in ``HrmpChannelDigests`` for `HM.recipient` and append `sender` into the entry's list.
1. Increment `C.used_places`
1. Increment `C.used_bytes` by `HM`'s payload size
1. Append a new link to the MQC and save the new head in `C.mqc_head`. Note that the current block number as of enactment is used for the link.
* `prune_hrmp(recipient, new_hrmp_watermark)`:
1. From ``HrmpChannelDigests`` for `recipient` remove all entries up to an entry with block number equal to `new_hrmp_watermark`.
1. From the removed digests construct a set of paras that sent new messages within the interval between the old and new watermarks.
Expand Down
7 changes: 4 additions & 3 deletions roadmap/implementers-guide/src/types/candidate.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ struct LocalValidationData {
/// which case the code upgrade should be applied at the end of the signaling
/// block.
code_upgrade_allowed: Option<BlockNumber>,

// TODO: Does this look sensible?
hrmp_ingress: BTreeMap<ParaId /* sender */, Vec<InboundHrmpMessage>>,
/// The list of MQC heads for the inbound channels paired with the sender para ids. This
/// vector is sorted ascending by the para id and doesn't contain multiple entries with the same
/// sender.
hrmp_mqc_heads: Vec<(ParaId, Hash)>,
}
```

Expand Down