I am trying to upgrade pallet-did to substrate v4 but i have an issue am facing with the StorageMap implementation. Below is the code for the storage map functions i am trying to implement:
#[pallet::storage]
#[pallet::getter(fn delegate_of)]
pub type DelegateOf<T: Config> =
StorageMap<_, Blake2_128Concat, (T::AccountId, Vec<u8>, T::AccountId), Option<T::BlockNumber>, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn attribute_of)]
pub type AttributeOf<T: Config> =
StorageMap<_, Blake2_128Concat, (T::AccountId, [u8; 32]), Attribute<T::BlockNumber, T::Moment>, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn nonce_of)]
pub type AttributeNonce<T: Config> =
StorageMap<_, Twox64Concat, (T::AccountId, Vec<u8>), u64, ValueQuery>;
#[pallet::storage]
#[pallet::getter(fn owner_of)]
pub type OwnerOf<T: Config> =
StorageMap<_, Blake2_128Concat, T::AccountId, Option<T::AccountId>, OptionQuery>;
#[pallet::storage]
#[pallet::getter(fn updated_by)]
pub type UpdatedBy<T: Config> =
StorageMap<_, Blake2_128Concat, T::AccountId, (T::AccountId, T::BlockNumber, T::Time), OptionQuery>;
This is the decl_storage! functionality in pallet-did refactored into StorageMap functions. I get the following error:
warning: trait objects without an explicit dyn are deprecated
--> src/lib.rs:128:5
|
128 | StorageMap<_, Blake2_128Concat, (T::AccountId, Vec<u8>, T::AccountId), Option<T::BlockNumber>, OptionQuery>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= note: #[warn(bare_trait_objects)] on by default
help: use dyn
|
128 | dyn StorageMap<_, Blake2_128Concat, (T::AccountId, Vec<u8>, T::AccountId), Option<T::BlockNumber>, OptionQuery>;
| +++
This doesn't make sense to me since StorageMap is a type and not a trait. A solution to this and explanation would be highly appreciated.