From 6c51032c71c066e0eb4bbcd41962ee1201f7da71 Mon Sep 17 00:00:00 2001 From: ferrell-code Date: Thu, 2 Sep 2021 13:16:10 -0400 Subject: [PATCH 1/3] comment out iterators --- utilities/src/iterator.rs | 3 ++- utilities/src/lib.rs | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/src/iterator.rs b/utilities/src/iterator.rs index c2e26c639..3e57ab672 100644 --- a/utilities/src/iterator.rs +++ b/utilities/src/iterator.rs @@ -1,4 +1,4 @@ -use codec::{Decode, EncodeLike, FullCodec, FullEncode}; +/*use codec::{Decode, EncodeLike, FullCodec, FullEncode}; use frame_support::{ storage::{ generator::{StorageDoubleMap as StorageDoubleMapT, StorageMap as StorageMapT}, @@ -334,3 +334,4 @@ where shim } } +*/ \ No newline at end of file diff --git a/utilities/src/lib.rs b/utilities/src/lib.rs index 2304d9e5d..d0977fe58 100644 --- a/utilities/src/lib.rs +++ b/utilities/src/lib.rs @@ -8,7 +8,6 @@ pub mod iterator; pub mod offchain_worker; pub mod ordered_set; -pub use iterator::{IterableStorageDoubleMapExtended, IterableStorageMapExtended}; pub use offchain_worker::OffchainErr; pub use ordered_set::OrderedSet; From 094bb217748f1edaa97d345957322ff5f0913988 Mon Sep 17 00:00:00 2001 From: ferrell-code Date: Thu, 2 Sep 2021 13:48:31 -0400 Subject: [PATCH 2/3] deprecate iterator library --- utilities/src/iterator.rs | 27 +++++++++++++++++++++++++-- utilities/src/lib.rs | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/utilities/src/iterator.rs b/utilities/src/iterator.rs index 3e57ab672..b842c6c30 100644 --- a/utilities/src/iterator.rs +++ b/utilities/src/iterator.rs @@ -1,4 +1,4 @@ -/*use codec::{Decode, EncodeLike, FullCodec, FullEncode}; +use codec::{Decode, EncodeLike, FullCodec, FullEncode}; use frame_support::{ storage::{ generator::{StorageDoubleMap as StorageDoubleMapT, StorageMap as StorageMapT}, @@ -10,6 +10,10 @@ use sp_std::prelude::*; /// Utility to iterate through items in a storage map. /// Forks from substrate, expose previous_key field +#[deprecated( + since = "0.4.1", + note = "StorageMapIterator functionality is now available in substrate's frame-support" +)] pub struct StorageMapIterator { prefix: Vec, pub previous_key: Vec, @@ -50,6 +54,10 @@ impl Iter } /// Shim for StorageMapIterator, add more features +#[deprecated( + since = "0.4.1", + note = "StorageMapIteratorShim functionality is now available in substrate's frame-support" +)] pub struct StorageMapIteratorShim { pub storage_map_iterator: StorageMapIterator, pub remain_iterator_count: Option, @@ -78,6 +86,10 @@ impl Iterator } /// A strongly-typed map in storage whose keys and values can be iterated over. +#[deprecated( + since = "0.4.1", + note = "IterableStorageMapExtended functionality is now available in substrate's frame-support" +)] pub trait IterableStorageMapExtended: StorageMap { /// The type that iterates over all `(key, value)`. type Iterator: Iterator; @@ -142,6 +154,10 @@ where /// Iterate over a prefix and decode raw_key and raw_value into `T`. /// Forks from substrate, expose previous_key field +#[deprecated( + since = "0.4.1", + note = "MapIterator functionality is now available in substrate's frame-support" +)] pub struct MapIterator { prefix: Vec, pub previous_key: Vec, @@ -191,6 +207,10 @@ impl Iterator for MapIterator { } /// Shim for MapIterator, add more features +#[deprecated( + since = "0.4.1", + note = "MapIteratorShim functionality is now available in substrate's frame-support" +)] pub struct MapIteratorShim { pub map_iterator: MapIterator, pub remain_iterator_count: Option, @@ -219,6 +239,10 @@ impl Iterator for MapIteratorShim { } /// A strongly-typed map in storage whose keys and values can be iterated over. +#[deprecated( + since = "0.4.1", + note = "IterableStorageDoubleMapExtended functionality is now available in substrate's frame-support" +)] pub trait IterableStorageDoubleMapExtended: StorageDoubleMap { @@ -334,4 +358,3 @@ where shim } } -*/ \ No newline at end of file diff --git a/utilities/src/lib.rs b/utilities/src/lib.rs index d0977fe58..2304d9e5d 100644 --- a/utilities/src/lib.rs +++ b/utilities/src/lib.rs @@ -8,6 +8,7 @@ pub mod iterator; pub mod offchain_worker; pub mod ordered_set; +pub use iterator::{IterableStorageDoubleMapExtended, IterableStorageMapExtended}; pub use offchain_worker::OffchainErr; pub use ordered_set::OrderedSet; From 9ebe16b1ceeee33145cf2b3da2d4afe7d01c13ed Mon Sep 17 00:00:00 2001 From: ferrell-code Date: Thu, 2 Sep 2021 14:06:08 -0400 Subject: [PATCH 3/3] deprecate just module --- utilities/src/iterator.rs | 24 ------------------------ utilities/src/lib.rs | 6 ++++++ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/utilities/src/iterator.rs b/utilities/src/iterator.rs index b842c6c30..c2e26c639 100644 --- a/utilities/src/iterator.rs +++ b/utilities/src/iterator.rs @@ -10,10 +10,6 @@ use sp_std::prelude::*; /// Utility to iterate through items in a storage map. /// Forks from substrate, expose previous_key field -#[deprecated( - since = "0.4.1", - note = "StorageMapIterator functionality is now available in substrate's frame-support" -)] pub struct StorageMapIterator { prefix: Vec, pub previous_key: Vec, @@ -54,10 +50,6 @@ impl Iter } /// Shim for StorageMapIterator, add more features -#[deprecated( - since = "0.4.1", - note = "StorageMapIteratorShim functionality is now available in substrate's frame-support" -)] pub struct StorageMapIteratorShim { pub storage_map_iterator: StorageMapIterator, pub remain_iterator_count: Option, @@ -86,10 +78,6 @@ impl Iterator } /// A strongly-typed map in storage whose keys and values can be iterated over. -#[deprecated( - since = "0.4.1", - note = "IterableStorageMapExtended functionality is now available in substrate's frame-support" -)] pub trait IterableStorageMapExtended: StorageMap { /// The type that iterates over all `(key, value)`. type Iterator: Iterator; @@ -154,10 +142,6 @@ where /// Iterate over a prefix and decode raw_key and raw_value into `T`. /// Forks from substrate, expose previous_key field -#[deprecated( - since = "0.4.1", - note = "MapIterator functionality is now available in substrate's frame-support" -)] pub struct MapIterator { prefix: Vec, pub previous_key: Vec, @@ -207,10 +191,6 @@ impl Iterator for MapIterator { } /// Shim for MapIterator, add more features -#[deprecated( - since = "0.4.1", - note = "MapIteratorShim functionality is now available in substrate's frame-support" -)] pub struct MapIteratorShim { pub map_iterator: MapIterator, pub remain_iterator_count: Option, @@ -239,10 +219,6 @@ impl Iterator for MapIteratorShim { } /// A strongly-typed map in storage whose keys and values can be iterated over. -#[deprecated( - since = "0.4.1", - note = "IterableStorageDoubleMapExtended functionality is now available in substrate's frame-support" -)] pub trait IterableStorageDoubleMapExtended: StorageDoubleMap { diff --git a/utilities/src/lib.rs b/utilities/src/lib.rs index 2304d9e5d..5d973b872 100644 --- a/utilities/src/lib.rs +++ b/utilities/src/lib.rs @@ -4,11 +4,17 @@ use frame_support::storage::{with_transaction, TransactionOutcome}; use sp_runtime::DispatchError; use sp_std::result::Result; +#[deprecated( + since = "0.4.1", + note = "iterator module's functionality is now available in substrate's frame-support" +)] pub mod iterator; pub mod offchain_worker; pub mod ordered_set; +#[allow(deprecated)] pub use iterator::{IterableStorageDoubleMapExtended, IterableStorageMapExtended}; + pub use offchain_worker::OffchainErr; pub use ordered_set::OrderedSet;