osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

feat: Delete intermediary accounts

Open mattverse opened this issue 3 years ago • 5 comments

Closes #1797

What is the purpose of the change

We currently do not delete intermediary accounts without any delegations, instead keeping them all in store. The problem is that we even iterate them during epoch, which is the main cause of the log ERR no delegation distribution info, as we're trying to get rewards from delegations that doesn't exist.

This PR introduces logic to deleting intermediary accounts, where we delete an intermediary account when there's no intermediary account connection and delegations from the intermediary account.

Upon my scope of investigation, I do not find any points that can be troublesome when deleting an intermediary account, although there were potential concerns for deleting intermediary account. (Note that we're not deleting the account itself using accountKeeper, we're only deleting this from the superfluid module state)

This PR achieves the goal of deleting unused intermediary accounts by adding the deleting logic and check inside EndBlocker of the superfluid module. (This has to be done in superfluid module not the lockup module because of go lang circular dependency issue. We can get an get around with this via interfaces but tbd upon reveiws)

Brief Changelog

  • Add logic for checking and deleting unused intermediary accounts in EndBlocker of the superfluid module.

Testing and Verifying

Added test cases

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? yes
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? yes
  • How is the feature or change documented? not applicable

mattverse avatar Jul 14 '22 07:07 mattverse

Ohh this is what you meant - the errors are coming from an intermediary account having 0 delegations. I thought you meant a validator going inactive / getting jailed.

This does seem safe / good to me!

ValarDragon avatar Jul 14 '22 13:07 ValarDragon

I definitely feel like we should have a changelog entry for this.

alexanderbez avatar Jul 22 '22 09:07 alexanderbez

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

github-actions[bot] avatar Aug 06 '22 00:08 github-actions[bot]

Current status of PR is that we're merging this upon checking logs for the current logs we have every epoch to confirm this PR would fix the main cause for the error logs

mattverse avatar Aug 09 '22 14:08 mattverse

Confirmed that the logs are actually happening because of the undeleted intermediary accounts. Planning to merge this after getting the changelog entry and fixing the merge conflicts.

I don't think we should pressure getting it on chain asap imo as long as we have merged it.

mattverse avatar Aug 09 '22 15:08 mattverse

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

github-actions[bot] avatar Aug 24 '22 00:08 github-actions[bot]

TODO For this PR pre-merge: write down edge casese that we think needs to be ensured testing, ensure that those cases are well unit tested

mattverse avatar Aug 30 '22 13:08 mattverse

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you!

github-actions[bot] avatar Sep 14 '22 00:09 github-actions[bot]