Removed relayer_account: &AccountId from MessageDispatch (#2080)

* SourceBridgeHubChain/TargetBridgeHubChain replaced with RelayerAccountChain

* Fix

* Removed `relayer_account: &AccountId` from `MessageDispatch`
This commit is contained in:
Branislav Kontur
2023-04-26 21:36:48 +02:00
committed by Bastian Köcher
parent 1f8b4d989e
commit db53d68e9b
13 changed files with 39 additions and 91 deletions
@@ -64,8 +64,6 @@ pub type ToRialtoMessagesDeliveryProof =
/// Call-dispatch based message dispatch for Rialto -> Millau messages.
pub type FromRialtoMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
bp_millau::Millau,
bp_rialto::Rialto,
crate::xcm_config::OnMillauBlobDispatcher,
(),
>;
@@ -59,8 +59,6 @@ pub type FromRialtoParachainMessagePayload = messages::target::FromBridgedChainM
/// Call-dispatch based message dispatch for RialtoParachain -> Millau messages.
pub type FromRialtoParachainMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
bp_millau::Millau,
bp_rialto::Rialto,
crate::xcm_config::OnMillauBlobDispatcher,
(),
>;
+2 -4
View File
@@ -349,8 +349,7 @@ mod tests {
// we care only about handing message to the XCM dispatcher, so we don't care about its
// actual dispatch
let dispatch_result =
FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message);
let dispatch_result = FromRialtoMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
@@ -363,8 +362,7 @@ mod tests {
// we care only about handing message to the XCM dispatcher, so we don't care about its
// actual dispatch
let dispatch_result =
FromRialtoMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message);
let dispatch_result = FromRialtoMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
@@ -926,8 +926,7 @@ mod tests {
// we care only about handing message to the XCM dispatcher, so we don't care about its
// actual dispatch
let dispatch_result =
FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message);
let dispatch_result = FromMillauMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
@@ -60,8 +60,6 @@ pub type FromMillauMessagePayload = messages::target::FromBridgedChainMessagePay
/// Call-dispatch based message dispatch for Millau -> RialtoParachain messages.
pub type FromMillauMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
bp_rialto_parachain::RialtoParachain,
bp_millau::Millau,
crate::OnRialtoParachainBlobDispatcher,
(),
>;
@@ -57,8 +57,6 @@ pub type FromMillauMessagePayload = messages::target::FromBridgedChainMessagePay
/// Call-dispatch based message dispatch for Millau -> Rialto messages.
pub type FromMillauMessageDispatch =
bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatch<
bp_rialto::Rialto,
bp_millau::Millau,
crate::xcm_config::OnRialtoBlobDispatcher,
(),
>;
+1 -2
View File
@@ -266,8 +266,7 @@ mod tests {
// we care only about handing message to the XCM dispatcher, so we don't care about its
// actual dispatch
let dispatch_result =
FromMillauMessageDispatch::dispatch(&AccountId::from([0u8; 32]), incoming_message);
let dispatch_result = FromMillauMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
@@ -26,7 +26,7 @@ use bp_messages::{
target_chain::{DispatchMessage, MessageDispatch},
LaneId,
};
use bp_runtime::{messages::MessageDispatchResult, AccountIdOf, Chain};
use bp_runtime::messages::MessageDispatchResult;
use codec::{Decode, Encode};
use frame_support::{dispatch::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
use pallet_bridge_messages::WeightInfoExt as MessagesPalletWeights;
@@ -46,23 +46,12 @@ pub enum XcmBlobMessageDispatchResult {
}
/// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages
pub struct XcmBlobMessageDispatch<SourceBridgeHubChain, TargetBridgeHubChain, DispatchBlob, Weights>
{
_marker: sp_std::marker::PhantomData<(
SourceBridgeHubChain,
TargetBridgeHubChain,
DispatchBlob,
Weights,
)>,
pub struct XcmBlobMessageDispatch<DispatchBlob, Weights> {
_marker: sp_std::marker::PhantomData<(DispatchBlob, Weights)>,
}
impl<
SourceBridgeHubChain: Chain,
TargetBridgeHubChain: Chain,
BlobDispatcher: DispatchBlob,
Weights: MessagesPalletWeights,
> MessageDispatch<AccountIdOf<SourceBridgeHubChain>>
for XcmBlobMessageDispatch<SourceBridgeHubChain, TargetBridgeHubChain, BlobDispatcher, Weights>
impl<BlobDispatcher: DispatchBlob, Weights: MessagesPalletWeights> MessageDispatch
for XcmBlobMessageDispatch<BlobDispatcher, Weights>
{
type DispatchPayload = XcmAsPlainPayload;
type DispatchLevelResult = XcmBlobMessageDispatchResult;
@@ -78,7 +67,6 @@ impl<
}
fn dispatch(
_relayer_account: &AccountIdOf<SourceBridgeHubChain>,
message: DispatchMessage<Self::DispatchPayload>,
) -> MessageDispatchResult<Self::DispatchLevelResult> {
let payload = match message.data.payload {