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
Add HrmpChannelManagementHooks #2661
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c5a5cb0
init
4meta5 ed0e939
add impl for () for parachains and move trait to correct file
4meta5 8d223a3
fmt
4meta5 08ef5b7
Update xcm/src/v0/traits.rs
4meta5 5eb7e16
master.into
4meta5 bd06574
Update xcm/xcm-executor/src/lib.rs
4meta5 c16f724
fmt
4meta5 80edf1b
try different design which returns calls so that weight can be checke…
4meta5 1d56ac5
revert local env
4meta5 f66b1a3
more complete impl
4meta5 8faf033
add default impl to all mock runtimes
4meta5 0ba6d88
fmt
4meta5 af66d5b
progress
4meta5 164dcb3
rm toolchain
4meta5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,53 @@ pub enum Xcm { | |
#[codec(compact)] sender: u32, | ||
#[codec(compact)] recipient: u32, | ||
}, | ||
|
||
/// A message to propose opening a channel on the relay-chain between the | ||
/// sender para to the recipient para. | ||
/// | ||
/// - `recipient`: The recipient in the to-be opened channel. | ||
/// - `max_message_size`: The maximum size of a message proposed by the sender. | ||
/// - `max_capacity`: The maximum number of messages that can be queued in the channel. | ||
/// | ||
/// Safety: The message should originate directly from the sender para. | ||
/// | ||
/// Kind: *Instruction*. | ||
/// | ||
/// Errors: | ||
HrmpInitOpenChannel { | ||
#[codec(compact)] recipient: u32, | ||
#[codec(compact)] max_message_size: u32, | ||
#[codec(compact)] max_capacity: u32, | ||
}, | ||
|
||
/// A message to accept opening a channel on the relay-chain. | ||
/// | ||
/// - `sender`: The sender in the to-be opened channel. | ||
/// | ||
/// Safety: The message should originate directly from the recipient para. | ||
/// | ||
/// Kind: *Instruction*. | ||
/// | ||
/// Errors: | ||
HrmpAcceptOpenChannel { | ||
#[codec(compact)] sender: u32, | ||
}, | ||
|
||
/// A message to close a channel on the relay-chain. | ||
/// | ||
/// - `sender`: The sender in the to-be closed channel. | ||
/// - `recipient`: The recipient in the to-be closed channel. | ||
/// | ||
/// Safety: The message should originate directly from the sender or | ||
/// recipient para (either member of the channel). | ||
/// | ||
/// Kind: *Instruction*. | ||
/// | ||
/// Errors: | ||
HrmpCloseChannel { | ||
#[codec(compact)] sender: u32, | ||
#[codec(compact)] recipient: u32, | ||
}, | ||
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. Recalling an open channel request is upcoming in #3543 I think it's worth to reconsider these messages in the light of that PR. |
||
} | ||
|
||
impl From<Xcm> for VersionedXcm { | ||
|
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
use xcm::v0::SendXcm; | ||
use frame_support::dispatch::{Dispatchable, Parameter}; | ||
use crate::traits::{TransactAsset, ConvertOrigin, FilterAssetLocation, InvertLocation}; | ||
use crate::traits::{ExecuteHrmp, TransactAsset, ConvertOrigin, FilterAssetLocation, InvertLocation}; | ||
|
||
/// The trait to parametrize the `XcmExecutor`. | ||
pub trait Config { | ||
|
@@ -29,6 +29,9 @@ pub trait Config { | |
/// How to withdraw and deposit an asset. | ||
type AssetTransactor: TransactAsset; | ||
|
||
/// How to execute HRMP-related actions | ||
type HrmpExecutor: ExecuteHrmp; | ||
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 think this could be improved by specifying what exactly actions are (i.e. the channel management). It is also better to take into account how the developers will approach it. I think this is mostly relevant for relay-chains which is a way less common case. Thus it would be good to guide a typical implementer of this to use the |
||
|
||
/// How to get a call origin from a `OriginKind` value. | ||
type OriginConverter: ConvertOrigin<<Self::Call as Dispatchable>::Origin>; | ||
|
||
|
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
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.
Right now, this is returning the XcmError::Undefined if a runtime error is returned. What error should it be?