Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Provider ref count #7343

@gavofyork

Description

@gavofyork

Introduce a second ref-count in the account store.

The current ref count basically says "if non-zero then: the account cannot be mutated into a state where it would be auto-deleted". The new ref count would say "if zero then: the account should be auto-deleted". So we now have two ref-counts: providers and consumers.

The rules would be:

  • providers == 0 && consumers == 0: delete account
  • providers == 0 && consumers > 0: invalid operation (revert state)
  • providers > 0: ensure account exists

A consumer must ensure (as they already do now) that they only bump the ref when the providers count is non-zero (which used to be that the account already exists). This would let us have arbitrary, separate pieces of state which could imply account existence

This way, we can decouple balances from system completely and just wire in the ED logic through a trait if desired.

Then you could optionally bump a provider/consumer ref count (or not) depending on the balances trait impl. System wouldn’t care - its only interface would be this ref count.

Metadata

Metadata

Assignees

Labels

I7-refactorCode needs refactoring.U2-some_time_soonIssue is worth doing soon.Z3-substantialCan be fixed by an experienced coder with a working knowledge of the codebase.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions