diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index eb61aadb..84183103 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -14,7 +14,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + uses: docker/metadata-action@e6428a5c4e294a61438ed7f43155db912025b6b3 # v5.2.0 with: images: paritytech/trappist diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index 18f08f51..e4ad76fd 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -20,7 +20,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + uses: docker/metadata-action@e6428a5c4e294a61438ed7f43155db912025b6b3 # v5.2.0 with: images: paritytech/trappist diff --git a/Cargo.lock b/Cargo.lock index bee3f9b3..6494b73e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -610,11 +610,11 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.1.2", + "async-lock 3.2.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "slab", ] @@ -656,14 +656,14 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" dependencies = [ - "async-lock 3.1.2", + "async-lock 3.2.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "parking", "polling 3.3.1", - "rustix 0.38.25", + "rustix 0.38.26", "slab", "tracing", "windows-sys 0.52.0", @@ -680,9 +680,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" +checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" dependencies = [ "event-listener 4.0.0", "event-listener-strategy", @@ -713,7 +713,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -729,7 +729,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.25", + "rustix 0.38.26", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -1061,11 +1061,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel 2.1.1", - "async-lock 3.1.2", + "async-lock 3.2.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "piper", "tracing", ] @@ -1475,9 +1475,9 @@ checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101" [[package]] name = "concurrent-queue" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ "crossbeam-utils", ] @@ -1547,9 +1547,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1557,9 +1557,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core2" @@ -2695,9 +2695,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", ] @@ -3738,7 +3738,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -3814,14 +3814,13 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" dependencies = [ "fastrand 2.0.1", "futures-core", "futures-io", - "memchr", "parking", "pin-project-lite 0.2.13", ] @@ -4608,7 +4607,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.3", - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -5488,9 +5487,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lioness" @@ -5680,7 +5679,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.38.25", + "rustix 0.38.26", ] [[package]] @@ -6992,39 +6991,6 @@ dependencies = [ "sp-std 12.0.0", ] -[[package]] -name = "pallet-lockdown-mode" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-dmp-queue", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "frame-benchmarking", - "frame-support", - "frame-system", - "log", - "pallet-assets", - "pallet-balances", - "pallet-remark", - "pallet-xcm", - "parachains-common", - "parity-scale-codec", - "polkadot-core-primitives", - "polkadot-parachain-primitives", - "polkadot-runtime-parachains", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 11.0.0", - "staging-parachain-info", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", - "xcm-primitives", - "xcm-simulator", -] - [[package]] name = "pallet-membership" version = "25.0.0" @@ -7302,17 +7268,20 @@ dependencies = [ ] [[package]] -name = "pallet-remark" -version = "25.0.0" +name = "pallet-safe-mode" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91f85fcd5e10af3158d3d09fe1c603c248a0a856174bacb5af12f3dc0160065e" +checksum = "cab95bbb96bbcc64ee6ba2f73802044e6b828618d29f687f066b7e4837fd26dc" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", + "pallet-balances", + "pallet-proxy", + "pallet-utility", "parity-scale-codec", "scale-info", - "sp-core", - "sp-io", + "sp-arithmetic", "sp-runtime", "sp-std 12.0.0", ] @@ -7595,6 +7564,24 @@ dependencies = [ "sp-std 12.0.0", ] +[[package]] +name = "pallet-tx-pause" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0004c02860321d6ffd93486c549bf02a43f74bc99750d2e838fada24f5f57379" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-balances", + "pallet-proxy", + "pallet-utility", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std 12.0.0", +] + [[package]] name = "pallet-uniques" version = "25.0.0" @@ -9191,7 +9178,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite 0.2.13", - "rustix 0.38.25", + "rustix 0.38.26", "tracing", "windows-sys 0.52.0", ] @@ -10161,15 +10148,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.11", - "windows-sys 0.48.0", + "linux-raw-sys 0.4.12", + "windows-sys 0.52.0", ] [[package]] @@ -11916,9 +11903,9 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "version_check", ] @@ -13438,7 +13425,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -14067,9 +14054,9 @@ dependencies = [ "pallet-dex-rpc-runtime-api", "pallet-identity", "pallet-insecure-randomness-collective-flip", - "pallet-lockdown-mode", "pallet-multisig", "pallet-preimage", + "pallet-safe-mode", "pallet-scheduler", "pallet-session", "pallet-sudo", @@ -14077,6 +14064,7 @@ dependencies = [ "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", "pallet-treasury", + "pallet-tx-pause", "pallet-uniques", "pallet-utility", "pallet-withdraw-teleport", @@ -14650,9 +14638,9 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f341edb80021141d4ae6468cbeefc50798716a347d4085c3811900049ea8945" +checksum = "acfc1e384a36ca532d070a315925887247f3c7e23567e23e0ac9b1c5d6b8bf76" dependencies = [ "smallvec", "spin 0.9.8", @@ -15277,7 +15265,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.25", + "rustix 0.38.26", ] [[package]] @@ -15699,18 +15687,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.26" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.26" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 758c7879..0d1ac3a4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,6 @@ pallet-dex-rpc-runtime-api = { git = "https://github.com/paritytech/substrate-de # Trappist Pallets pallet-asset-registry = { default-features = false, path = "pallets/asset-registry" } trappist-runtime-benchmarks = { default-features = false, path = "pallets/benchmarks" } -pallet-lockdown-mode = { default-features = false, path = "pallets/lockdown-mode" } pallet-withdraw-teleport = { default-features = false, path = "pallets/withdraw-teleport" } # Substrate std @@ -142,6 +141,8 @@ pallet-transaction-payment-rpc-runtime-api = { version = "25.0.0", default-featu pallet-uniques = { version = "25.0.0", default-features = false } pallet-utility = { version = "25.0.0", default-features = false } pallet-treasury = { version = "24.0.0", default-features = false } +pallet-safe-mode = { version = "6.0.0", default-features = false } +pallet-tx-pause = { version = "6.0.0", default-features = false } # Cumulus client dependencies cumulus-client-cli = "0.4.0" diff --git a/node/Cargo.toml b/node/Cargo.toml index 532defd3..268aa173 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -111,12 +111,12 @@ polkadot-cli = { workspace = true } [features] default = ["trappist-runtime", "stout-runtime"] runtime-benchmarks = [ - "trappist-runtime?/runtime-benchmarks", - "stout-runtime?/runtime-benchmarks", + "trappist-runtime/runtime-benchmarks", + "stout-runtime/runtime-benchmarks", "polkadot-cli/runtime-benchmarks" ] try-runtime = [ - "trappist-runtime?/try-runtime", + "trappist-runtime/try-runtime", "try-runtime-cli/try-runtime" ] parameterized-consensus-hook = [] diff --git a/node/src/chain_spec/trappist.rs b/node/src/chain_spec/trappist.rs index d560dde4..643d1518 100644 --- a/node/src/chain_spec/trappist.rs +++ b/node/src/chain_spec/trappist.rs @@ -24,8 +24,7 @@ use sc_service::ChainType; use sp_core::{crypto::UncheckedInto, sr25519}; use trappist_runtime::{ constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AssetsConfig, AuraId, BalancesConfig, - CouncilConfig, LockdownModeConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys, - SudoConfig, SystemConfig, + CouncilConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys, SudoConfig, SystemConfig, }; const DEFAULT_PROTOCOL_ID: &str = "hop"; @@ -213,7 +212,8 @@ pub fn testnet_genesis( phantom: Default::default(), }, treasury: Default::default(), - lockdown_mode: LockdownModeConfig { initial_status: false, ..Default::default() }, + safe_mode: Default::default(), + tx_pause: Default::default(), dex: Default::default(), transaction_payment: Default::default(), } @@ -330,7 +330,8 @@ fn trappist_live_genesis( phantom: Default::default(), }, treasury: Default::default(), - lockdown_mode: Default::default(), + safe_mode: Default::default(), + tx_pause: Default::default(), dex: Default::default(), transaction_payment: Default::default(), } diff --git a/pallets/lockdown-mode/Cargo.toml b/pallets/lockdown-mode/Cargo.toml deleted file mode 100644 index 57a49fd5..00000000 --- a/pallets/lockdown-mode/Cargo.toml +++ /dev/null @@ -1,80 +0,0 @@ -[package] -name = "pallet-lockdown-mode" -version = "0.1.0" -description = "Trappist pallet for setting lockdown mode." -authors = { workspace = true } -license = { workspace = true } -homepage = { workspace = true } -repository = { workspace = true } -edition = { workspace = true } - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -parity-scale-codec = { workspace = true, features = [ "derive" ] } -scale-info = { workspace = true } -sp-runtime = { workspace = true } -sp-std = { workspace = true } -frame-benchmarking = { workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } - -cumulus-primitives-core = { workspace = true } -pallet-assets = { workspace = true } -pallet-balances = { workspace = true } -log = { workspace = true } -xcm = { workspace = true } - -xcm-primitives = { workspace = true } - -[dev-dependencies] -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } -pallet-remark = { workspace = true } - - -xcm = { workspace = true } -xcm-simulator = { workspace = true } -xcm-executor = { workspace = true } -xcm-builder = { workspace = true } -pallet-xcm = { workspace = true } -polkadot-core-primitives = { workspace = true } -polkadot-runtime-parachains = { workspace = true } -polkadot-parachain-primitives = { workspace = true } - -parachain-info = { workspace = true } -parachains-common = { workspace = true } -cumulus-pallet-dmp-queue = { workspace = true } -cumulus-pallet-xcmp-queue = { workspace = true } -cumulus-primitives-core = { workspace = true } - -[features] -default = ["std"] -std = [ - "parity-scale-codec/std", - "sp-runtime/std", - "sp-std/std", - "pallet-assets/std", - "pallet-balances/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", - "scale-info/std", - "xcm-primitives/std", - "xcm/std", - "xcm-executor/std", - "xcm-builder/std", - "pallet-xcm/std", - "polkadot-core-primitives/std", - "polkadot-runtime-parachains/std", - "polkadot-parachain-primitives/std", - "parachain-info/std", - "parachains-common/std", - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-primitives-core/std", -] -runtime-benchmarks = ["frame-benchmarking/runtime-benchmarks"] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/lockdown-mode/README.md b/pallets/lockdown-mode/README.md deleted file mode 100644 index c5d6a5ad..00000000 --- a/pallets/lockdown-mode/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Lockdown Mode Pallet - -The Lockdown Mode Pallet is a Substrate module that provides functionality to lock down the runtime execution in a Substrate-based blockchain system. When the lockdown mode is activated, it filters out incoming calls and messages to ensure that only authorized actions are allowed. - -## Overview - -This pallet the governance of the chain to activate or deactivate a lockdown mode. When the lockdown mode is activated, incoming runtime calls and downward messages are filtered based on a preconfigured filter. Additionally, it suspends the execution of XCM (Cross-Consensus Message) messages in the `on_idle` hook. - -The lockdown mode status is stored in the `LockdownModeStatus` storage item. When the lockdown mode is deactivated, the system resumes normal operations, including the execution of XCM messages in the `on_idle` hook. - -## Configuration - -This pallet supports configurable traits that allow customization according to specific needs. - -### Types - -- `RuntimeEvent`: Specifies the runtime event type. -- `LockdownModeOrigin`: Specifies the origin that is allowed to activate and deactivate the lockdown mode. -- `BlackListedCalls`: Specifies the filter used to filter incoming runtime calls in lockdown mode. -- `LockdownDmpHandler`: Specifies the handler for downward messages in lockdown mode. -- `XcmExecutorManager`: Interface to control the execution of XCMP Queue messages. - - -## Extrinsics - -The pallet provides the following extrinsics: - -- `activate_lockdown_mode`: Activates the lockdown mode. Only the specified `LockdownModeOrigin` can call this extrinsic. It updates the `LockdownModeStatus` storage item to `ACTIVATED` (true) and attempts to suspend the execution of XCM messages in the `on_idle` hook. -- `deactivate_lockdown_mode`: Deactivates the lockdown mode. Only the specified `LockdownModeOrigin` can call this extrinsic. It updates the `LockdownModeStatus` storage item to `DEACTIVATED` (false) and attempts to resume the execution of XCM messages in the `on_idle` hook. - - -#### Errors - -Possible errors returned by the dispatchable calls are: - -- `LockdownModeAlreadyActivated`: The lockdown mode is already activated. -- `LockdownModeAlreadyDeactivated`: The lockdown mode is already deactivated. - -Please note that any failure to suspend or resume XCM execution in the `on_idle` hook is not treated as a fatal error that stops the function execution. Instead, it is recorded as an event `FailedToSuspendIdleXcmExecution` or `FailedToResumeIdleXcmExecution`, respectively, and the function continues its execution. - -The lockdown mode can serve as a crucial tool in system maintenance or in case of emergency, when it's necessary to restrict system operation and ensure the system's security and stability. diff --git a/pallets/lockdown-mode/src/benchmarking.rs b/pallets/lockdown-mode/src/benchmarking.rs deleted file mode 100644 index f5196adb..00000000 --- a/pallets/lockdown-mode/src/benchmarking.rs +++ /dev/null @@ -1,42 +0,0 @@ -// This file is part of Trappist. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use super::*; - -#[allow(unused)] -use crate::Pallet as LockdownMode; -use crate::{ACTIVATED, DEACTIVATED}; -use frame_benchmarking::benchmarks; -use frame_system::RawOrigin; - -benchmarks! { - activate_lockdown_mode { - LockdownModeStatus::::put(DEACTIVATED); - }: activate_lockdown_mode(RawOrigin::Root) - verify { - assert_eq!(LockdownModeStatus::::get(), ACTIVATED); - } - - deactivate_lockdown_mode { - LockdownModeStatus::::put(ACTIVATED); - }: deactivate_lockdown_mode(RawOrigin::Root) - verify { - assert_eq!(LockdownModeStatus::::get(), DEACTIVATED); - } - - impl_benchmark_test_suite!(LockdownMode, crate::mock::new_test_ext(true), crate::mock::Test); -} diff --git a/pallets/lockdown-mode/src/lib.rs b/pallets/lockdown-mode/src/lib.rs deleted file mode 100644 index 0a462a1e..00000000 --- a/pallets/lockdown-mode/src/lib.rs +++ /dev/null @@ -1,169 +0,0 @@ -// This file is part of Trappist. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#![cfg_attr(not(feature = "std"), no_std)] - -/// Edit this file to define custom logic or remove it if it is not needed. -/// Learn more about FRAME and the core library of Substrate FRAME pallets: -/// -pub use pallet::*; - -#[cfg(test)] -mod mock; -#[cfg(test)] -mod tests; - -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; -pub mod weights; -pub use weights::*; - -pub const ACTIVATED: bool = true; -pub const DEACTIVATED: bool = false; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - use cumulus_primitives_core::{ - relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler, - }; - use frame_support::{ - pallet_prelude::{ValueQuery, *}, - traits::Contains, - }; - use frame_system::pallet_prelude::*; - use sp_std::vec::Vec; - use xcm_primitives::PauseXcmExecution; - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::genesis_config] - pub struct GenesisConfig { - pub initial_status: bool, - #[serde(skip)] - pub _config: PhantomData, - } - - impl Default for GenesisConfig { - fn default() -> Self { - Self { initial_status: ACTIVATED, _config: Default::default() } - } - } - - #[pallet::genesis_build] - impl BuildGenesisConfig for GenesisConfig { - fn build(&self) { - LockdownModeStatus::::put(self.initial_status); - } - } - - #[pallet::config] - pub trait Config: frame_system::Config { - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - type LockdownModeOrigin: EnsureOrigin; - type BlackListedCalls: Contains; - type LockdownDmpHandler: DmpMessageHandler; - type XcmExecutorManager: PauseXcmExecution; - type WeightInfo: WeightInfo; - } - - #[pallet::storage] - pub type LockdownModeStatus = StorageValue<_, bool, ValueQuery>; - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - LockdownModeActivated, - LockdownModeDeactivated, - /// The call to suspend on_idle XCM execution failed with inner error - FailedToSuspendIdleXcmExecution { - error: DispatchError, - }, - /// The call to resume on_idle XCM execution failed with inner error - FailedToResumeIdleXcmExecution { - error: DispatchError, - }, - } - - #[pallet::error] - pub enum Error { - /// Lockdown mode was already activated - LockdownModeAlreadyActivated, - /// Lockdown mode was already deactivated - LockdownModeAlreadyDeactivated, - } - - #[pallet::call] - impl Pallet { - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::activate_lockdown_mode())] - pub fn activate_lockdown_mode(origin: OriginFor) -> DispatchResult { - T::LockdownModeOrigin::ensure_origin(origin)?; - - ensure!(!LockdownModeStatus::::get(), Error::::LockdownModeAlreadyActivated); - - LockdownModeStatus::::put(ACTIVATED); - - if let Err(error) = T::XcmExecutorManager::suspend_xcm_execution() { - log::error!("Failed to suspend idle XCM execution {:?}", error); - Self::deposit_event(Event::FailedToSuspendIdleXcmExecution { error }); - } - - Self::deposit_event(Event::LockdownModeActivated); - - Ok(()) - } - - #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::deactivate_lockdown_mode())] - pub fn deactivate_lockdown_mode(origin: OriginFor) -> DispatchResult { - T::LockdownModeOrigin::ensure_origin(origin)?; - ensure!(LockdownModeStatus::::get(), Error::::LockdownModeAlreadyDeactivated); - - LockdownModeStatus::::put(DEACTIVATED); - - if let Err(error) = T::XcmExecutorManager::resume_xcm_execution() { - log::error!("Failed to resume idle XCM execution {:?}", error); - Self::deposit_event(Event::FailedToResumeIdleXcmExecution { error }); - } - - Self::deposit_event(Event::LockdownModeDeactivated); - - Ok(()) - } - } - - impl Contains for Pallet { - fn contains(call: &T::RuntimeCall) -> bool { - !LockdownModeStatus::::get() || T::BlackListedCalls::contains(call) - } - } - - impl DmpMessageHandler for Pallet { - fn handle_dmp_messages( - iter: impl Iterator)>, - limit: Weight, - ) -> Weight { - if LockdownModeStatus::::get() { - T::LockdownDmpHandler::handle_dmp_messages(iter, Weight::zero()) - } else { - // Normal path, everything should pass through - T::LockdownDmpHandler::handle_dmp_messages(iter, limit) - } - } - } -} diff --git a/pallets/lockdown-mode/src/weights.rs b/pallets/lockdown-mode/src/weights.rs deleted file mode 100644 index 7a1a66d8..00000000 --- a/pallets/lockdown-mode/src/weights.rs +++ /dev/null @@ -1,87 +0,0 @@ -// This file is part of Trappist. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Autogenerated weights for `pallet_lockdown_mode` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `Hectors-MBP-14.fritz.box`, CPU: `` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("trappist-rococo"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/trappist-collator -// benchmark -// pallet -// --chain -// trappist-rococo -// --execution=wasm -// --wasm-execution=compiled -// --pallet -// pallet_lockdown_mode -// --extrinsic -// * -// --steps -// 50 -// --repeat -// 20 -// --output -// weight.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -pub trait WeightInfo { - fn activate_lockdown_mode() -> Weight; - fn deactivate_lockdown_mode() -> Weight; -} - -/// Weight functions for `pallet_lockdown_mode`. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// Storage: LockdownMode LockdownModeStatus (r:1 w:1) - /// Proof: LockdownMode LockdownModeStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: XcmpQueue QueueSuspended (r:0 w:1) - /// Proof Skipped: XcmpQueue QueueSuspended (max_values: Some(1), max_size: None, mode: Measured) - fn activate_lockdown_mode() -> Weight { - // Proof Size summary in bytes: - // Measured: `100` - // Estimated: `1586` - // Minimum execution time: 69_552_000 picoseconds. - Weight::from_parts(75_364_000, 0) - .saturating_add(Weight::from_parts(0, 1586)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: LockdownMode LockdownModeStatus (r:1 w:1) - /// Proof: LockdownMode LockdownModeStatus (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: XcmpQueue QueueSuspended (r:0 w:1) - /// Proof Skipped: XcmpQueue QueueSuspended (max_values: Some(1), max_size: None, mode: Measured) - fn deactivate_lockdown_mode() -> Weight { - // Proof Size summary in bytes: - // Measured: `100` - // Estimated: `1586` - // Minimum execution time: 42_162_000 picoseconds. - Weight::from_parts(43_321_000, 0) - .saturating_add(Weight::from_parts(0, 1586)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) - } -} diff --git a/runtime/trappist/Cargo.toml b/runtime/trappist/Cargo.toml index 51a8556e..1afeb6b3 100644 --- a/runtime/trappist/Cargo.toml +++ b/runtime/trappist/Cargo.toml @@ -107,8 +107,9 @@ pallet-dex-rpc-runtime-api = { workspace = true } # Trappist Pallets pallet-asset-registry = { workspace = true } trappist-runtime-benchmarks = { workspace = true } -pallet-lockdown-mode = { workspace = true } pallet-withdraw-teleport = { workspace = true } +pallet-safe-mode = { workspace = true } +pallet-tx-pause = { workspace = true } [features] default = ["std"] @@ -135,7 +136,7 @@ std = [ "frame-support/std", "frame-system/std", "frame-system-rpc-runtime-api/std", - "frame-try-runtime?/std", + "frame-try-runtime/std", "pallet-assets/std", "pallet-asset-tx-payment/std", "pallet-aura/std", @@ -149,7 +150,8 @@ std = [ "pallet-dex/std", "pallet-dex-rpc-runtime-api/std", "pallet-identity/std", - "pallet-lockdown-mode/std", + "pallet-safe-mode/std", + "pallet-tx-pause/std", "pallet-preimage/std", "pallet-withdraw-teleport/std", "pallet-multisig/std", @@ -164,7 +166,7 @@ std = [ "pallet-uniques/std", "pallet-utility/std", "pallet-xcm/std", - "pallet-xcm-benchmarks?/std", + "pallet-xcm-benchmarks/std", "rococo-runtime-constants/std", "assets-common/std", "cumulus-pallet-aura-ext/std", @@ -190,7 +192,7 @@ runtime-benchmarks = [ "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", - "frame-system-benchmarking?/runtime-benchmarks", + "frame-system-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", "trappist-runtime-benchmarks/runtime-benchmarks", @@ -204,7 +206,8 @@ runtime-benchmarks = [ "pallet-democracy/runtime-benchmarks", "pallet-dex/runtime-benchmarks", "pallet-identity/runtime-benchmarks", - "pallet-lockdown-mode/runtime-benchmarks", + "pallet-safe-mode/runtime-benchmarks", + "pallet-tx-pause/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", @@ -217,12 +220,12 @@ runtime-benchmarks = [ "cumulus-pallet-session-benchmarking/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "cumulus-pallet-parachain-system/runtime-benchmarks", - "pallet-xcm-benchmarks?/runtime-benchmarks", + "pallet-xcm-benchmarks/runtime-benchmarks", "assets-common/runtime-benchmarks", "polkadot-runtime-parachains/runtime-benchmarks" ] try-runtime = [ - "frame-try-runtime?/try-runtime", + "frame-try-runtime/try-runtime", "frame-executive/try-runtime", "frame-system/try-runtime", "frame-support/try-runtime", @@ -235,7 +238,8 @@ try-runtime = [ "pallet-democracy/try-runtime", "pallet-dex/try-runtime", "pallet-identity/try-runtime", - "pallet-lockdown-mode/try-runtime", + "pallet-safe-mode/try-runtime", + "pallet-tx-pause/try-runtime", "pallet-multisig/try-runtime", "pallet-scheduler/try-runtime", "pallet-timestamp/try-runtime", diff --git a/runtime/trappist/src/impls.rs b/runtime/trappist/src/impls.rs index 94c9a635..8b0b7e73 100644 --- a/runtime/trappist/src/impls.rs +++ b/runtime/trappist/src/impls.rs @@ -18,17 +18,11 @@ //! Auxiliary struct/enums for parachain runtimes. //! Taken from polkadot/runtime/common (at a21cd64) and adapted for parachains. -use cumulus_primitives_core::{relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler}; -use frame_support::{ - traits::{Contains, Currency, Imbalance, OnUnbalanced}, - weights::Weight, -}; +use cumulus_primitives_core::DmpMessageHandler; +use frame_support::traits::{Currency, Imbalance, OnUnbalanced}; pub use log; -use sp_runtime::DispatchResult; use sp_std::marker::PhantomData; -use super::*; - /// Type alias to conveniently refer to the `Currency::NegativeImbalance` associated type. pub type NegativeImbalance = as Currency< ::AccountId, @@ -76,43 +70,6 @@ where } } -pub struct RuntimeBlackListedCalls; -impl Contains for RuntimeBlackListedCalls { - fn contains(call: &RuntimeCall) -> bool { - !matches!( - call, - RuntimeCall::Balances(_) - | RuntimeCall::Assets(_) - | RuntimeCall::Dex(_) - | RuntimeCall::PolkadotXcm(_) - | RuntimeCall::Treasury(_) - | RuntimeCall::Contracts(_) - | RuntimeCall::Uniques(_) - | RuntimeCall::AssetRegistry(_) - ) - } -} - -pub struct LockdownDmpHandler; -impl DmpMessageHandler for LockdownDmpHandler { - fn handle_dmp_messages( - _iter: impl Iterator)>, - limit: Weight, - ) -> Weight { - DmpQueue::handle_dmp_messages(_iter, limit) - } -} - -pub struct XcmExecutionManager {} -impl xcm_primitives::PauseXcmExecution for XcmExecutionManager { - fn suspend_xcm_execution() -> DispatchResult { - XcmpQueue::suspend_xcm_execution(RuntimeOrigin::root()) - } - fn resume_xcm_execution() -> DispatchResult { - XcmpQueue::resume_xcm_execution(RuntimeOrigin::root()) - } -} - #[cfg(test)] mod tests { use frame_support::traits::tokens::PayFromAccount; diff --git a/runtime/trappist/src/lib.rs b/runtime/trappist/src/lib.rs index e62e22c8..80a676f3 100644 --- a/runtime/trappist/src/lib.rs +++ b/runtime/trappist/src/lib.rs @@ -23,14 +23,13 @@ extern crate frame_benchmarking; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -use frame_support::traits::tokens::UnityAssetBalanceConversion; use frame_support::{ construct_runtime, dispatch::DispatchClass, parameter_types, traits::{ - AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, ConstU64, Contains, EitherOfDiverse, - EqualPrivilegeOnly, + tokens::UnityAssetBalanceConversion, AsEnsureOriginWithArg, ConstU128, ConstU16, ConstU32, + ConstU64, Contains, EitherOfDiverse, EqualPrivilegeOnly, InsideBoth, }, weights::{constants::RocksDbWeight, ConstantMultiplier, Weight}, PalletId, @@ -38,9 +37,10 @@ use frame_support::{ pub use frame_system::Call as SystemCall; use frame_system::{ limits::{BlockLength, BlockWeights}, - EnsureRoot, EnsureSigned, + EnsureRoot, EnsureRootWithSuccess, EnsureSigned, }; use pallet_identity::simple::IdentityInfo; +use pallet_tx_pause::RuntimeCallNameOf; use pallet_xcm::{EnsureXcm, IsMajorityOfBody}; pub use parachains_common as common; pub use parachains_common::{ @@ -73,7 +73,7 @@ use xcm::VersionedMultiLocation; use xcm_builder::PayOverXcm; use constants::{currency::*, fee::WeightToFee}; -use impls::{DealWithFees, LockdownDmpHandler, RuntimeBlackListedCalls, XcmExecutionManager}; +use impls::DealWithFees; use xcm_config::{ CollatorSelectionUpdateOrigin, RelayLocation, TrustBackedAssetsConvertedConcreteId, }; @@ -187,7 +187,7 @@ parameter_types! { // Configure FRAME pallets to include in runtime. impl frame_system::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type BaseCallFilter = LockdownMode; + type BaseCallFilter = InsideBoth; type BlockWeights = RuntimeBlockWeights; type BlockLength = RuntimeBlockLength; type RuntimeOrigin = RuntimeOrigin; @@ -315,7 +315,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime { type OnSystemEvent = (); type SelfParaId = parachain_info::Pallet; type OutboundXcmpMessageSource = XcmpQueue; - type DmpMessageHandler = LockdownMode; + type DmpMessageHandler = DmpQueue; type ReservedDmpWeight = ReservedDmpWeight; type XcmpMessageHandler = XcmpQueue; type ReservedXcmpWeight = ReservedXcmpWeight; @@ -704,13 +704,66 @@ impl pallet_withdraw_teleport::Config for Runtime { type WeightInfo = weights::pallet_withdraw_teleport::WeightInfo; } -impl pallet_lockdown_mode::Config for Runtime { +/// Calls that can bypass the safe-mode pallet. +pub struct SafeModeWhitelistedCalls; +impl Contains for SafeModeWhitelistedCalls { + fn contains(call: &RuntimeCall) -> bool { + match call { + RuntimeCall::System(_) + | RuntimeCall::SafeMode(_) + | RuntimeCall::TxPause(_) + | RuntimeCall::Balances(_) => true, + _ => false, + } + } +} + +parameter_types! { + pub const EnterDuration: BlockNumber = 4 * HOURS; + pub const EnterDepositAmount: Option = None; + pub const ExtendDuration: BlockNumber = 2 * HOURS; + pub const ExtendDepositAmount: Option = None; + pub const ReleaseDelay: u32 = 2 * DAYS; +} + +impl pallet_safe_mode::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type LockdownModeOrigin = frame_system::EnsureRoot; - type BlackListedCalls = RuntimeBlackListedCalls; - type LockdownDmpHandler = LockdownDmpHandler; - type XcmExecutorManager = XcmExecutionManager; - type WeightInfo = weights::pallet_lockdown_mode::WeightInfo; + type Currency = Balances; + type RuntimeHoldReason = RuntimeHoldReason; + type WhitelistedCalls = SafeModeWhitelistedCalls; + type EnterDuration = EnterDuration; + type ExtendDuration = ExtendDuration; + type EnterDepositAmount = EnterDepositAmount; + type ExtendDepositAmount = ExtendDepositAmount; + type ForceEnterOrigin = EnsureRootWithSuccess>; + type ForceExtendOrigin = EnsureRootWithSuccess>; + type ForceExitOrigin = EnsureRoot; + type ForceDepositOrigin = EnsureRoot; + type Notify = (); + type ReleaseDelay = ReleaseDelay; + type WeightInfo = pallet_safe_mode::weights::SubstrateWeight; +} + +/// Calls that cannot be paused by the tx-pause pallet. +pub struct TxPauseWhitelistedCalls; +/// Whitelist `Balances::transfer_keep_alive`, all others are pauseable. +impl Contains> for TxPauseWhitelistedCalls { + fn contains(full_name: &RuntimeCallNameOf) -> bool { + match (full_name.0.as_slice(), full_name.1.as_slice()) { + (b"Balances", b"transfer_keep_alive") => true, + _ => false, + } + } +} + +impl pallet_tx_pause::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; + type PauseOrigin = EnsureRoot; + type UnpauseOrigin = EnsureRoot; + type WhitelistedCalls = TxPauseWhitelistedCalls; + type MaxNameLen = ConstU32<256>; + type WeightInfo = weights::pallet_tx_pause::WeightInfo; } // Create the runtime by composing the FRAME pallets that were previously configured. @@ -748,7 +801,8 @@ construct_runtime!( Uniques: pallet_uniques = 43, Scheduler: pallet_scheduler = 44, Preimage: pallet_preimage = 45, - LockdownMode: pallet_lockdown_mode = 46, + SafeMode: pallet_safe_mode = 47, // 46 used to be the old LockdownMode pallet + TxPause: pallet_tx_pause = 48, // Handy utilities. Utility: pallet_utility = 50, @@ -782,7 +836,8 @@ mod benches { [pallet_contracts, Contracts] [pallet_collective, Council] [pallet_democracy, Democracy] - [pallet_lockdown_mode, LockdownMode] + [pallet_safe_mode, SafeMode] + [pallet_tx_pause, TxPause] [pallet_preimage, Preimage] [pallet_treasury, Treasury] [pallet_assets, Assets] diff --git a/runtime/trappist/src/weights/mod.rs b/runtime/trappist/src/weights/mod.rs index 264185c1..9dca83a3 100644 --- a/runtime/trappist/src/weights/mod.rs +++ b/runtime/trappist/src/weights/mod.rs @@ -34,13 +34,11 @@ pub mod pallet_contracts; pub mod pallet_democracy; pub mod pallet_dex; pub mod pallet_identity; -pub mod pallet_lockdown_mode; pub mod pallet_multisig; -//pub mod pallet_preimage; pub mod pallet_scheduler; pub mod pallet_session; pub mod pallet_timestamp; -//pub mod pallet_treasury; +pub mod pallet_tx_pause; pub mod pallet_uniques; pub mod pallet_utility; pub mod pallet_withdraw_teleport; diff --git a/runtime/trappist/src/weights/pallet_lockdown_mode.rs b/runtime/trappist/src/weights/pallet_tx_pause.rs similarity index 50% rename from runtime/trappist/src/weights/pallet_lockdown_mode.rs rename to runtime/trappist/src/weights/pallet_tx_pause.rs index 9dda707b..045c3de6 100644 --- a/runtime/trappist/src/weights/pallet_lockdown_mode.rs +++ b/runtime/trappist/src/weights/pallet_tx_pause.rs @@ -15,12 +15,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Autogenerated weights for `pallet_lockdown_mode` +//! Autogenerated weights for `pallet_tx_pause` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-11-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-10-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-yprdrvc7-project-647-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `PAR03651`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("trappist-dev")`, DB CACHE: 1024 // Executed Command: @@ -33,7 +33,7 @@ // --no-storage-info // --no-median-slopes // --no-min-squares -// --pallet=pallet_lockdown_mode +// --pallet=pallet_tx_pause // --extrinsic=* // --wasm-execution=compiled // --header=./templates/file_header.txt @@ -47,35 +47,31 @@ use frame_support::{traits::Get, weights::Weight}; use core::marker::PhantomData; -/// Weight functions for `pallet_lockdown_mode`. +/// Weight functions for `pallet_tx_pause`. pub struct WeightInfo(PhantomData); -impl pallet_lockdown_mode::WeightInfo for WeightInfo { - /// Storage: `LockdownMode::LockdownModeStatus` (r:1 w:1) - /// Proof: `LockdownMode::LockdownModeStatus` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::QueueSuspended` (r:0 w:1) - /// Proof: `XcmpQueue::QueueSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn activate_lockdown_mode() -> Weight { +impl pallet_tx_pause::WeightInfo for WeightInfo { + /// Storage: `TxPause::PausedCalls` (r:1 w:1) + /// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`) + fn pause() -> Weight { // Proof Size summary in bytes: - // Measured: `100` - // Estimated: `1486` - // Minimum execution time: 13_278_000 picoseconds. - Weight::from_parts(13_751_000, 0) - .saturating_add(Weight::from_parts(0, 1486)) + // Measured: `4` + // Estimated: `3997` + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(10_000_000, 0) + .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(1)) } - /// Storage: `LockdownMode::LockdownModeStatus` (r:1 w:1) - /// Proof: `LockdownMode::LockdownModeStatus` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`) - /// Storage: `XcmpQueue::QueueSuspended` (r:0 w:1) - /// Proof: `XcmpQueue::QueueSuspended` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - fn deactivate_lockdown_mode() -> Weight { + /// Storage: `TxPause::PausedCalls` (r:1 w:1) + /// Proof: `TxPause::PausedCalls` (`max_values`: None, `max_size`: Some(532), added: 3007, mode: `MaxEncodedLen`) + fn unpause() -> Weight { // Proof Size summary in bytes: - // Measured: `100` - // Estimated: `1486` - // Minimum execution time: 13_302_000 picoseconds. - Weight::from_parts(13_714_000, 0) - .saturating_add(Weight::from_parts(0, 1486)) + // Measured: `566` + // Estimated: `3997` + // Minimum execution time: 13_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) + .saturating_add(Weight::from_parts(0, 3997)) .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(1)) } }