Skip to content

Commit

Permalink
Fix the bank params migration. (#1967)
Browse files Browse the repository at this point in the history
* [1760]: Fix the bank params migration. It now ignored current state and just sets DefaultSendEnabled to true (that's what both mainnet and testnet have). The umber tests were failing because the two bank params keys didn't exist. But if I added the key tables, it'd then blow up because the values are nil for the tests. This way is just easier and safer.

* [1760]: In the unit test github actions, re-require the app tests to pass since they all pass now.

* [1760]: Add changelog entry.
  • Loading branch information
SpicyLemon authored and nullpointer0x00 committed May 15, 2024
1 parent e9db5cd commit 0dc7fb3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
# TODO[1760]: Re-analyze how long tests tests take and change the splitting back to be based on speed.
run: |
grep -vF \
-e 'github.com/provenance-io/provenance/app' \
-e 'github.com/provenance-io/provenance/cmd/provenanced/cmd' \
-e 'github.com/provenance-io/provenance/internal/antewrapper' \
-e 'github.com/provenance-io/provenance/x/ibchooks' \
Expand All @@ -62,7 +61,6 @@ jobs:
pkgs.txt > pkgs.txt.tmp
split -d -n l/3 pkgs.txt.tmp pkgs.txt.part.
printf '%s\n' \
'github.com/provenance-io/provenance/app' \
'github.com/provenance-io/provenance/cmd/provenanced/cmd' \
'github.com/provenance-io/provenance/internal/antewrapper' \
'github.com/provenance-io/provenance/x/ibchooks' \
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Msgfees module param migration [#1936](https://github.com/provenance-io/provenance/pull/1936).
* Name module param migration [#1937](https://github.com/provenance-io/provenance/pull/1937).
* IbcHooks module param migration [#1939](https://github.com/provenance-io/provenance/pull/1939).
* Bank module param migration [#1967](https://github.com/provenance-io/provenance/pull/1967).
* Remove `msgfees` legacy gov proposals [#1953](https://github.com/provenance-io/provenance/pull/1953).
* Restore the hold module [#1930](https://github.com/provenance-io/provenance/pull/1930).
* Restore gov-prop cli commands and fix next key decoding [#1930](https://github.com/provenance-io/provenance/pull/1930).
Expand Down
20 changes: 9 additions & 11 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,18 @@ func migrateBaseappParams(ctx sdk.Context, app *App) error {
// won't run on its own. This is the only part of that migration that we still need to have
// done, and this brings us in-line with format the bank state on v4.
// TODO: delete with the umber handlers.
func migrateBankParams(ctx sdk.Context, app *App) (err error) {
func migrateBankParams(ctx sdk.Context, app *App) error {
ctx.Logger().Info("Migrating bank params.")
defer func() {
if err != nil {
ctx.Logger().Error(fmt.Sprintf("Unable to migrate bank params, error: %s.", err))
}
ctx.Logger().Info("Done migrating bank params.")
}()

bankParamsSpace, ok := app.ParamsKeeper.GetSubspace(banktypes.ModuleName)
if !ok {
return fmt.Errorf("params subspace not found: %q", banktypes.ModuleName)
bankParams := banktypes.Params{DefaultSendEnabled: true}
err := app.BankKeeper.SetParams(ctx, bankParams)
if err != nil {
ctx.Logger().Error(fmt.Sprintf("Unable to migrate bank params, error: %s.", err))
return fmt.Errorf("could not store new bank params: %w", err)
}
return app.BankKeeper.MigrateParamsProv(ctx, bankParamsSpace)

ctx.Logger().Info("Done migrating bank params.")
return nil
}

// migrateAttributeParams migrates to new Attribute Params store
Expand Down

0 comments on commit 0dc7fb3

Please sign in to comment.