Revert dispatch-results (#2048)

* Revert "Reintroduce msg dispatch status reporting (#2027)"

This reverts commit 38bb051e3d778ee2f5e9451f89cf479a71fd68f8.

* post-revert fix
This commit is contained in:
Svyatoslav Nikolsky
2023-04-17 12:14:34 +03:00
committed by Bastian Köcher
parent c2e68484de
commit 512d43fabe
17 changed files with 132 additions and 315 deletions
+2 -4
View File
@@ -307,10 +307,8 @@ pub fn check_message_lane_weights<C: Chain, T: frame_system::Config>(
messages::target::maximal_incoming_message_dispatch_weight(C::max_extrinsic_weight()),
);
let max_incoming_inbound_lane_data_proof_size = InboundLaneData::<()>::encoded_size_hint_u32(
this_chain_max_unrewarded_relayers as _,
this_chain_max_unconfirmed_messages as _,
);
let max_incoming_inbound_lane_data_proof_size =
InboundLaneData::<()>::encoded_size_hint_u32(this_chain_max_unrewarded_relayers as _);
pallet_bridge_messages::ensure_able_to_receive_confirmation::<Weights<T>>(
C::max_extrinsic_size(),
C::max_extrinsic_weight(),
@@ -321,7 +321,6 @@ mod tests {
TestRuntime, ThisChainRuntimeCall,
},
};
use bitvec::prelude::*;
use bp_messages::{DeliveredMessages, UnrewardedRelayer, UnrewardedRelayersState};
use sp_std::ops::RangeInclusive;
@@ -331,11 +330,7 @@ mod tests {
for n in 0..MaxUnrewardedRelayerEntriesAtInboundLane::get() {
inbound_lane_state.relayers.push_back(UnrewardedRelayer {
relayer: Default::default(),
messages: DeliveredMessages {
begin: n + 1,
end: n + 1,
dispatch_results: bitvec![u8, Msb0; 1; 1],
},
messages: DeliveredMessages { begin: n + 1, end: n + 1 },
});
}
pallet_bridge_messages::InboundLanes::<TestRuntime>::insert(
@@ -352,7 +347,6 @@ mod tests {
messages: DeliveredMessages {
begin: 1,
end: MaxUnconfirmedMessagesAtInboundLane::get(),
dispatch_results: bitvec![u8, Msb0; 1; MaxUnconfirmedMessagesAtInboundLane::get() as _],
},
});
pallet_bridge_messages::InboundLanes::<TestRuntime>::insert(
@@ -39,8 +39,9 @@ pub type XcmAsPlainPayload = sp_std::prelude::Vec<u8>;
/// Message dispatch result type for single message
#[derive(CloneNoBound, EqNoBound, PartialEqNoBound, Encode, Decode, Debug, TypeInfo)]
pub enum XcmBlobMessageDispatchError {
pub enum XcmBlobMessageDispatchResult {
InvalidPayload,
Dispatched,
NotDispatched(#[codec(skip)] Option<DispatchBlobError>),
}
@@ -64,7 +65,7 @@ impl<
for XcmBlobMessageDispatch<SourceBridgeHubChain, TargetBridgeHubChain, BlobDispatcher, Weights>
{
type DispatchPayload = XcmAsPlainPayload;
type DispatchError = XcmBlobMessageDispatchError;
type DispatchLevelResult = XcmBlobMessageDispatchResult;
fn dispatch_weight(message: &mut DispatchMessage<Self::DispatchPayload>) -> Weight {
match message.data.payload {
@@ -79,7 +80,7 @@ impl<
fn dispatch(
_relayer_account: &AccountIdOf<SourceBridgeHubChain>,
message: DispatchMessage<Self::DispatchPayload>,
) -> MessageDispatchResult<Self::DispatchError> {
) -> MessageDispatchResult<Self::DispatchLevelResult> {
let payload = match message.data.payload {
Ok(payload) => payload,
Err(e) => {
@@ -91,7 +92,7 @@ impl<
);
return MessageDispatchResult {
unspent_weight: Weight::zero(),
dispatch_result: Err(XcmBlobMessageDispatchError::InvalidPayload),
dispatch_level_result: XcmBlobMessageDispatchResult::InvalidPayload,
}
},
};
@@ -102,7 +103,7 @@ impl<
"[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob was ok - message_nonce: {:?}",
message.key.nonce
);
Ok(())
XcmBlobMessageDispatchResult::Dispatched
},
Err(e) => {
log::error!(
@@ -110,13 +111,10 @@ impl<
"[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}",
e, message.key.nonce
);
Err(XcmBlobMessageDispatchError::NotDispatched(Some(e)))
XcmBlobMessageDispatchResult::NotDispatched(Some(e))
},
};
MessageDispatchResult {
unspent_weight: Weight::zero(),
dispatch_result: dispatch_level_result,
}
MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result }
}
}