Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0e48dc9
Fix overlay prefix removal result
gavofyork May 18, 2022
ae9b285
Second part of the overlay prefix removal fix.
gavofyork May 18, 2022
7f80f12
Report only items deleted from storage in clear_prefix
gavofyork May 20, 2022
3e580e5
Fix kill_prefix
gavofyork May 20, 2022
4a5ff62
Formatting
gavofyork May 20, 2022
8d56c13
Remove unused code
gavofyork May 20, 2022
91362cd
Fixes
gavofyork May 20, 2022
4767538
Fixes
gavofyork May 20, 2022
08b898c
Introduce clear_prefix host function v3
gavofyork May 20, 2022
aee7993
Formatting
gavofyork May 20, 2022
a1982d1
Use v2 for now
gavofyork May 20, 2022
ed26985
Fixes
gavofyork May 20, 2022
72f8fdd
Formatting
gavofyork May 20, 2022
d97aa89
Docs
gavofyork May 20, 2022
f4bbf8d
Child prefix removal should also hide v3 for now
gavofyork May 20, 2022
e82b1ca
Fixes
gavofyork May 20, 2022
73294b0
Fixes
gavofyork May 20, 2022
8a8efb1
Formatting
gavofyork May 20, 2022
a626d54
Fixes
gavofyork May 21, 2022
6867534
apply_to_keys_whle takes start_at
gavofyork May 21, 2022
94e885e
apply_to_keys_whle takes start_at
gavofyork May 21, 2022
2566a4d
apply_to_keys_whle takes start_at
gavofyork May 23, 2022
a71f9a0
Cursor API; force limits
gavofyork May 23, 2022
f435107
Use unsafe deprecated functions
gavofyork May 23, 2022
bc181a0
Formatting
gavofyork May 23, 2022
9317f6a
Merge remote-tracking branch 'origin/master' into gav-clear-prefix-v2
gavofyork May 23, 2022
0e51dbe
Fixes
gavofyork May 23, 2022
ee53604
Grumbles
gavofyork May 25, 2022
1fb2ef5
Fixes
gavofyork May 25, 2022
0338fce
Docs
gavofyork May 25, 2022
73d1fc6
Some nitpicks :see_no_evil:
bkchr May 25, 2022
ef7f475
Update primitives/externalities/src/lib.rs
gavofyork May 25, 2022
7db73b1
Formatting
gavofyork May 25, 2022
6aeb3a3
Fixes
KiChjang May 25, 2022
4692d06
cargo fmt
KiChjang May 25, 2022
7e8a8c2
Fixes
KiChjang May 25, 2022
c22b924
Fixes
gavofyork May 25, 2022
edf7ce0
Update primitives/io/src/lib.rs
gavofyork May 25, 2022
33224f2
Formatting
gavofyork May 25, 2022
a5f349b
Fixes
gavofyork May 26, 2022
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
Prev Previous commit
Next Next commit
Use v2 for now
  • Loading branch information
gavofyork committed May 20, 2022
commit a1982d1d5e32085a36a1ff25441390d4b4bc63bc
2 changes: 1 addition & 1 deletion frame/support/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
/// removed and the same result being returned. This happens because the keys to delete in the
/// overlay are not taken into account when deleting keys in the backend.
fn clear(limit: Option<u32>) -> sp_io::ClearPrefixResult {
sp_io::storage::clear_prefix(&Self::final_prefix(), limit)
unhashed::clear_prefix(&Self::final_prefix(), limit)
}

/// Iter over all value of the storage.
Expand Down
14 changes: 12 additions & 2 deletions frame/support/src/storage/unhashed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,22 @@ pub fn kill(key: &[u8]) {
/// Ensure keys with the given `prefix` have no entries in storage.
#[deprecated = "Use `clear_prefix` instead"]
pub fn kill_prefix(prefix: &[u8], limit: Option<u32>) -> sp_io::KillStorageResult {
clear_prefix(prefix, limit).into()
// TODO: Once the network has upgraded to include the new host functions, this code can be
// enabled.
// clear_prefix(prefix, limit).into()
sp_io::storage::clear_prefix(prefix, limit)
}

/// Ensure keys with the given `prefix` have no entries in storage.
pub fn clear_prefix(prefix: &[u8], limit: Option<u32>) -> sp_io::ClearPrefixResult {
sp_io::storage::clear_prefix(prefix, limit)
// TODO: Once the network has upgraded to include the new host functions, this code can be
// enabled.
// sp_io::storage::clear_prefix(prefix, limit)
use sp_io::{KillStorageResult::*, ClearPrefixResult::*};
match kill_prefix(prefix, limit) {
AllRemoved(db) => NoneLeft { db, total: db },
SomeRemaining(db) => SomeLeft { db, total: db },
}
}

/// Get a Vec of bytes from storage.
Expand Down
2 changes: 1 addition & 1 deletion primitives/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ pub trait Storage {
/// every time this function is called with the exact same arguments per block. This happens
/// because the keys in the overlay are not taken into account when deleting keys in the
/// backend.
#[version(3)]
#[version(3, register_only)]
fn clear_prefix(&mut self, prefix: &[u8], limit: Option<u32>) -> ClearPrefixResult {
let (all_removed, db, total) = Externalities::clear_prefix(*self, prefix, limit);
match all_removed {
Expand Down