From f3606e66dcb760f0cf8e7eaea89218b42ef8ec9b Mon Sep 17 00:00:00 2001 From: Vlad Frolov Date: Fri, 9 Aug 2024 13:21:26 +0200 Subject: [PATCH 1/2] Update CODEOWNERS --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index fdefca86a..3144a1fea 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1 @@ -* @frol @agostbiro @uint +* @frol @dj8yfo @ruseinov @akorchyn From 3acc8a6a97de1844873ead2676d990278b40ad78 Mon Sep 17 00:00:00 2001 From: Roman Useinov Date: Mon, 12 Aug 2024 23:13:05 +0200 Subject: [PATCH 2/2] feat: Introduced 'remove' method for 'near_sdk::store::Lazy' collection (#1238) --- near-sdk/src/store/lazy/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/near-sdk/src/store/lazy/mod.rs b/near-sdk/src/store/lazy/mod.rs index 0bd6f5f63..cf340dd88 100644 --- a/near-sdk/src/store/lazy/mod.rs +++ b/near-sdk/src/store/lazy/mod.rs @@ -119,6 +119,11 @@ where } } } + + /// Removes the underlying storage item. Useful for deprecating the obsolete [`Lazy`] values. + pub fn remove(&mut self) -> bool { + env::storage_remove(&self.storage_key) + } } impl Lazy @@ -185,6 +190,15 @@ mod tests { assert_eq!(lazy_loaded, b); } + #[test] + pub fn test_remove() { + let mut lazy = Lazy::new(b"m", 8u8); + lazy.flush(); + assert!(env::storage_has_key(b"m")); + lazy.remove(); + assert!(!env::storage_has_key(b"m")); + } + #[test] pub fn test_debug() { let mut lazy = Lazy::new(b"m", 8u8);