From 3f696de9e0edac9a4d97006fbde0deac9818d757 Mon Sep 17 00:00:00 2001 From: Kevin Yang <5478483+k-yang@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:16:48 -0500 Subject: [PATCH] refactor(inflation): make inflation disabled by default (#1712) * refactor(inflation): make inflation disabled by default * chore: update changelog --- CHANGELOG.md | 7 ++----- x/inflation/keeper/hooks_test.go | 4 ++++ x/inflation/keeper/inflation_test.go | 12 ++++++++++-- x/inflation/types/inflation_calculation_test.go | 1 + x/inflation/types/params.go | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c0ccdc6..20e356824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -## [v1.1.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.1.0) - 2023-12-14 +## [v1.1.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.1.0) - 2023-12-15 * [[Release Link](https://github.com/NibiruChain/nibiru/releases/tag/v1.1.0)] * [[Commits](https://github.com/NibiruChain/nibiru/commits/v1.1.0)] @@ -58,10 +58,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Improvements * [#1695](https://github.com/NibiruChain/nibiru/pull/1695) - feat(inflation): add events for inflation distribution - -### State Machine Breaking - -* [#1682](https://github.com/NibiruChain/nibiru/pull/1682) - feat: add upgrade handler for v1.1.0 +* [#1712](https://github.com/NibiruChain/nibiru/pull/1712) - refactor(inflation): turn inflation off by default ## [v1.0.0](https://github.com/NibiruChain/nibiru/releases/tag/v1.0.0) diff --git a/x/inflation/keeper/hooks_test.go b/x/inflation/keeper/hooks_test.go index a64f0a048..0ce0391fa 100644 --- a/x/inflation/keeper/hooks_test.go +++ b/x/inflation/keeper/hooks_test.go @@ -16,6 +16,10 @@ import ( func TestEpochIdentifierAfterEpochEnd(t *testing.T) { nibiruApp, ctx := testapp.NewNibiruTestAppAndContext() + params := nibiruApp.InflationKeeper.GetParams(ctx) + params.InflationEnabled = true + nibiruApp.InflationKeeper.SetParams(ctx, params) + feePoolOld := nibiruApp.DistrKeeper.GetFeePool(ctx) nibiruApp.EpochsKeeper.AfterEpochEnd(ctx, epochstypes.DayEpochID, 1) feePoolNew := nibiruApp.DistrKeeper.GetFeePool(ctx) diff --git a/x/inflation/keeper/inflation_test.go b/x/inflation/keeper/inflation_test.go index 5b157d641..dbca22f15 100644 --- a/x/inflation/keeper/inflation_test.go +++ b/x/inflation/keeper/inflation_test.go @@ -149,13 +149,21 @@ func TestGetCirculatingSupplyAndInflationRate(t *testing.T) { { "high supply", sdk.TokensFromConsensusPower(800_000_000, sdk.DefaultPowerReduction), - func(nibiruApp *app.NibiruApp, ctx sdk.Context) {}, + func(nibiruApp *app.NibiruApp, ctx sdk.Context) { + params := nibiruApp.InflationKeeper.GetParams(ctx) + params.InflationEnabled = true + nibiruApp.InflationKeeper.SetParams(ctx, params) + }, sdk.MustNewDecFromStr("27.095518287362700000"), }, { "low supply", sdk.TokensFromConsensusPower(400_000_000, sdk.DefaultPowerReduction), - func(nibiruApp *app.NibiruApp, ctx sdk.Context) {}, + func(nibiruApp *app.NibiruApp, ctx sdk.Context) { + params := nibiruApp.InflationKeeper.GetParams(ctx) + params.InflationEnabled = true + nibiruApp.InflationKeeper.SetParams(ctx, params) + }, sdk.MustNewDecFromStr("54.191036574725400000"), }, } diff --git a/x/inflation/types/inflation_calculation_test.go b/x/inflation/types/inflation_calculation_test.go index a63701e87..8d76e6935 100644 --- a/x/inflation/types/inflation_calculation_test.go +++ b/x/inflation/types/inflation_calculation_test.go @@ -24,6 +24,7 @@ var ExpectedTotalInflation = sdk.NewDec(810_600_000_000_000) func TestCalculateEpochMintProvision(t *testing.T) { params := DefaultParams() + params.InflationEnabled = true epochId := uint64(0) totalInflation := sdk.ZeroDec() diff --git a/x/inflation/types/params.go b/x/inflation/types/params.go index 89d684b1b..500d672b4 100644 --- a/x/inflation/types/params.go +++ b/x/inflation/types/params.go @@ -18,7 +18,7 @@ var ( ) var ( - DefaultInflation = true + DefaultInflation = false DefaultPolynomialFactors = []sdk.Dec{ sdk.MustNewDecFromStr("-0.00014903"), sdk.MustNewDecFromStr("0.07527647"),