mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 16:21:06 +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.
|
||||
|
||||
//! # Transaction Pause
|
||||
//!
|
||||
//! Allows dynamic, chain-state-based pausing and unpausing of specific extrinsics via call filters.
|
||||
//!
|
||||
//! ## 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
|
||||
//!
|
||||
//! A dynamic call filter that can be controlled with extrinsics.
|
||||
//!
|
||||
//! Pausing an extrinsic means that the extrinsic CANNOT be called again until it is unpaused.
|
||||
//! The exception is calls that use `dispatch_bypass_filter`, typically only with the root origin.
|
||||
//!
|
||||
//! ### Primary Features
|
||||
//!
|
||||
//! - Calls that should never be paused can be added to a whitelist.
|
||||
//! - Separate origins are configurable for pausing and pausing.
|
||||
//! - Pausing is triggered using the string representation of the call.
|
||||
//! - Pauses can target a single extrinsic or an entire pallet.
|
||||
//! - Pauses can target future extrinsics or pallets.
|
||||
//!
|
||||
//! ### Example
|
||||
//!
|
||||
//! Configuration of call filters:
|
||||
//!
|
||||
//! ```ignore
|
||||
//! impl frame_system::Config for Runtime {
|
||||
//! // …
|
||||
//! type BaseCallFilter = InsideBoth<DefaultFilter, TxPause>;
|
||||
//! // …
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! Pause specific all:
|
||||
#![doc = docify::embed!("src/tests.rs", can_pause_specific_call)]
|
||||
//!
|
||||
//! Unpause specific all:
|
||||
#![doc = docify::embed!("src/tests.rs", can_unpause_specific_call)]
|
||||
//!
|
||||
//! Pause all calls in a pallet:
|
||||
#![doc = docify::embed!("src/tests.rs", can_pause_all_calls_in_pallet_except_on_whitelist)]
|
||||
//!
|
||||
//! ## Low Level / Implementation Details
|
||||
//!
|
||||
//! ### Use Cost
|
||||
//!
|
||||
//! A storage map (`PausedCalls`) is used to store currently paused calls.
|
||||
//! Using the call filter will require a db read of that storage on each extrinsic.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ use sp_runtime::DispatchError;
|
||||
|
||||
// GENERAL SUCCESS/POSITIVE TESTS ---------------------
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_pause_specific_call() {
|
||||
new_test_ext().execute_with(|| {
|
||||
@@ -43,6 +44,7 @@ fn can_pause_specific_call() {
|
||||
});
|
||||
}
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_pause_all_calls_in_pallet_except_on_whitelist() {
|
||||
new_test_ext().execute_with(|| {
|
||||
@@ -64,6 +66,7 @@ fn can_pause_all_calls_in_pallet_except_on_whitelist() {
|
||||
});
|
||||
}
|
||||
|
||||
#[docify::export]
|
||||
#[test]
|
||||
fn can_unpause_specific_call() {
|
||||
new_test_ext().execute_with(|| {
|
||||
|
||||
Reference in New Issue
Block a user