Skip to content

Commit

Permalink
Contracts Rollback StorageMap hashing migration (paritytech#14661)
Browse files Browse the repository at this point in the history
* Contracts Rollback StorageMap hashing migration

* misc v13
  • Loading branch information
pgherveou authored Jul 28, 2023
1 parent 1612e39 commit 868c416
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down Expand Up @@ -1022,7 +1022,7 @@ pub mod pallet {
/// TWOX-NOTE: SAFE since `AccountId` is a secure hash.
#[pallet::storage]
pub(crate) type ContractInfoOf<T: Config> =
StorageMap<_, Identity, T::AccountId, ContractInfo<T>>;
StorageMap<_, Twox64Concat, T::AccountId, ContractInfo<T>>;

/// Evicted contracts that await child trie deletion.
///
Expand Down
3 changes: 1 addition & 2 deletions frame/contracts/src/migration/v13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/paritytech/substrate/pull/14079>.
use crate::{
Expand Down Expand Up @@ -74,7 +73,7 @@ pub fn store_old_contract_info<T: Config>(account: T::AccountId, info: crate::Co

#[storage_alias]
pub type ContractInfoOf<T: Config> =
StorageMap<Pallet<T>, Identity, <T as frame_system::Config>::AccountId, ContractInfo<T>>;
StorageMap<Pallet<T>, Twox64Concat, <T as frame_system::Config>::AccountId, ContractInfo<T>>;

#[derive(Encode, Decode, CloneNoBound, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)]
#[scale_info(skip_type_params(T))]
Expand Down

0 comments on commit 868c416

Please sign in to comment.