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
fix(inflation): daily epoch mint provision #1193
Conversation
ENG-1207 Inflation is only recalculate once a year, even when parameters change
ContextWe want to create a proposal to change inflation, but there is a bug that prevents is. Check out the Specification. CurrentThe inflation module mints new tokens every day (through hooks). To calculate how many tokens are minted per day (epoch mint provision), we calculate the total amount per year (period provision) and divide it by the epochs per year. The calculation, however, is only performed once a year to adjust inflation on a yearly basis, so that the same amount of tokens are minted every day for one year (illustration from token model) The inflation parameters that calculate the inflation can be changed through governance. Since the epoch mint provision is only recalculated once a year, a proposal to change these parameters wouldn’t change the inflation until next April (one year after genesis).
Expected - Change calculation to run daily but keep yearly intervalsInflation should be recalculated every day, so that it reacts to fluctuations in calculation parameters (e.g. bonding ratio or bonding target) without delay.
Test cases
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1193 +/- ##
==========================================
+ Coverage 76.34% 76.41% +0.07%
==========================================
Files 149 148 -1
Lines 8099 8073 -26
==========================================
- Hits 6183 6169 -14
+ Misses 1716 1708 -8
+ Partials 200 196 -4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, note that we also need to do a migration o remove the EpochMintProvision
from the store in a separate PR.
cc @Vvaradinov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK. @fedekunze will follow up with the migration and tests in a separate PR.
Description
Closes: ENG-1207
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
Code maintenance:
I have...
godoc
and code comments.docs/
) or specification (x/<module>/spec/
)Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...