From 406cbd7cc52246cb168bf3dd9573079ec17a64ab Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Mon, 3 Apr 2023 19:21:22 +0300 Subject: [PATCH 1/3] Remove unneeded error debug strings --- bin/runtime-common/src/messages_xcm_extension.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/bin/runtime-common/src/messages_xcm_extension.rs b/bin/runtime-common/src/messages_xcm_extension.rs index 3d802d12fa..4ccdd7a4b4 100644 --- a/bin/runtime-common/src/messages_xcm_extension.rs +++ b/bin/runtime-common/src/messages_xcm_extension.rs @@ -42,7 +42,7 @@ pub type XcmAsPlainPayload = sp_std::prelude::Vec; pub enum XcmBlobMessageDispatchResult { InvalidPayload, Dispatched, - NotDispatched(#[codec(skip)] &'static str), + NotDispatched(#[codec(skip)] Option), } /// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages @@ -106,24 +106,12 @@ impl< XcmBlobMessageDispatchResult::Dispatched }, Err(e) => { - let e = match e { - DispatchBlobError::Unbridgable => "DispatchBlobError::Unbridgable", - DispatchBlobError::InvalidEncoding => "DispatchBlobError::InvalidEncoding", - DispatchBlobError::UnsupportedLocationVersion => - "DispatchBlobError::UnsupportedLocationVersion", - DispatchBlobError::UnsupportedXcmVersion => - "DispatchBlobError::UnsupportedXcmVersion", - DispatchBlobError::RoutingError => "DispatchBlobError::RoutingError", - DispatchBlobError::NonUniversalDestination => - "DispatchBlobError::NonUniversalDestination", - DispatchBlobError::WrongGlobal => "DispatchBlobError::WrongGlobal", - }; log::error!( target: crate::LOG_TARGET_BRIDGE_DISPATCH, "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}", e, message.key.nonce ); - XcmBlobMessageDispatchResult::NotDispatched(e) + XcmBlobMessageDispatchResult::NotDispatched(Some(e)) }, }; MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result } From ff33e6ce127ea22c359b1b0273d6f3a5a27f484c Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Tue, 4 Apr 2023 12:13:08 +0300 Subject: [PATCH 2/3] Remove DispatchBlobError from XcmBlobMessageDispatchResult::NotDispatched --- bin/millau/runtime/src/xcm_config.rs | 4 ++-- bin/rialto-parachain/runtime/src/lib.rs | 2 +- bin/rialto/runtime/src/xcm_config.rs | 2 +- bin/runtime-common/src/messages_xcm_extension.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/millau/runtime/src/xcm_config.rs b/bin/millau/runtime/src/xcm_config.rs index 4aaec83771..31f5b08807 100644 --- a/bin/millau/runtime/src/xcm_config.rs +++ b/bin/millau/runtime/src/xcm_config.rs @@ -353,7 +353,7 @@ mod tests { FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(_), + XcmBlobMessageDispatchResult::NotDispatched, )); } @@ -367,7 +367,7 @@ mod tests { FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(_), + XcmBlobMessageDispatchResult::NotDispatched, )); } } diff --git a/bin/rialto-parachain/runtime/src/lib.rs b/bin/rialto-parachain/runtime/src/lib.rs index cd4e256f42..1a8f702e40 100644 --- a/bin/rialto-parachain/runtime/src/lib.rs +++ b/bin/rialto-parachain/runtime/src/lib.rs @@ -929,7 +929,7 @@ mod tests { FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(_), + XcmBlobMessageDispatchResult::NotDispatched, )); }); } diff --git a/bin/rialto/runtime/src/xcm_config.rs b/bin/rialto/runtime/src/xcm_config.rs index 9f6488b4c4..1b4541e786 100644 --- a/bin/rialto/runtime/src/xcm_config.rs +++ b/bin/rialto/runtime/src/xcm_config.rs @@ -270,7 +270,7 @@ mod tests { FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(_), + XcmBlobMessageDispatchResult::NotDispatched, )); } } diff --git a/bin/runtime-common/src/messages_xcm_extension.rs b/bin/runtime-common/src/messages_xcm_extension.rs index 4ccdd7a4b4..c3e87d876b 100644 --- a/bin/runtime-common/src/messages_xcm_extension.rs +++ b/bin/runtime-common/src/messages_xcm_extension.rs @@ -32,7 +32,7 @@ use frame_support::{dispatch::Weight, CloneNoBound, EqNoBound, PartialEqNoBound} use pallet_bridge_messages::WeightInfoExt as MessagesPalletWeights; use scale_info::TypeInfo; use sp_runtime::SaturatedConversion; -use xcm_builder::{DispatchBlob, DispatchBlobError, HaulBlob, HaulBlobError}; +use xcm_builder::{DispatchBlob, HaulBlob, HaulBlobError}; /// Plain "XCM" payload, which we transfer through bridge pub type XcmAsPlainPayload = sp_std::prelude::Vec; @@ -42,7 +42,7 @@ pub type XcmAsPlainPayload = sp_std::prelude::Vec; pub enum XcmBlobMessageDispatchResult { InvalidPayload, Dispatched, - NotDispatched(#[codec(skip)] Option), + NotDispatched, } /// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages @@ -111,7 +111,7 @@ impl< "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}", e, message.key.nonce ); - XcmBlobMessageDispatchResult::NotDispatched(Some(e)) + XcmBlobMessageDispatchResult::NotDispatched }, }; MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result } From b4a8115150f12854a5913f7fd7625a277f5ddbd3 Mon Sep 17 00:00:00 2001 From: Serban Iorga Date: Tue, 4 Apr 2023 12:40:17 +0300 Subject: [PATCH 3/3] Revert "Remove DispatchBlobError from XcmBlobMessageDispatchResult::NotDispatched" This reverts commit ff33e6ce127ea22c359b1b0273d6f3a5a27f484c. --- bin/millau/runtime/src/xcm_config.rs | 4 ++-- bin/rialto-parachain/runtime/src/lib.rs | 2 +- bin/rialto/runtime/src/xcm_config.rs | 2 +- bin/runtime-common/src/messages_xcm_extension.rs | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/millau/runtime/src/xcm_config.rs b/bin/millau/runtime/src/xcm_config.rs index 31f5b08807..4aaec83771 100644 --- a/bin/millau/runtime/src/xcm_config.rs +++ b/bin/millau/runtime/src/xcm_config.rs @@ -353,7 +353,7 @@ mod tests { FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched, + XcmBlobMessageDispatchResult::NotDispatched(_), )); } @@ -367,7 +367,7 @@ mod tests { FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched, + XcmBlobMessageDispatchResult::NotDispatched(_), )); } } diff --git a/bin/rialto-parachain/runtime/src/lib.rs b/bin/rialto-parachain/runtime/src/lib.rs index 1a8f702e40..cd4e256f42 100644 --- a/bin/rialto-parachain/runtime/src/lib.rs +++ b/bin/rialto-parachain/runtime/src/lib.rs @@ -929,7 +929,7 @@ mod tests { FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched, + XcmBlobMessageDispatchResult::NotDispatched(_), )); }); } diff --git a/bin/rialto/runtime/src/xcm_config.rs b/bin/rialto/runtime/src/xcm_config.rs index 1b4541e786..9f6488b4c4 100644 --- a/bin/rialto/runtime/src/xcm_config.rs +++ b/bin/rialto/runtime/src/xcm_config.rs @@ -270,7 +270,7 @@ mod tests { FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message); assert!(matches!( dispatch_result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched, + XcmBlobMessageDispatchResult::NotDispatched(_), )); } } diff --git a/bin/runtime-common/src/messages_xcm_extension.rs b/bin/runtime-common/src/messages_xcm_extension.rs index c3e87d876b..4ccdd7a4b4 100644 --- a/bin/runtime-common/src/messages_xcm_extension.rs +++ b/bin/runtime-common/src/messages_xcm_extension.rs @@ -32,7 +32,7 @@ use frame_support::{dispatch::Weight, CloneNoBound, EqNoBound, PartialEqNoBound} use pallet_bridge_messages::WeightInfoExt as MessagesPalletWeights; use scale_info::TypeInfo; use sp_runtime::SaturatedConversion; -use xcm_builder::{DispatchBlob, HaulBlob, HaulBlobError}; +use xcm_builder::{DispatchBlob, DispatchBlobError, HaulBlob, HaulBlobError}; /// Plain "XCM" payload, which we transfer through bridge pub type XcmAsPlainPayload = sp_std::prelude::Vec; @@ -42,7 +42,7 @@ pub type XcmAsPlainPayload = sp_std::prelude::Vec; pub enum XcmBlobMessageDispatchResult { InvalidPayload, Dispatched, - NotDispatched, + NotDispatched(#[codec(skip)] Option), } /// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages @@ -111,7 +111,7 @@ impl< "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}", e, message.key.nonce ); - XcmBlobMessageDispatchResult::NotDispatched + XcmBlobMessageDispatchResult::NotDispatched(Some(e)) }, }; MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result }