mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 07:41:08 +00:00
* support for XCM v1 * Fixes * Fix. * Use `xcm::latest` * Bump Polkadot Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
committed by
Bastian Köcher
parent
fd80849dde
commit
e36689ffc8
@@ -42,11 +42,8 @@ use rand_chacha::{
|
||||
ChaChaRng,
|
||||
};
|
||||
use sp_runtime::{traits::Hash, RuntimeDebug};
|
||||
use sp_std::{convert::TryFrom, prelude::*};
|
||||
use xcm::{
|
||||
v0::{Error as XcmError, ExecuteXcm, Junction, MultiLocation, Outcome, SendXcm, Xcm},
|
||||
VersionedXcm,
|
||||
};
|
||||
use sp_std::{prelude::*, convert::TryFrom};
|
||||
use xcm::{latest::prelude::*, WrapVersion, VersionedXcm};
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
@@ -69,6 +66,9 @@ pub mod pallet {
|
||||
|
||||
/// Information on the avaialble XCMP channels.
|
||||
type ChannelInfo: GetChannelInfo;
|
||||
|
||||
/// Means of converting an `Xcm` into a `VersionedXcm`.
|
||||
type VersionWrapper: WrapVersion;
|
||||
}
|
||||
|
||||
impl Default for QueueConfigData {
|
||||
@@ -351,7 +351,7 @@ impl<T: Config> Pallet<T> {
|
||||
log::debug!("Processing XCMP-XCM: {:?}", &hash);
|
||||
let (result, event) = match Xcm::<T::Call>::try_from(xcm) {
|
||||
Ok(xcm) => {
|
||||
let location = (Junction::Parent, Junction::Parachain(sender.into()));
|
||||
let location = (Parent, Parachain(sender.into()));
|
||||
match T::XcmExecutor::execute_xcm(location.into(), xcm, max_weight) {
|
||||
Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)),
|
||||
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
|
||||
@@ -777,13 +777,14 @@ impl<T: Config> SendXcm for Pallet<T> {
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), XcmError> {
|
||||
match &dest {
|
||||
// An HRMP message for a sibling parachain.
|
||||
MultiLocation::X2(Junction::Parent, Junction::Parachain(id)) => {
|
||||
let msg = VersionedXcm::<()>::from(msg);
|
||||
let hash = T::Hashing::hash_of(&msg);
|
||||
X2(Parent, Parachain(id)) => {
|
||||
let versioned_xcm = T::VersionWrapper::wrap_version(&dest, msg)
|
||||
.map_err(|()| XcmError::DestinationUnsupported)?;
|
||||
let hash = T::Hashing::hash_of(&versioned_xcm);
|
||||
Self::send_fragment(
|
||||
(*id).into(),
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm,
|
||||
msg,
|
||||
versioned_xcm,
|
||||
)
|
||||
.map_err(|e| XcmError::SendFailed(<&'static str>::from(e)))?;
|
||||
Self::deposit_event(Event::XcmpMessageSent(Some(hash)));
|
||||
|
||||
Reference in New Issue
Block a user