-
Notifications
You must be signed in to change notification settings - Fork 383
{suspend, resume} xcm execution when {enter, exit}ing maintenance-mode #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
8dfe976
d817191
c9edfa7
5aa8e69
1c02695
b768ba5
4c040c5
340527b
560663a
0d4f378
9b74e2f
df07b34
4629366
1996b1b
9343d39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,17 @@ pub mod pallet { | |
| #[pallet::without_storage_info] | ||
| pub struct Pallet<T>(PhantomData<T>); | ||
|
|
||
| /// Pause and resume execution of XCM | ||
| pub trait PauseXcmExecution { | ||
| fn suspend_xcm_execution(); | ||
| fn resume_xcm_execution(); | ||
| } | ||
|
|
||
| impl PauseXcmExecution for () { | ||
| fn suspend_xcm_execution() {} | ||
| fn resume_xcm_execution() {} | ||
| } | ||
|
|
||
| /// Configuration trait of this pallet. | ||
| #[pallet::config] | ||
| pub trait Config: frame_system::Config { | ||
|
|
@@ -88,6 +99,9 @@ pub mod pallet { | |
| /// able to return to normal mode. For example, if your MaintenanceOrigin is a council, make | ||
| /// sure that your councilors can still cast votes. | ||
| type MaintenanceOrigin: EnsureOrigin<Self::Origin>; | ||
| /// Handler to suspend and resume XCM execution | ||
| #[cfg(feature = "xcm-support")] | ||
| type XcmExecutionManager: PauseXcmExecution; | ||
| /// The DMP handler to be used in normal operating mode | ||
| #[cfg(feature = "xcm-support")] | ||
| type NormalDmpHandler: DmpMessageHandler; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need the Handlers at all now?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm I think we do, the new code just stops executing XCM in xcmp_queue::on_idle. I don't think it changes how messages are otherwise handled... |
||
|
|
@@ -163,6 +177,8 @@ pub mod pallet { | |
|
|
||
| // Write to storage | ||
| MaintenanceMode::<T>::put(true); | ||
| // Suspend XCM execution | ||
| T::XcmExecutionManager::suspend_xcm_execution(); | ||
|
|
||
| // Event | ||
| <Pallet<T>>::deposit_event(Event::EnteredMaintenanceMode); | ||
|
|
@@ -190,6 +206,8 @@ pub mod pallet { | |
|
|
||
| // Write to storage | ||
| MaintenanceMode::<T>::put(false); | ||
| // Resume XCM execution | ||
| T::XcmExecutionManager::resume_xcm_execution(); | ||
|
|
||
| // Event | ||
| <Pallet<T>>::deposit_event(Event::NormalOperationResumed); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.