From 9e70ba8317849c3eff4c9f41235779b7c85f2344 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Thu, 10 Mar 2022 22:48:48 -0800 Subject: [PATCH] Fixes --- pallets/dmp-queue/src/lib.rs | 4 ++-- pallets/xcmp-queue/src/lib.rs | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index f743f2f7df..101bead3a5 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -345,7 +345,7 @@ mod tests { }; use sp_version::RuntimeVersion; use std::cell::RefCell; - use xcm::latest::{MultiLocation, OriginKind}; + use xcm::latest::{MultiLocation, OriginKind, Weightless}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; @@ -424,7 +424,7 @@ mod tests { impl ExecuteXcm for MockExec { type Prepared = Weightless; - fn prepare(message: Xcm<()>) -> Result> { + fn prepare(message: Xcm) -> Result { Err(message) } diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index 03abce5291..1a9a48065c 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -263,17 +263,17 @@ pub mod pallet { #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event { /// Some XCM was executed ok. - Success(Option), + Success(Option), /// Some XCM failed. - Fail(Option, XcmError), + Fail(Option, XcmError), /// Bad XCM version used. - BadVersion(Option), + BadVersion(Option), /// Bad XCM format used. - BadFormat(Option), + BadFormat(Option), /// An upward message was sent to the relay chain. - UpwardMessageSent(Option), + UpwardMessageSent(Option), /// An HRMP message was sent to a sibling parachain. - XcmpMessageSent(Option), + XcmpMessageSent(Option), /// An XCM exceeded the individual message weight budget. OverweightEnqueued(ParaId, RelayBlockNumber, OverweightIndex, Weight), /// An XCM from the overweight queue was executed with the given actual weight used. @@ -594,12 +594,12 @@ impl Pallet { xcm: VersionedXcm, max_weight: Weight, ) -> Result { - let hash = Encode::using_encoded(&xcm, T::Hashing::hash); + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); log::debug!("Processing XCMP-XCM: {:?}", &hash); let (result, event) = match Xcm::::try_from(xcm) { Ok(xcm) => { let location = (1, Parachain(sender.into())); - match T::XcmExecutor::execute_xcm(location, xcm, max_weight) { + match T::XcmExecutor::execute_xcm(location, xcm, hash, max_weight) { Outcome::Error(e) => (Err(e.clone()), Event::Fail(Some(hash), e)), Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))), // As far as the caller is concerned, this was dispatched without error, so @@ -781,7 +781,7 @@ impl Pallet { let index = shuffled[shuffle_index]; let sender = status[index].sender; let sender_origin = T::ControllerOriginConverter::convert_origin( - (1, Parachain(sender.into())), + (Parent, Parachain(sender.into())), OriginKind::Superuser, ); let is_controller = sender_origin @@ -1093,7 +1093,7 @@ impl SendXcm for Pallet { MultiLocation { parents: 1, interior: X1(Parachain(id)) } => { let versioned_xcm = T::VersionWrapper::wrap_version(&d, xcm) .map_err(|()| SendError::DestinationUnsupported)?; - Ok(((*id).into(), versioned_xcm)) + Ok((((*id).into(), versioned_xcm), MultiAssets::new())) }, // Anything else is unhandled. This includes a message this is meant for us. _ => {