From facf31f77edb582a3b2d56eb233456bb8ab88b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <andre.beat@gmail.com> Date: Tue, 1 Oct 2019 07:44:33 +0100 Subject: [PATCH] srml: system: add kill_prefix (#3729) * srml: system: add kill_prefix * node: bump spec_version --- substrate/node/runtime/src/lib.rs | 4 ++-- substrate/srml/system/src/lib.rs | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index c7314270337..b7bb26ee00d 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -84,8 +84,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to equal spec_version. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 166, - impl_version: 166, + spec_version: 167, + impl_version: 167, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/srml/system/src/lib.rs b/substrate/srml/system/src/lib.rs index ecbfb598df7..5a1115b90d7 100644 --- a/substrate/srml/system/src/lib.rs +++ b/substrate/srml/system/src/lib.rs @@ -278,6 +278,13 @@ decl_module! { storage::unhashed::kill(&key); } } + + /// Kill all storage items with a key that starts with the given prefix. + #[weight = SimpleDispatchInfo::FixedOperational(10_000)] + fn kill_prefix(origin, prefix: Key) { + ensure_root(origin)?; + storage::unhashed::kill_prefix(&prefix); + } } } -- GitLab