diff --git a/app/upgrades.go b/app/upgrades.go index bcc735ab16..7897babe6e 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -3,6 +3,7 @@ package app import ( "fmt" + "cosmossdk.io/math" icqtypes "github.com/strangelove-ventures/async-icq/v6/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -110,6 +111,7 @@ var upgrades = map[string]appUpgrade{ removeInactiveValidatorDelegations(ctx, app) setupICQ(ctx, app) + updateMaxSupply(ctx, app) return vm, nil }, @@ -128,6 +130,7 @@ var upgrades = map[string]appUpgrade{ removeInactiveValidatorDelegations(ctx, app) setupICQ(ctx, app) + updateMaxSupply(ctx, app) return vm, nil }, @@ -326,3 +329,12 @@ func setupICQ(ctx sdk.Context, app *App) { app.ICQKeeper.SetParams(ctx, icqtypes.NewParams(true, []string{"/provenance.oracle.v1.Query/Oracle"})) ctx.Logger().Info("Done updating ICQ params") } + +// updateMaxSupply sets the value of max supply to the current value of MaxTotalSupply +func updateMaxSupply(ctx sdk.Context, app *App) { + ctx.Logger().Info("Updating MaxSupply marker param") + params := app.MarkerKeeper.GetParams(ctx) + params.MaxSupply = math.NewIntFromUint64(params.MaxTotalSupply) + app.MarkerKeeper.SetParams(ctx, params) + ctx.Logger().Info("Done updating MaxSupply marker param") +} diff --git a/app/upgrades_test.go b/app/upgrades_test.go index 830827f87b..769330a3b9 100644 --- a/app/upgrades_test.go +++ b/app/upgrades_test.go @@ -424,6 +424,8 @@ func (s *UpgradeTestSuite) TestSaffronRC1() { "INF removing all delegations from validators that have been inactive (unbonded) for 21 days", "INF Updating ICQ params", "INF Done updating ICQ params", + "INF Updating MaxSupply marker param", + "INF Done updating MaxSupply marker param", } s.AssertUpgradeHandlerLogs("saffron-rc1", expInLog, nil) @@ -438,6 +440,8 @@ func (s *UpgradeTestSuite) TestSaffron() { "INF removing all delegations from validators that have been inactive (unbonded) for 21 days", "INF Updating ICQ params", "INF Done updating ICQ params", + "INF Updating MaxSupply marker param", + "INF Done updating MaxSupply marker param", } s.AssertUpgradeHandlerLogs("saffron", expInLog, nil)