From 9fe2d7306b00ea4eb83ebd7e1bfbb68f71dcd4d5 Mon Sep 17 00:00:00 2001
From: "paritytech-cmd-bot-polkadot-sdk[bot]"
 <179002856+paritytech-cmd-bot-polkadot-sdk[bot]@users.noreply.github.com>
Date: Wed, 27 Nov 2024 12:46:49 +0100
Subject: [PATCH] [stable2409] Backport #6579 (#6635)

Backport #6579 into `stable2409` from bkontur.

See the
[documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md)
on how to use this bot.

<!--
  # To be used by other automation, do not modify:
  original-pr-number: #${pull_number}
-->

---------

Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Egor_P <egor@parity.io>
---
 polkadot/xcm/pallet-xcm/src/lib.rs               | 16 +++++++++++++---
 .../xcm/xcm-builder/src/process_xcm_message.rs   |  2 +-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/polkadot/xcm/pallet-xcm/src/lib.rs b/polkadot/xcm/pallet-xcm/src/lib.rs
index 3056ae656e9..5ccc122b891 100644
--- a/polkadot/xcm/pallet-xcm/src/lib.rs
+++ b/polkadot/xcm/pallet-xcm/src/lib.rs
@@ -361,7 +361,10 @@ pub mod pallet {
 			let message: Xcm<()> = (*message).try_into().map_err(|()| Error::<T>::BadVersion)?;
 
 			let message_id = Self::send_xcm(interior, dest.clone(), message.clone())
-				.map_err(Error::<T>::from)?;
+				.map_err(|error| {
+					tracing::error!(target: "xcm::pallet_xcm::send", ?error, ?dest, ?message, "XCM send failed with error");
+					Error::<T>::from(error)
+				})?;
 			let e = Event::Sent { origin: origin_location, destination: dest, message, message_id };
 			Self::deposit_event(e);
 			Ok(message_id)
@@ -1805,7 +1808,10 @@ impl<T: Config> Pallet<T> {
 
 		if let Some(remote_xcm) = remote_xcm {
 			let (ticket, price) = validate_send::<T::XcmRouter>(dest.clone(), remote_xcm.clone())
-				.map_err(Error::<T>::from)?;
+				.map_err(|error| {
+					tracing::error!(target: "xcm::pallet_xcm::execute_xcm_transfer", ?error, ?dest, ?remote_xcm, "XCM validate_send failed with error");
+					Error::<T>::from(error)
+				})?;
 			if origin != Here.into_location() {
 				Self::charge_fees(origin.clone(), price).map_err(|error| {
 					log::error!(
@@ -1815,7 +1821,11 @@ impl<T: Config> Pallet<T> {
 					Error::<T>::FeesNotMet
 				})?;
 			}
-			let message_id = T::XcmRouter::deliver(ticket).map_err(Error::<T>::from)?;
+			let message_id = T::XcmRouter::deliver(ticket)
+				.map_err(|error| {
+					tracing::error!(target: "xcm::pallet_xcm::execute_xcm_transfer", ?error, ?dest, ?remote_xcm, "XCM deliver failed with error");
+					Error::<T>::from(error)
+				})?;
 
 			let e = Event::Sent { origin, destination: dest, message: remote_xcm, message_id };
 			Self::deposit_event(e);
diff --git a/polkadot/xcm/xcm-builder/src/process_xcm_message.rs b/polkadot/xcm/xcm-builder/src/process_xcm_message.rs
index 2e6f8c5fb56..129ce1e584e 100644
--- a/polkadot/xcm/xcm-builder/src/process_xcm_message.rs
+++ b/polkadot/xcm/xcm-builder/src/process_xcm_message.rs
@@ -55,7 +55,7 @@ impl<
 		let message = Xcm::<Call>::try_from(versioned_message).map_err(|_| {
 			log::trace!(
 				target: LOG_TARGET,
-				"Failed to convert `VersionedXcm` into `XcmV3`.",
+				"Failed to convert `VersionedXcm` into `xcm::prelude::Xcm`!",
 			);
 
 			ProcessMessageError::Unsupported
-- 
GitLab