diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index cab3a18e42..7a25640f9d 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -938,7 +938,7 @@ impl XcmpMessageSource for Pallet { /// Xcm sender for sending to a sibling parachain. impl SendXcm for Pallet { - fn send_xcm(dest: impl Into, msg: Xcm<()>) -> Result<(), SendError> { + fn send_xcm(dest: impl Into, msg: Xcm<()>) -> SendResult { let dest = dest.into(); match &dest { @@ -954,7 +954,7 @@ impl SendXcm for Pallet { ) .map_err(|e| SendError::Transport(<&'static str>::from(e)))?; Self::deposit_event(Event::XcmpMessageSent(Some(hash))); - Ok(()) + Ok(hash) }, // Anything else is unhandled. This includes a message this is meant for us. _ => Err(SendError::CannotReachDestination(dest, msg)), diff --git a/primitives/utility/Cargo.toml b/primitives/utility/Cargo.toml index 41cfa53a32..e628b9126b 100644 --- a/primitives/utility/Cargo.toml +++ b/primitives/utility/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] # Substrate dependencies sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs index 69397247a3..a53e9286fc 100644 --- a/primitives/utility/src/lib.rs +++ b/primitives/utility/src/lib.rs @@ -33,7 +33,7 @@ use xcm::{latest::prelude::*, WrapVersion}; /// for the `SendXcm` implementation. pub struct ParentAsUmp(PhantomData<(T, W)>); impl SendXcm for ParentAsUmp { - fn send_xcm(dest: impl Into, msg: Xcm<()>) -> Result<(), SendError> { + fn send_xcm(dest: impl Into, msg: Xcm<()>) -> SendResult { let dest = dest.into(); if dest.contains_parents_only(1) { @@ -41,10 +41,11 @@ impl SendXcm for ParentAsUmp { let versioned_xcm = W::wrap_version(&dest, msg).map_err(|()| SendError::DestinationUnsupported)?; let data = versioned_xcm.encode(); + let hash = data.using_encoded(sp_io::hashing::blake2_256); T::send_upward_message(data).map_err(|e| SendError::Transport(e.into()))?; - Ok(()) + Ok(hash) } else { // Anything else is unhandled. This includes a message this is meant for us. Err(SendError::CannotReachDestination(dest, msg))