Fix XCM encoding in HRMP pallet. (#2491)

This commit is contained in:
Shaun Wang
2021-02-23 11:21:17 +13:00
committed by GitHub
parent 5b57f02e80
commit 893c9a60ed
+9 -9
View File
@@ -934,14 +934,14 @@ impl<T: Config> Module<T> {
<Self as Store>::HrmpOpenChannelRequestsList::append(channel_id); <Self as Store>::HrmpOpenChannelRequestsList::append(channel_id);
let notification_bytes = { let notification_bytes = {
use xcm::v0::Xcm; use xcm::{v0::Xcm, VersionedXcm};
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
Xcm::HrmpNewChannelOpenRequest { VersionedXcm::from(Xcm::HrmpNewChannelOpenRequest {
sender: u32::from(origin), sender: u32::from(origin),
max_capacity: proposed_max_capacity, max_capacity: proposed_max_capacity,
max_message_size: proposed_max_message_size, max_message_size: proposed_max_message_size,
} })
.encode() .encode()
}; };
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
@@ -1000,11 +1000,11 @@ impl<T: Config> Module<T> {
let notification_bytes = { let notification_bytes = {
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
use xcm::v0::Xcm; use xcm::{v0::Xcm, VersionedXcm};
Xcm::HrmpChannelAccepted { VersionedXcm::from(Xcm::HrmpChannelAccepted {
recipient: u32::from(origin), recipient: u32::from(origin),
} })
.encode() .encode()
}; };
if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) = if let Err(dmp::QueueDownwardMessageError::ExceedsMaxMessageSize) =
@@ -1043,13 +1043,13 @@ impl<T: Config> Module<T> {
let config = <configuration::Module<T>>::config(); let config = <configuration::Module<T>>::config();
let notification_bytes = { let notification_bytes = {
use parity_scale_codec::Encode as _; use parity_scale_codec::Encode as _;
use xcm::v0::Xcm; use xcm::{v0::Xcm, VersionedXcm};
Xcm::HrmpChannelClosing { VersionedXcm::from(Xcm::HrmpChannelClosing {
initiator: u32::from(origin), initiator: u32::from(origin),
sender: u32::from(channel_id.sender), sender: u32::from(channel_id.sender),
recipient: u32::from(channel_id.recipient), recipient: u32::from(channel_id.recipient),
} })
.encode() .encode()
}; };
let opposite_party = if origin == channel_id.sender { let opposite_party = if origin == channel_id.sender {