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
+9 -15
View File
@@ -19,7 +19,6 @@
use crate::Config;
use bitvec::prelude::*;
use bp_messages::{
calc_relayers_rewards,
source_chain::{DeliveryConfirmationPayments, LaneMessageVerifier, TargetHeaderChain},
@@ -63,13 +62,13 @@ pub struct TestPayload {
///
/// Note: in correct code `dispatch_result.unspent_weight` will always be <= `declared_weight`,
/// but for test purposes we'll be making it larger than `declared_weight` sometimes.
pub dispatch_result: MessageDispatchResult<TestDispatchError>,
pub dispatch_result: MessageDispatchResult<TestDispatchLevelResult>,
/// Extra bytes that affect payload size.
pub extra: Vec<u8>,
}
pub type TestMessageFee = u64;
pub type TestRelayer = u64;
pub type TestDispatchError = ();
pub type TestDispatchLevelResult = ();
type Block = frame_system::mocking::MockBlock<TestRuntime>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
@@ -419,7 +418,7 @@ pub struct TestMessageDispatch;
impl MessageDispatch<AccountId> for TestMessageDispatch {
type DispatchPayload = TestPayload;
type DispatchError = TestDispatchError;
type DispatchLevelResult = TestDispatchLevelResult;
fn dispatch_weight(message: &mut DispatchMessage<TestPayload>) -> Weight {
match message.data.payload.as_ref() {
@@ -431,7 +430,7 @@ impl MessageDispatch<AccountId> for TestMessageDispatch {
fn dispatch(
_relayer_account: &AccountId,
message: DispatchMessage<TestPayload>,
) -> MessageDispatchResult<TestDispatchError> {
) -> MessageDispatchResult<TestDispatchLevelResult> {
match message.data.payload.as_ref() {
Ok(payload) => payload.dispatch_result.clone(),
Err(_) => dispatch_result(0),
@@ -466,10 +465,12 @@ pub const fn message_payload(id: u64, declared_weight: u64) -> TestPayload {
}
/// Returns message dispatch result with given unspent weight.
pub const fn dispatch_result(unspent_weight: u64) -> MessageDispatchResult<TestDispatchError> {
pub const fn dispatch_result(
unspent_weight: u64,
) -> MessageDispatchResult<TestDispatchLevelResult> {
MessageDispatchResult {
unspent_weight: Weight::from_parts(unspent_weight, 0),
dispatch_result: Ok(()),
dispatch_level_result: (),
}
}
@@ -479,14 +480,7 @@ pub fn unrewarded_relayer(
end: MessageNonce,
relayer: TestRelayer,
) -> UnrewardedRelayer<TestRelayer> {
UnrewardedRelayer {
relayer,
messages: DeliveredMessages {
begin,
end,
dispatch_results: bitvec![u8, Msb0; 1; (end + 1).saturating_sub(begin) as _],
},
}
UnrewardedRelayer { relayer, messages: DeliveredMessages { begin, end } }
}
/// Return test externalities to use in tests.