contracts: Fix incorrect storage alias in mirgration (#1687)

# Description

We are recently trying to upgrade our Substrate version from
`polkadot-v0.9.43` to `polkadot-v1.0.0` and we noticed a critical issue:
all deployed contracts seem to be experiencing a `CodeNotFound` error.
After a thorough investigation, it appears that the root cause of this
issue lies in the mismatch between the storage alias of `CodeInfoOf<T>`
in the migration and its original definition.

This PR corrects the storage alias to align it with its original
definition

I am uncertain about the proper approach for adding tests to this
change. Would the team consider taking over this PR to bring it to
completion?

---------

Co-authored-by: pgherveou <pgherveou@gmail.com>
This commit is contained in:
Kevin Wang
2023-09-25 21:13:11 +08:00
committed by GitHub
parent c0a4ce1fc8
commit e8da320734
3 changed files with 28 additions and 2 deletions
@@ -96,7 +96,7 @@ where
#[storage_alias]
pub type CodeInfoOf<T: Config, OldCurrency> =
StorageMap<Pallet<T>, Twox64Concat, CodeHash<T>, CodeInfo<T, OldCurrency>>;
StorageMap<Pallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
#[storage_alias]
pub type PristineCode<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, Vec<u8>>;
@@ -70,7 +70,7 @@ mod old {
#[storage_alias]
pub type CodeInfoOf<T: Config, OldCurrency> =
StorageMap<Pallet<T>, Twox64Concat, CodeHash<T>, CodeInfo<T, OldCurrency>>;
StorageMap<Pallet<T>, Identity, CodeHash<T>, CodeInfo<T, OldCurrency>>;
}
#[cfg(feature = "runtime-benchmarks")]