From f373afce3f70d5a5e451384c7d7c0788d7aabc5f Mon Sep 17 00:00:00 2001 From: atheesh Date: Fri, 16 Feb 2024 14:57:14 +0530 Subject: [PATCH] review changes --- cmd/cheqd-noded/cmd/root.go | 21 ++++++++++----------- scripts/protocgen.sh | 1 - 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cmd/cheqd-noded/cmd/root.go b/cmd/cheqd-noded/cmd/root.go index a2bda3d16..66e19d976 100644 --- a/cmd/cheqd-noded/cmd/root.go +++ b/cmd/cheqd-noded/cmd/root.go @@ -6,7 +6,7 @@ import ( "os" "github.com/cheqd/cheqd-node/app" - "github.com/cheqd/cheqd-node/app/params" + appparams "github.com/cheqd/cheqd-node/app/params" dbm "github.com/cometbft/cometbft-db" tmconfig "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" @@ -15,7 +15,9 @@ import ( "github.com/cosmos/cosmos-sdk/client/debug" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/keys" + "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -33,7 +35,7 @@ var ChainID = "cheqd-mainnet-1" // NewRootCmd creates a new root command for simd. It is called once in the // main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { +func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) { // Set config for prefixes app.SetConfig() @@ -76,7 +78,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return rootCmd, encodingConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { +func initRootCmd(rootCmd *cobra.Command, encodingConfig appparams.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() @@ -86,8 +88,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { extendDebug(debug.Cmd()), ) - a := appCreator{encodingConfig} - server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, appExport, addModuleInitFlags) + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( @@ -96,12 +97,14 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { queryCommand(), txCommand(), keys.Commands(app.DefaultNodeHome), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), ) } // genesisCommand builds genesis-related `universus genesis` command. // Users may provide application specific commands as a parameter -func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { +func genesisCommand(encodingConfig appparams.EncodingConfig, cmds ...*cobra.Command) *cobra.Command { cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome) for _, subCmd := range cmds { @@ -170,12 +173,8 @@ func txCommand() *cobra.Command { return cmd } -type appCreator struct { - encCfg params.EncodingConfig -} - // newApp is an AppCreator -func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { +func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { return app.New( logger, db, traceStore, true, appOpts, diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 00b24d5c1..109daac94 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -5,7 +5,6 @@ set -euox pipefail echo "Generating gogo proto code" cd proto -# Find all proto files but exclude "v1" paths proto_dirs=$(find ./ -type f -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) for proto_dir in $proto_dirs; do proto_files=$(find "${proto_dir}" -maxdepth 1 -name '*.proto')