Message delivery transaction is not free!!! (#1859)

* message delivery transaction is not free!!!

* test pays_fee
This commit is contained in:
Svyatoslav Nikolsky
2023-02-07 12:38:25 +03:00
committed by Bastian Köcher
parent 74f847a223
commit 795a049937
+9 -5
View File
@@ -398,7 +398,7 @@ pub mod pallet {
Self::deposit_event(Event::MessagesReceived(messages_received_status)); 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. /// Receive messages delivery proof from bridged chain.
@@ -899,6 +899,7 @@ mod tests {
use bp_test_utils::generate_owned_bridge_module_tests; use bp_test_utils::generate_owned_bridge_module_tests;
use frame_support::{ use frame_support::{
assert_noop, assert_ok, assert_noop, assert_ok,
dispatch::Pays,
storage::generator::{StorageMap, StorageValue}, storage::generator::{StorageMap, StorageValue},
traits::Hooks, traits::Hooks,
weights::Weight, weights::Weight,
@@ -1543,16 +1544,19 @@ mod tests {
messages_count, messages_count,
REGULAR_PAYLOAD.declared_weight, REGULAR_PAYLOAD.declared_weight,
); );
let post_dispatch_weight = Pallet::<TestRuntime>::receive_messages_proof( let result = Pallet::<TestRuntime>::receive_messages_proof(
RuntimeOrigin::signed(1), RuntimeOrigin::signed(1),
TEST_RELAYER_A, TEST_RELAYER_A,
proof, proof,
messages_count, messages_count,
REGULAR_PAYLOAD.declared_weight, REGULAR_PAYLOAD.declared_weight,
) )
.expect("delivery has failed") .expect("delivery has failed");
.actual_weight let post_dispatch_weight =
.expect("receive_messages_proof always returns Some"); 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) (pre_dispatch_weight, post_dispatch_weight)
} }