10 major breaking releases

13.0.0 Apr 9, 2024
12.0.0 Mar 18, 2024
11.0.0 Feb 26, 2024
10.0.0 Feb 13, 2024
0.0.0 Aug 31, 2023

#1632 in Magic Beans

Download history 3/week @ 2024-01-19 146/week @ 2024-02-09 676/week @ 2024-02-16 497/week @ 2024-02-23 179/week @ 2024-03-01 5/week @ 2024-03-08 99/week @ 2024-03-15 19/week @ 2024-03-22 16/week @ 2024-03-29 99/week @ 2024-04-05

233 downloads per month

Apache-2.0

2.5MB
43K SLoC

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:

impl frame_system::Config for Runtime {
  // …
  type BaseCallFilter = InsideBoth<DefaultFilter, SafeMode>;
  // …
}

Entering safe mode with deposit:

Entering safe mode via privileged origin:

Exiting safe mode via privileged 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.

Dependencies

~17–31MB
~497K SLoC