-
Notifications
You must be signed in to change notification settings - Fork 253
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: update AnnualProvisions once per year #1871
fix: update AnnualProvisions once per year #1871
Conversation
stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) | ||
genesisState[stakingtypes.ModuleName] = app.AppCodec().MustMarshalJSON(stakingGenesis) | ||
params := stakingtypes.DefaultParams() | ||
params.BondDenom = app.BondDenom |
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.
this line makes the test app's staking module use utia
instead of stake
Codecov Report
@@ Coverage Diff @@
## main #1871 +/- ##
=========================================
+ Coverage 0 21.85% +21.85%
=========================================
Files 0 117 +117
Lines 0 13304 +13304
=========================================
+ Hits 0 2907 +2907
- Misses 0 10107 +10107
- Partials 0 290 +290
|
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.
really nice catch!
x/mint/abci.go
Outdated
if newInflationRate == minter.InflationRate { | ||
|
||
isNonZeroAnnualProvisions := !minter.AnnualProvisions.IsZero() | ||
if newInflationRate.Equal(minter.InflationRate) && isNonZeroAnnualProvisions { | ||
// The minter's InflationRate AnnualProvisions already reflect the | ||
// values for this year. Exit early because we don't need to update | ||
// them. |
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.
the good news is this appears to not break state or the result of the inflation, but previous to this change, this code was literally never getting hit, so we would always end up updating inflation. That might actually still change the apphash even if the state is not changing, depending on if this is causing an insertion to the iavl tree
@rootulp while we're fixing this, can we also only call It could also be also definitely be done in a separate PR, but we should do it before cutting the next release Lines 44 to 49 in 348f795
|
Sure done in 2d7dab5 |
* test: use utia as bond denom in test app * implement failing test * refactor test to use test cases * green test * fix: TestAnnualProvisions * consolidate tests * remove comment * only call SetMinter once * add another test * fix lint
Closes #1870
Note: this wasn't caught by the existing
TestAnnualProvisions
unit test because the test app usedstake
as its bond denomination but the mint module usesutia
as the default bond denomination. So this PR also updates the test app to useutia
as the default bond denomination. After this change, new tokens that get emitted due to inflation increase the total supply ofutia
which will impact the annual provisions calculation.