Refactor Account Storage into Accounts Pallet#8254
Refactor Account Storage into Accounts Pallet#8254shawntabrizi wants to merge 35 commits intomasterfrom
Conversation
|
This is ready for a review on direction and design |
|
Will need some nice migration logic, but basic design looks sound. |
kianenigma
left a comment
There was a problem hiding this comment.
The new functions here might come handy for the migration work: https://github.com/paritytech/substrate/pull/8199/files
I'll do a further review next week, lgtm so far
|
Some feedback when fixing errors. Since Balances pallet uses reference counters, and most pallets use Currency, I had to add the In most of these pallets, the use of reference counting was never relevant or part of the tests. I wanted to implement some dummy struct like I am also thinking to split up the reference counters into smaller traits since most pallets only use one kind of reference counters for their needs. What do you all think? |
coriolinus
left a comment
There was a problem hiding this comment.
Looks like the meat of this PR is all in the first 4 commits, so that's where I focused most of my energy. The rest appears to be mostly fixups to propagate the changes through the rest of the system.
I think that overall NoReferenceCounters is a good idea to reduce the amount of dev-dependencies propagated. Let's only pay for what we're using; if we're not using the reference counting, then let's structure things such that they aren't required.
Smaller reference counter traits also seem like a good idea to me, because it's not obvious as a newcomer to the topic what the distinctions between them are.
The major reason I'm not currently approving this is that, if you do take those suggestions within this PR, then substantial work is incoming and an approval is premature. If you'd prefer to put those into new issues/PRs, then I'd be prepared to approve this once CI is happy.
| type ExistentialDeposit = ExistentialDeposit; | ||
| type AccountStore = System; | ||
| type AccountStore = Accounts; | ||
| type ReferencedAccount = Accounts; |
There was a problem hiding this comment.
name suggestion: AccountReferences?
The account abstraction in FRAME System has become increasingly complex, and does not easily allow for customizable Account storage patterns.
Here, we extract the Account Storage from FRAME System and place those items in a new pallet with a simple API.
This allows developers to crate their own account abstraction while still using FRAME System with all of the macros.
FRAME System now only requires the
BasicAccountAPI to be satisfied:FRAME System provides an implementation for a basic account, where the only data about a user is their nonce.
Other pallets may need to apply and use reference counters on accounts to prevent their account deletion. This is now exposed through an extended
ReferencedAccountAPI:The requirement to use
ReferencedAccountwill come from specific pallets that require this functionality, but will no longer be an assumption about all accounts in FRAME.