From 39ef8218d5ea4b949bf9ca686056cab3fd795a16 Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Wed, 26 Jun 2024 10:14:43 -0600 Subject: [PATCH] move to server and make default --- .../client/cli => server}/module_hash_by_height.go | 9 ++++----- server/util.go | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) rename {x/genutil/client/cli => server}/module_hash_by_height.go (91%) diff --git a/x/genutil/client/cli/module_hash_by_height.go b/server/module_hash_by_height.go similarity index 91% rename from x/genutil/client/cli/module_hash_by_height.go rename to server/module_hash_by_height.go index d8d938969683..62d9e2a3f604 100644 --- a/x/genutil/client/cli/module_hash_by_height.go +++ b/server/module_hash_by_height.go @@ -1,4 +1,4 @@ -package cli +package server import ( "encoding/hex" @@ -14,7 +14,6 @@ import ( "cosmossdk.io/store/rootmulti" storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/server" servertypes "github.com/cosmos/cosmos-sdk/server/types" ) @@ -31,7 +30,7 @@ Example: RunE: func(cmd *cobra.Command, args []string) error { heightToRetrieveString := args[0] - serverCtx := server.GetServerContextFromCmd(cmd) + serverCtx := GetServerContextFromCmd(cmd) height, err := strconv.ParseInt(heightToRetrieveString, 10, 64) if err != nil { @@ -53,9 +52,9 @@ Example: return cmd } -func getModuleHashesAtHeight[T servertypes.Application](svrCtx *server.Context, appCreator servertypes.AppCreator[T], height int64) (*storetypes.CommitInfo, error) { +func getModuleHashesAtHeight[T servertypes.Application](svrCtx *Context, appCreator servertypes.AppCreator[T], height int64) (*storetypes.CommitInfo, error) { home := svrCtx.Config.RootDir - db, err := openDB(home, server.GetAppDBBackend(svrCtx.Viper)) + db, err := openDB(home, GetAppDBBackend(svrCtx.Viper)) if err != nil { return nil, fmt.Errorf("error opening DB, make sure osmosisd is not running when calling this query: %w", err) } diff --git a/server/util.go b/server/util.go index d185c98e389b..a7538fac6211 100644 --- a/server/util.go +++ b/server/util.go @@ -354,6 +354,7 @@ func AddCommands[T types.Application](rootCmd *cobra.Command, appCreator types.A cometCmd, version.NewVersionCommand(), NewRollbackCmd(appCreator), + ModuleHashByHeightQuery(appCreator), ) }