Prevent account storage leakage (#270)

* WIP

* Iteration over all keys with the specified prefix

* Add clear_prefix in runtime-io

* Introduce a custom storage impl: Double Map

* Remove prefix

* Impl for_keys_with_prefix for light client

* Fix wasm_executor

* Test storage removal leads to removal of stroage

* Check for ok result in storage tests.

* Add docs.

* Remove commented code under decl_storage!

* Add clear_prefix test in runtime-io

* Add test for wasm_executor

* Prefix walking test.

* Rebuild binaries.
This commit is contained in:
Sergey Pepyakin
2018-07-03 21:52:08 +03:00
committed by Gav Wood
parent aa747e3fae
commit 2510774f3b
24 changed files with 306 additions and 19 deletions
@@ -459,6 +459,11 @@ pub mod unhashed {
runtime_io::clear_storage(key);
}
/// Ensure keys with the given `prefix` have no entries in storage.
pub fn kill_prefix(prefix: &[u8]) {
runtime_io::clear_prefix(prefix);
}
/// Get a Vec of bytes from storage.
pub fn get_raw(key: &[u8]) -> Option<Vec<u8>> {
runtime_io::storage(key)