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

feat: prune abandoned state #185

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

hallazzang
Copy link
Contributor

Description

By introducing reference counting similar to the x/distribution module, we can safely prune abandoned state
like no longer used HistoricalRewards, OutstandingRewards, CurrentEpoch, ....

closes: #142

References

See: F1 Fee Distribution Paper's 3. State Requirements for details about state pruning using reference counting.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Appropriate labels applied
  • Targeted PR against correct branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@hallazzang hallazzang self-assigned this Oct 21, 2021
@hallazzang hallazzang marked this pull request as ready for review November 10, 2021 06:45
…e-state

# Conflicts:
#	x/farming/keeper/invariants_test.go
#	x/farming/keeper/keeper_test.go
#	x/farming/keeper/reward_test.go
#	x/farming/keeper/staking_test.go
x/farming/keeper/reward.go Outdated Show resolved Hide resolved
@dongsam dongsam self-requested a review November 12, 2021 09:22
Copy link
Contributor

@dongsam dongsam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are some errors in the current method (if there are multiple stakings for the same staking denom and add staking, withdrawing) I think there will be not enough time to review and correct it in this v1.0.0-rc1 release, so it seems necessary to correct it more meticulously in the next sprint.

@hallazzang hallazzang requested a review from dongsam November 25, 2021 12:45
…e-state

# Conflicts:
#	x/farming/keeper/staking.go
@dongsam
Copy link
Contributor

dongsam commented Nov 26, 2021

LGTM, Thank you for fixing logic and adding detailed test code. As a result of internal discussions, we think that the PR is not essential for this release, so we will include it in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Prune states when data is no longer needed
2 participants