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

Adds store for crisis module #1861

Merged
merged 8 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Add CLI commands for the exchange module endpoints and queries [#1701](https://github.com/provenance-io/provenance/issues/1701).
* Add CLI command to generate autocomplete shell scripts [#1762](https://github.com/provenance-io/provenance/pull/1762).
* Create CLI commands for adding a market to a genesis file [#1757](https://github.com/provenance-io/provenance/issues/1757).
* Add store for crisis module for sdk v0.50 [#1760](https://github.com/provenance-io/provenance/issues/1760).
* Add PreBlocker support for sdk v0.50 [#1760](https://github.com/provenance-io/provenance/issues/1760).

### Improvements
Expand Down
29 changes: 29 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
Expand Down Expand Up @@ -200,6 +201,34 @@ var upgrades = map[string]appUpgrade{
return vm, nil
},
},
"umber-rc1": { // upgrade for v1.19.0-rc1
Added: []string{crisistypes.ModuleName},
Handler: func(ctx sdk.Context, app *App, vm module.VersionMap) (module.VersionMap, error) {
var err error
vm, err = runModuleMigrations(ctx, app, vm)
if err != nil {
return nil, err
}

removeInactiveValidatorDelegations(ctx, app)

return vm, nil
},
},
"umber": { // upgrade for v1.19.0
Added: []string{crisistypes.ModuleName},
Handler: func(ctx sdk.Context, app *App, vm module.VersionMap) (module.VersionMap, error) {
var err error
vm, err = runModuleMigrations(ctx, app, vm)
if err != nil {
return nil, err
}

removeInactiveValidatorDelegations(ctx, app)

return vm, nil
},
},
// TODO - Add new upgrade definitions here.
}

Expand Down
15 changes: 15 additions & 0 deletions app/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,21 @@ func (s *UpgradeTestSuite) TestTourmaline() {
s.AssertUpgradeHandlerLogs("tourmaline", expInLog, nil)
}

func (s *UpgradeTestSuite) TestUmberRC1() {
expInLog := []string{
"INF Starting module migrations. This may take a significant amount of time to complete. Do not restart node.",
"INF removing all delegations from validators that have been inactive (unbonded) for 21 days",
}

s.AssertUpgradeHandlerLogs("umber-rc1", expInLog, nil)
}

func (s *UpgradeTestSuite) TestUmber() {
expInLog := []string{}

s.AssertUpgradeHandlerLogs("umber", expInLog, nil)
}

func (s *UpgradeTestSuite) TestRemoveInactiveValidatorDelegations() {
addr1 := s.CreateAndFundAccount(sdk.NewInt64Coin("stake", 1000000))
addr2 := s.CreateAndFundAccount(sdk.NewInt64Coin("stake", 1000000))
Expand Down
Loading