From 9afee9f89010b0d7a8fccc3c87bbaee3d47d906e Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 9 Mar 2021 11:15:51 +1300 Subject: [PATCH 1/4] add hrmp messages --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 7c0be78..42ef4c3 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,9 @@ Where message `type` must be one of: - `4`: `Transact` - `5`: `RelayTo` - `6`: `RelayedFrom` +- `7`: `HrmpNewChannelOpenRequest` +- `8`: `HrmpChannelAccepted` +- `9`: `HrmpChannelClosing` Within XCM, there is an internal datatype `Order`, which encodes an operation on the holding account. It is defined as: @@ -173,6 +176,50 @@ Kind: *Trusted Indication*. Errors: +### `HrmpNewChannelOpenRequest` + +A message to notify about a new incoming HRMP channel. This message is meant to be sent by the +relay-chain to a para. + +- `sender: u32 (Compact)`: The sender in the to-be opened channel. Also, the initiator of the channel opening. +- `max_message_size: u32 (Compact)`: The maximum size of a message proposed by the sender. +- `max_capacity: u32 (Compact)`: The maximum number of messages that can be queued in the channel. + +Safety: The message should originate directly from the relay-chain. + +Kind: *System Notification* + +### `HrmpChannelAccepted` + +A message to notify about that a previously sent open channel request has been accepted by +the recipient. That means that the channel will be opened during the next relay-chain session +change. This message is meant to be sent by the relay-chain to a para. + +- `recipient: u32 (Compact)`: The recipient in the to-be opened channel. + +Safety: The message should originate directly from the relay-chain. + +Kind: *System Notification* + +Errors: + +### `HrmpChannelClosing` + +A message to notify that the other party in an open channel decided to close it. In particular, +`inititator` is going to close the channel opened from `sender` to the `recipient`. The close +will be enacted at the next relay-chain session change. This message is meant to be sent by +the relay-chain to a para. + +- `initiator: u32 (Compact)`: The initiator of the channel closing. +- `sender: u32 (Compact)`: The sender in the to-be closed channel. +- `recipient: u32 (Compact)`: The recipient in the to-be closed channel. + +Safety: The message should originate directly from the relay-chain. + +Kind: *System Notification* + +Errors: + ## `Order` Types ### `Null` From 5bb8c3b876064172dce55b6461f7a68c16bf2966 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 9 Mar 2021 11:27:51 +1300 Subject: [PATCH 2/4] add HRMP actions --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/README.md b/README.md index 42ef4c3..2376ab8 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,9 @@ Where message `type` must be one of: - `7`: `HrmpNewChannelOpenRequest` - `8`: `HrmpChannelAccepted` - `9`: `HrmpChannelClosing` +- `10`: `HrmpInitOpenChannel` +- `11`: `HrmpAcceptOpenChannel` +- `12`: `HrmpCloseChannel` Within XCM, there is an internal datatype `Order`, which encodes an operation on the holding account. It is defined as: @@ -220,6 +223,48 @@ Kind: *System Notification* Errors: +### `HrmpInitOpenChannel` + +Initiate opening a channel from a parachain to a given recipient with given channel +parameters. + +- `recipient: u32 (Compact)`, - The recipient in the to-be opened channel. +- `proposed_max_capacity: u32 (Compact)` - specifies how many messages can be in the channel at once. +- `proposed_max_message_size: u32 (Compact)` - specifies the maximum size of any of the messages. + +These numbers are a subject to the relay-chain configuration limits. + +The channel can be opened only after the recipient confirms it and only on a session +change. + +Safety: The message should originate directly from the para-chain. + +### `HrmpAcceptOpenChannel` + +Accept a pending open channel request from the given sender. + +The channel will be opened only on the next session boundary. + +- `sender: u32 (Compact)`: The sender in the to-be opened channel. Also, the initiator of the channel opening. + +Safety: The message should originate directly from the para-chain. + +Errors: + +### `HrmpCloseChannel` + +Initiate unilateral closing of a channel. The origin must be either the sender or the +recipient in the channel being closed. + +The closure can only happen on a session change. + +- `sender: u32 (Compact)`: The sender in the to-be closed channel. +- `recipient: u32 (Compact)`: The recipient in the to-be closed channel. + +Safety: The message should originate directly from the para-chain. + +Errors: + ## `Order` Types ### `Null` From b07a8eb05236bb7670e488494e2540fc4e2dd4e1 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 9 Mar 2021 11:40:13 +1300 Subject: [PATCH 3/4] add Kind --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 2376ab8..cc22c0e 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,8 @@ Parameter(s): - `assets: Vec` The asset(s) to be withdrawn. - `effect: Vec` What should be done with the assets. +Kind: *Instruction*. + ### `ReserveAssetDeposit` A notification message that the *Origin* has received `assets` into a *Sovereign* account controled by the *Recipient*. The `asset` should be minted into the *Holding Account* and some `effect` evaluated on it. @@ -122,6 +124,8 @@ Parameter(s): - `assets: Vec` The asset(s) that were transfered. - `effect: Vec` What should be done with the assets. +Kind: *Instruction*. + ### `TeleportAsset` Some `assets` have been removed from existence (and ownership by `source`) on the *Origin* and should be minted into the holding account on the *Recipient* and some `effect` evaluated. @@ -131,6 +135,8 @@ Parameter(s): - `assets: Vec` The asset(s) which were debited. - `effect: Vec` What should be done with the assets. +Kind: *Instruction*. + ### `Balances` Informational message detailing some balances, interpreted based on the context of the destination and the `query_id`. @@ -138,6 +144,8 @@ Informational message detailing some balances, interpreted based on the context - `query_id` The identifier of the query which caused this message to be sent. - `assets` The value for use by the destination. +Kind: *Query Responses*. + ### `Transact` Apply the encoded transaction `call`, whose dispatch-origin should be `origin` as expressed by the kind of origin `origin_type`. @@ -239,6 +247,8 @@ change. Safety: The message should originate directly from the para-chain. +Kind: *Instruction*. + ### `HrmpAcceptOpenChannel` Accept a pending open channel request from the given sender. @@ -249,6 +259,8 @@ The channel will be opened only on the next session boundary. Safety: The message should originate directly from the para-chain. +Kind: *Instruction*. + Errors: ### `HrmpCloseChannel` @@ -263,6 +275,8 @@ The closure can only happen on a session change. Safety: The message should originate directly from the para-chain. +Kind: *Instruction*. + Errors: ## `Order` Types From 21f961b0090d6603f3d36349321fcc968aae5864 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Thu, 11 Mar 2021 10:50:25 +1300 Subject: [PATCH 4/4] update parachain --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cc22c0e..8202ea7 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ These numbers are a subject to the relay-chain configuration limits. The channel can be opened only after the recipient confirms it and only on a session change. -Safety: The message should originate directly from the para-chain. +Safety: The message should originate directly from the parachain. Kind: *Instruction*. @@ -257,7 +257,7 @@ The channel will be opened only on the next session boundary. - `sender: u32 (Compact)`: The sender in the to-be opened channel. Also, the initiator of the channel opening. -Safety: The message should originate directly from the para-chain. +Safety: The message should originate directly from the parachain. Kind: *Instruction*. @@ -273,7 +273,7 @@ The closure can only happen on a session change. - `sender: u32 (Compact)`: The sender in the to-be closed channel. - `recipient: u32 (Compact)`: The recipient in the to-be closed channel. -Safety: The message should originate directly from the para-chain. +Safety: The message should originate directly from the parachain. Kind: *Instruction*.