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

Commit 4d9cc0a

Browse files
committed
Limit the maximum size of a downward message
1 parent b32dcc4 commit 4d9cc0a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

roadmap/implementers-guide/src/runtime/router.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ any of dispatchables return an error.
260260
Utility routines.
261261

262262
`queue_downward_message(P: ParaId, M: DownwardMessage)`:
263+
1. Check if the serialized size of `M` exceeds the `config.critical_downward_message_size`. If so, return an error.
263264
1. Wrap `M` into `InboundDownwardMessage` using the current block number for `sent_at`.
264265
1. Obtain a new MQC link for the resulting `InboundDownwardMessage` and replace `DownwardMessageQueueHeads` for `P` with the resulting hash.
265266
1. Add the resulting `InboundDownwardMessage` into `DownwardMessageQueues` for `P`.

roadmap/implementers-guide/src/types/messages.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ struct InboundHrmpMessage {
108108

109109
## Downward Message
110110

111-
`DownwardMessage`- is a message that goes down from the relay chain to a parachain. Such a message
111+
`DownwardMessage` - is a message that goes down from the relay chain to a parachain. Such a message
112112
could be seen as a notification, however, it is conceivable that they might be used by the relay
113113
chain to send a request to the parachain (likely, through the `ParachainSpecific` variant).
114114

115+
The serialized size of the message is limited by the `config.critical_downward_message_size` parameter.
116+
115117
```rust,ignore
116118
enum DownwardMessage {
117119
/// Some funds were transferred into the parachain's account. The hash is the identifier that

roadmap/implementers-guide/src/types/runtime.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ struct HostConfiguration {
5656
pub dispatchable_upward_message_critical_weight: u32,
5757
/// The maximum number of messages that a candidate can contain.
5858
pub max_upward_message_num_per_candidate: u32,
59+
/// The maximum size of a message that can be put in a downward message queue.
60+
///
61+
/// Since we require receiving at least one DMP message the obvious upper bound of the size is
62+
/// the PoV size. Of course, there is a lot of other different things that a parachain may
63+
/// decide to do with its PoV so this value in practice will be picked as a fraction of the PoV
64+
/// size.
65+
pub critical_downward_message_size: u32,
5966
/// Number of sessions after which an HRMP open channel request expires.
6067
pub hrmp_open_request_ttl: u32,
6168
/// The deposit that the sender should provide for opening an HRMP channel.

0 commit comments

Comments
 (0)