Flag for rejecting all outbound messages (#982)

* flag for rejecting all outbound messages

* update weights

* Revert "update weights"

This reverts commit 992b866edc7c9fd97013cee9cd68b9d783f8681e.

* Revert "flag for rejecting all outbound messages"

This reverts commit d094964bb4f8800ab6978b9d4b12aade2f80d266.

* OperatingMode

* Update modules/messages/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Poke CI

* RustFmt

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Hernando Castano <hernando@hcastano.com>
This commit is contained in:
Svyatoslav Nikolsky
2021-06-07 16:47:23 +03:00
committed by Bastian Köcher
parent 0b7f40a371
commit 41b65c28cf
3 changed files with 142 additions and 32 deletions
+2
View File
@@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
# Bridge dependencies
@@ -26,5 +27,6 @@ std = [
"codec/std",
"frame-support/std",
"frame-system/std",
"serde",
"sp-std/std"
]
+24
View File
@@ -32,6 +32,30 @@ pub mod target_chain;
// Weight is reexported to avoid additional frame-support dependencies in related crates.
pub use frame_support::weights::Weight;
/// Messages pallet operating mode.
#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub enum OperatingMode {
/// Normal mode, when all operations are allowed.
Normal,
/// The pallet is not accepting outbound messages. Inbound messages and receival proofs
/// are still accepted.
///
/// This mode may be used e.g. when bridged chain expects upgrade. Then to avoid dispatch
/// failures, the pallet owner may stop accepting new messages, while continuing to deliver
/// queued messages to the bridged chain. Once upgrade is completed, the mode may be switched
/// back to `Normal`.
RejectingOutboundMessages,
/// The pallet is halted. All operations (except operating mode change) are prohibited.
Halted,
}
impl Default for OperatingMode {
fn default() -> Self {
OperatingMode::Normal
}
}
/// Messages pallet parameter.
pub trait Parameter: frame_support::Parameter {
/// Save parameter value in the runtime storage.