Skip to content

Commit

Permalink
Message delivery transaction is not free!!! (#1859)
Browse files Browse the repository at this point in the history
* message delivery transaction is not free!!!

* test pays_fee
  • Loading branch information
svyatonik authored and bkchr committed Apr 10, 2024
1 parent 74f847a commit 795a049
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bridges/modules/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ pub mod pallet {

Self::deposit_event(Event::MessagesReceived(messages_received_status));

Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::No })
Ok(PostDispatchInfo { actual_weight: Some(actual_weight), pays_fee: Pays::Yes })
}

/// Receive messages delivery proof from bridged chain.
Expand Down Expand Up @@ -899,6 +899,7 @@ mod tests {
use bp_test_utils::generate_owned_bridge_module_tests;
use frame_support::{
assert_noop, assert_ok,
dispatch::Pays,
storage::generator::{StorageMap, StorageValue},
traits::Hooks,
weights::Weight,
Expand Down Expand Up @@ -1543,16 +1544,19 @@ mod tests {
messages_count,
REGULAR_PAYLOAD.declared_weight,
);
let post_dispatch_weight = Pallet::<TestRuntime>::receive_messages_proof(
let result = Pallet::<TestRuntime>::receive_messages_proof(
RuntimeOrigin::signed(1),
TEST_RELAYER_A,
proof,
messages_count,
REGULAR_PAYLOAD.declared_weight,
)
.expect("delivery has failed")
.actual_weight
.expect("receive_messages_proof always returns Some");
.expect("delivery has failed");
let post_dispatch_weight =
result.actual_weight.expect("receive_messages_proof always returns Some");

// message delivery transactions are never free
assert_eq!(result.pays_fee, Pays::Yes);

(pre_dispatch_weight, post_dispatch_weight)
}
Expand Down

0 comments on commit 795a049

Please sign in to comment.