Skip to content

Commit

Permalink
refactor: use authtypes.ModuleName
Browse files Browse the repository at this point in the history
  • Loading branch information
rootulp committed Apr 19, 2024
1 parent ce181f0 commit b363d9f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/module/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import (
"sort"

sdkmodule "github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)

const authName = "auth"

// defaultMigrationsOrder returns a default migrations order. The order is
// ascending alphabetical by module name except "auth" will will be last. See:
// https://github.com/cosmos/cosmos-sdk/issues/10591
func defaultMigrationsOrder(modules []string) []string {
result := filter(modules, isNotAuth)
sort.Strings(result)

if hasAuth := slices.Contains(modules, authName); hasAuth {
return append(result, authName)
if hasAuth := slices.Contains(modules, authtypes.ModuleName); hasAuth {
return append(result, authtypes.ModuleName)
}
return result
}
Expand All @@ -32,7 +31,7 @@ func filter(elements []string, filter func(string) bool) (filtered []string) {
}

func isNotAuth(name string) bool {
return name != "auth"
return name != authtypes.ModuleName
}

func getKeys(m map[uint64]map[string]sdkmodule.AppModule) []uint64 {
Expand Down

0 comments on commit b363d9f

Please sign in to comment.