From 868c41635612eea75195bf706fc1580ae8ced0c8 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Fri, 28 Jul 2023 12:08:26 +0200 Subject: [PATCH] Contracts Rollback StorageMap hashing migration (#14661) * Contracts Rollback StorageMap hashing migration * misc v13 --- frame/contracts/src/lib.rs | 4 ++-- frame/contracts/src/migration/v13.rs | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frame/contracts/src/lib.rs b/frame/contracts/src/lib.rs index 449576270fce7..bd01bb232ec6d 100644 --- a/frame/contracts/src/lib.rs +++ b/frame/contracts/src/lib.rs @@ -187,7 +187,7 @@ pub mod pallet { /// The current storage version. #[cfg(not(any(test, feature = "runtime-benchmarks")))] - const STORAGE_VERSION: StorageVersion = StorageVersion::new(12); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(13); /// Hard coded storage version for running tests that depend on the current storage version. #[cfg(any(test, feature = "runtime-benchmarks"))] @@ -1022,7 +1022,7 @@ pub mod pallet { /// TWOX-NOTE: SAFE since `AccountId` is a secure hash. #[pallet::storage] pub(crate) type ContractInfoOf = - StorageMap<_, Identity, T::AccountId, ContractInfo>; + StorageMap<_, Twox64Concat, T::AccountId, ContractInfo>; /// Evicted contracts that await child trie deletion. /// diff --git a/frame/contracts/src/migration/v13.rs b/frame/contracts/src/migration/v13.rs index a512e6c074d23..ade837f46e9b1 100644 --- a/frame/contracts/src/migration/v13.rs +++ b/frame/contracts/src/migration/v13.rs @@ -16,7 +16,6 @@ // limitations under the License. //! Add `delegate_dependencies` to `ContractInfo`. -//! Use `Identity` instead of `Twox64Concat` for hashing keys of the `ContractInfoOf` storage map //! See . use crate::{ @@ -74,7 +73,7 @@ pub fn store_old_contract_info(account: T::AccountId, info: crate::Co #[storage_alias] pub type ContractInfoOf = - StorageMap, Identity, ::AccountId, ContractInfo>; + StorageMap, Twox64Concat, ::AccountId, ContractInfo>; #[derive(Encode, Decode, CloneNoBound, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] #[scale_info(skip_type_params(T))]