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

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed May 20, 2022
1 parent a1982d1 commit ed26985
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,11 @@ pub mod tests {
DoubleMap::insert(&(key1 + 1), &(key2 + 1), &4u64);
assert!(matches!(
DoubleMap::clear_prefix(&key1, None),
sp_io::ClearPrefixResult::NoneLeft { db: 0, total: 2 },
// Note this is the incorrect answer (for now), since we are using v2 of
// `clear_prefix`.
// When we switch to v3, then this will become:
// sp_io::ClearPrefixResult::NoneLeft { db: 0, total: 2 },
sp_io::ClearPrefixResult::NoneLeft { db: 0, total: 0 },
));
assert_eq!(DoubleMap::get(&key1, &key2), 0u64);
assert_eq!(DoubleMap::get(&key1, &(key2 + 1)), 0u64);
Expand Down
1 change: 1 addition & 0 deletions frame/support/src/storage/unhashed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub fn clear_prefix(prefix: &[u8], limit: Option<u32>) -> sp_io::ClearPrefixResu
// enabled.
// sp_io::storage::clear_prefix(prefix, limit)
use sp_io::{KillStorageResult::*, ClearPrefixResult::*};
#[allow(deprecated)]
match kill_prefix(prefix, limit) {
AllRemoved(db) => NoneLeft { db, total: db },
SomeRemaining(db) => SomeLeft { db, total: db },
Expand Down

0 comments on commit ed26985

Please sign in to comment.