mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Add the ability to suspend or resume XCM execution on the XCMP queue (#896)
* Add the ability to suspend or resume XCM execution on the XCMP queue * Rename QueueActive to QueueSuspended * Add the ability to suspend the DMP queue * Rename XCMP to DMP in comments where appropriate Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Add a bypass for XCMP queue suspension * Revert "Add the ability to suspend the DMP queue" This reverts commit 363ca09b41e40fce3f2740e7ab78f5c54781ca5c. * Change controller origin to either root or council-issued origin * Rename to ControllerOriginConverter Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
use super::*;
|
||||
use cumulus_primitives_core::XcmpMessageHandler;
|
||||
use frame_support::assert_noop;
|
||||
use mock::{new_test_ext, Origin, Test, XcmpQueue};
|
||||
use mock::{new_test_ext, Call, Origin, Test, XcmpQueue};
|
||||
|
||||
#[test]
|
||||
fn one_message_does_not_panic() {
|
||||
@@ -83,3 +83,29 @@ fn service_overweight_bad_xcm_format() {
|
||||
assert_noop!(XcmpQueue::service_overweight(Origin::root(), 0, 1000), Error::<Test>::BadXcm);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn suspend_xcm_execution_works() {
|
||||
new_test_ext().execute_with(|| {
|
||||
QueueSuspended::<Test>::put(true);
|
||||
|
||||
let xcm = VersionedXcm::from(Xcm::<Call>(vec![Instruction::<Call>::ClearOrigin])).encode();
|
||||
let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode();
|
||||
message_format.extend(xcm.clone());
|
||||
let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())];
|
||||
|
||||
// This should have executed the incoming XCM, because it came from a system parachain
|
||||
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::max_value());
|
||||
|
||||
let queued_xcm = InboundXcmpMessages::<Test>::get(ParaId::from(999), 1u32);
|
||||
assert!(queued_xcm.is_empty());
|
||||
|
||||
let messages = vec![(ParaId::from(2000), 1u32.into(), message_format.as_slice())];
|
||||
|
||||
// This shouldn't have executed the incoming XCM
|
||||
XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::max_value());
|
||||
|
||||
let queued_xcm = InboundXcmpMessages::<Test>::get(ParaId::from(2000), 1u32);
|
||||
assert_eq!(queued_xcm, xcm);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user