-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Default PalletInfo impl for ()
can cause storage collisions
#7949
Comments
I think ppl should already use construct_runtime in their tests: staking, executive and few other do that. |
Maybe someone can fix paritytech/polkadot-sdk#367 so we don't need to remember all the details to generate a test runtime? |
maybe we can do a mix of them: |
I think we should fix it properly directly. As I have implemented it, we didn't use it, so there wasn't any problem with this common prefix 😁 |
Does an implementation of Thus the proper fix is deprecated or remove implementation of |
Should we only encourage use of |
I like the idea of encouraging people to use |
I think we should remove the impl of |
We should, once all |
Discovered while working on #7936.
Usually
construct_runtime!
generates aPalletInfo
impl which returns the unique pallet name to use as the storage prefix. However, manually configured test runtimes usetype PalletInfo = ()
in theirsystem::Config
implementation. ThePalletInfo
impl for()
returns"test"
fromname()
, which can cause storage collisions where two pallets have a storage item with the same name.In my case it was because both System and Balances have an
Account
storage item - the temporary fix was applied here: c147734.Chatted with @thiolliere, and we have agreed that we need to remove the footgun of the
PalletInfo
impl for()
. Potential solutions:construct_runtime!
macro work for test ruuntimes (@thiolliere already has some code in this direction)impl_pallet_info!
for test runtimes to generate code similar toconstruct_runtime
()
return some guaranteed unique and consistent pallet prefix, maybe using something instd::any
.System
does not provide one, though this might be tricky because of instantiable pallets (@thiolliere to elaborate)Update:
We are in the process of updating all test runtimes to use
construct_runtime!
directly. Here is a list, please put your name against any that you are working on to avoid duplicating work. It's just a raw list of all frame modules, so feel free to amend where necessary.elections-phragmenThe text was updated successfully, but these errors were encountered: