Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FRAME] Named account references #3647

Open
ggwpez opened this issue Mar 11, 2024 · 1 comment
Open

[FRAME] Named account references #3647

ggwpez opened this issue Mar 11, 2024 · 1 comment
Labels
D2-substantial Can be fixed by an experienced coder with a working knowledge of the codebase. I5-enhancement An additional feature request.

Comments

@ggwpez
Copy link
Member

ggwpez commented Mar 11, 2024

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 (paritytech/substrate#12951).
I would propose to have named types for all references, similar to Holds and Freezes. This would mean the introduction of:

  • RuntimeAccountProviderReason
  • RuntimeAccountConsumerReason
  • RuntimeAccountSufficientReason

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 ggwpez added I5-enhancement An additional feature request. D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. D2-substantial Can be fixed by an experienced coder with a working knowledge of the codebase. and removed D1-medium Can be fixed by a coder with good Rust knowledge but little knowledge of the codebase. labels Mar 11, 2024
@ggwpez
Copy link
Member Author

ggwpez commented Mar 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D2-substantial Can be fixed by an experienced coder with a working knowledge of the codebase. I5-enhancement An additional feature request.
Projects
Status: Backlog
Development

No branches or pull requests

1 participant