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

Fix v44 auth upgrade bug #618

Merged
merged 1 commit into from
Nov 25, 2021
Merged
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
15 changes: 13 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,14 @@ func NewOsmosisApp(
for moduleName := range app.mm.Modules {
fromVM[moduleName] = 1
}
// override versions for authz module as to not skip InitGenesis
// EXCEPT Auth needs to run _after_ staking (https://github.com/cosmos/cosmos-sdk/issues/10591),
// and it seems bank as well (https://github.com/provenance-io/provenance/blob/407c89a7d73854515894161e1526f9623a94c368/app/upgrades.go#L86-L122).
// So we do this by making auth run last.
// This is done by setting auth's consensus version to 2, running RunMigrations,
// then setting it back to 1, and then running migrations again.
fromVM[authtypes.ModuleName] = 2

// override versions for authz module as to not skip its InitGenesis
// for txfees module, we will override txfees ourselves.
delete(fromVM, authz.ModuleName)

Expand All @@ -392,7 +399,11 @@ func NewOsmosisApp(
Basedenom: app.StakingKeeper.BondDenom(ctx),
Feetokens: []txfeestypes.FeeToken{},
})
return newVM, nil

// now update auth version back to v1, to run auth migration last
newVM[authtypes.ModuleName] = 1

return app.mm.RunMigrations(ctx, app.configurator, newVM)
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
Expand Down