paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.78k stars 635 forks source link

[FRAME] Named account references #3647

Open ggwpez opened 6 months ago

ggwpez commented 6 months ago

We currently use the dec_ / inc_ functions for provider, consumer and sufficient across pallets.
These references are anonymous and a pallet has no way to check whether an account has a specific reference or not.

This has caused issues in the past, at last with the Currency Migration (https://github.com/paritytech/substrate/pull/12951).
I would propose to have named types for all references, similar to Holds and Freezes. This would mean the introduction of:

with each being the aggregate across all pallets' Account..Reason enums. We should already have macro infrastructure in place to implement this without much overhead.

Migration

We then need to do some migration over to the named references. Possibly lazy, by first trying to access anonymous refs and then placing named references. Or through a MBM.

ggwpez commented 6 months ago

Update after discussion: just using the named Freeze/Hold identifiers should be good for most cases.