mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Update documentation for SafeMode and TxPause Pallets (#2413)
# Description Documentation for the TxPause and SafeMode pallets. Based on reading and the notes from the following related PRs: - https://github.com/paritytech/substrate/pull/12092 I believe this also completes the checklist to be able to close the related PRs: - Close #302 - Close #274 --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,62 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! # Safe Mode
|
||||
//!
|
||||
//! Trigger for stopping all extrinsics outside of a specific whitelist.
|
||||
//!
|
||||
//! ## WARNING
|
||||
//!
|
||||
//! NOT YET AUDITED. DO NOT USE IN PRODUCTION.
|
||||
//!
|
||||
//! ## Pallet API
|
||||
//!
|
||||
//! See the [`pallet`] module for more information about the interfaces this pallet exposes,
|
||||
//! including its configuration trait, dispatchables, storage items, events, and errors.
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
//! Safe mode is entered via two paths (deposit or forced) until a set block number.
|
||||
//! The mode is exited when the block number is reached or a call to one of the exit extrinsics is
|
||||
//! made. A `WhitelistedCalls` configuration item contains all calls that can be executed while in
|
||||
//! safe mode.
|
||||
//!
|
||||
//! ### Primary Features
|
||||
//!
|
||||
//! - Entering safe mode can be via privileged origin or anyone who places a deposit.
|
||||
//! - Origin configuration items are separated for privileged entering and exiting safe mode.
|
||||
//! - A configurable duration sets the number of blocks after which the system will exit safe mode.
|
||||
//! - Safe mode may be extended beyond the configured exit by additional calls.
|
||||
//!
|
||||
//! ### Example
|
||||
//!
|
||||
//! Configuration of call filters:
|
||||
//!
|
||||
//! ```ignore
|
||||
//! impl frame_system::Config for Runtime {
|
||||
//! // …
|
||||
//! type BaseCallFilter = InsideBoth<DefaultFilter, SafeMode>;
|
||||
//! // …
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! Entering safe mode with deposit:
|
||||
#![doc = docify::embed!("src/tests.rs", can_activate)]
|
||||
//!
|
||||
//! Entering safe mode via privileged origin:
|
||||
#![doc = docify::embed!("src/tests.rs", can_force_activate_with_config_origin)]
|
||||
//!
|
||||
//! Exiting safe mode via privileged origin:
|
||||
#![doc = docify::embed!("src/tests.rs", can_force_deactivate_with_config_origin)]
|
||||
//!
|
||||
//! ## Low Level / Implementation Details
|
||||
//!
|
||||
//! ### Use Cost
|
||||
//!
|
||||
//! A storage value (`EnteredUntil`) is used to store the block safe mode will be exited on.
|
||||
//! Using the call filter will require a db read of that storage on the first extrinsic.
|
||||
//! The storage will be added to the overlay and incur low cost for all additional calls.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@ fn can_filter_balance_in_proxy_when_activated() {
|
||||
});
|
||||
}
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_activate() {
|
||||
new_test_ext().execute_with(|| {
|
||||
@@ -271,6 +272,7 @@ fn fails_force_deactivate_if_not_activated() {
|
||||
});
|
||||
}
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_force_activate_with_config_origin() {
|
||||
new_test_ext().execute_with(|| {
|
||||
@@ -288,6 +290,7 @@ fn can_force_activate_with_config_origin() {
|
||||
});
|
||||
}
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_force_deactivate_with_config_origin() {
|
||||
new_test_ext().execute_with(|| {
|
||||
|
||||
Reference in New Issue
Block a user