Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

srml: system: add kill_prefix #3729

Merged
merged 2 commits into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
7 changes: 7 additions & 0 deletions srml/system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we set this to?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's entirely dependent on state, so we'd need a specialised weight type. and calculating it would take about as long as actually doing it, so kind of pointless. in any case it's root-only, so doesn't actually matter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn kill_prefix(origin, prefix: Key) {
ensure_root(origin)?;
storage::unhashed::kill_prefix(&prefix);
}
}
}

Expand Down