From 5645f5a766079afe361b8ec2b02c02487c293b75 Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Fri, 19 Jul 2019 15:06:33 +0100 Subject: [PATCH] tidy formatting and comments --- app/app.go | 5 ++--- app/export.go | 2 +- app/genesis.go | 8 +------- cmd/kvcli/main.go | 7 +++---- cmd/kvd/main.go | 11 ++++++++--- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/app/app.go b/app/app.go index 24129ca2..052ee48f 100644 --- a/app/app.go +++ b/app/app.go @@ -40,8 +40,8 @@ var ( DefaultCLIHome = os.ExpandEnv("$HOME/.kvcli") DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") - // _ manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification - ModuleBasics module.BasicManager // TODO rename + // ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification. + ModuleBasics module.BasicManager // module account permissions mAccPerms = map[string][]string{ @@ -306,7 +306,6 @@ func (app *App) LoadHeight(height int64) error { return app.LoadVersion(height, app.keyMain) } -// TODO only used in sim test, needed? // ModuleAccountAddrs returns all the app's module account addresses. func (app *App) ModuleAccountAddrs() map[string]bool { modAccAddrs := make(map[string]bool) diff --git a/app/export.go b/app/export.go index a821dd27..81db5dd1 100644 --- a/app/export.go +++ b/app/export.go @@ -161,4 +161,4 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []string return false }, ) -} \ No newline at end of file +} diff --git a/app/genesis.go b/app/genesis.go index bca9d1e9..d6af7e32 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -4,13 +4,7 @@ import ( "encoding/json" ) -// The genesis state of the blockchain is represented here as a map of raw json -// messages key'd by a identifier string. -// The identifier is used to determine which module genesis information belongs -// to so it may be appropriately routed during init chain. -// Within this application default genesis information is retrieved from -// the ModuleBasicManager which populates json from each BasicModule -// object provided to it during init. +// GenesisState represents the genesis state of the blockchain. It is a map from module names to module genesis states. type GenesisState map[string]json.RawMessage // NewDefaultGenesisState generates the default state for the application. diff --git a/cmd/kvcli/main.go b/cmd/kvcli/main.go index 840ad18a..dbe097b8 100644 --- a/cmd/kvcli/main.go +++ b/cmd/kvcli/main.go @@ -68,7 +68,7 @@ func main() { client.NewCompletionCmd(rootCmd, true), ) - // Add flags and prefix all env exposed with GA + // Add flags and prefix all env exposed with KA executor := cli.PrepareMainCmd(rootCmd, "KA", app.DefaultCLIHome) err := executor.Execute() @@ -134,21 +134,20 @@ func txCmd(cdc *amino.Codec) *cobra.Command { } // registerRoutes registers the routes from the different modules for the LCD. -// NOTE: details on the routes added for each module are in the module documentation -// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go func registerRoutes(rs *lcd.RestServer) { client.RegisterRoutes(rs.CliCtx, rs.Mux) authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux) } +// initConfig reads in and sets options from a config file (if one exists) func initConfig(cmd *cobra.Command) error { home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) if err != nil { return err } - cfgFile := path.Join(home, "config", "config.toml") + if _, err := os.Stat(cfgFile); err == nil { viper.SetConfigFile(cfgFile) diff --git a/cmd/kvd/main.go b/cmd/kvd/main.go index 67477e09..fc3ae833 100644 --- a/cmd/kvd/main.go +++ b/cmd/kvd/main.go @@ -23,7 +23,6 @@ import ( genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cosmos/cosmos-sdk/x/staking" - "github.com/kava-labs/kava/app" ) @@ -50,8 +49,14 @@ func main() { rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome)) rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, app.DefaultNodeHome)) rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) - rootCmd.AddCommand(genutilcli.GenTxCmd(ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, - genaccounts.AppModuleBasic{}, app.DefaultNodeHome, app.DefaultCLIHome)) + rootCmd.AddCommand(genutilcli.GenTxCmd( + ctx, + cdc, + app.ModuleBasics, + staking.AppModuleBasic{}, + genaccounts.AppModuleBasic{}, + app.DefaultNodeHome, + app.DefaultCLIHome)) rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) rootCmd.AddCommand(genaccscli.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true))