tidy formatting and comments

This commit is contained in:
rhuairahrighairigh 2019-07-19 15:06:33 +01:00
parent 5d402197e6
commit 5645f5a766
5 changed files with 15 additions and 18 deletions

View File

@ -40,8 +40,8 @@ var (
DefaultCLIHome = os.ExpandEnv("$HOME/.kvcli") DefaultCLIHome = os.ExpandEnv("$HOME/.kvcli")
DefaultNodeHome = os.ExpandEnv("$HOME/.kvd") 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 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 module.BasicManager
// module account permissions // module account permissions
mAccPerms = map[string][]string{ mAccPerms = map[string][]string{
@ -306,7 +306,6 @@ func (app *App) LoadHeight(height int64) error {
return app.LoadVersion(height, app.keyMain) return app.LoadVersion(height, app.keyMain)
} }
// TODO only used in sim test, needed?
// ModuleAccountAddrs returns all the app's module account addresses. // ModuleAccountAddrs returns all the app's module account addresses.
func (app *App) ModuleAccountAddrs() map[string]bool { func (app *App) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool) modAccAddrs := make(map[string]bool)

View File

@ -4,13 +4,7 @@ import (
"encoding/json" "encoding/json"
) )
// The genesis state of the blockchain is represented here as a map of raw json // GenesisState represents the genesis state of the blockchain. It is a map from module names to module genesis states.
// 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.
type GenesisState map[string]json.RawMessage type GenesisState map[string]json.RawMessage
// NewDefaultGenesisState generates the default state for the application. // NewDefaultGenesisState generates the default state for the application.

View File

@ -68,7 +68,7 @@ func main() {
client.NewCompletionCmd(rootCmd, true), 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) executor := cli.PrepareMainCmd(rootCmd, "KA", app.DefaultCLIHome)
err := executor.Execute() 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. // 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) { func registerRoutes(rs *lcd.RestServer) {
client.RegisterRoutes(rs.CliCtx, rs.Mux) client.RegisterRoutes(rs.CliCtx, rs.Mux)
authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux) authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux)
app.ModuleBasics.RegisterRESTRoutes(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 { func initConfig(cmd *cobra.Command) error {
home, err := cmd.PersistentFlags().GetString(cli.HomeFlag) home, err := cmd.PersistentFlags().GetString(cli.HomeFlag)
if err != nil { if err != nil {
return err return err
} }
cfgFile := path.Join(home, "config", "config.toml") cfgFile := path.Join(home, "config", "config.toml")
if _, err := os.Stat(cfgFile); err == nil { if _, err := os.Stat(cfgFile); err == nil {
viper.SetConfigFile(cfgFile) viper.SetConfigFile(cfgFile)

View File

@ -23,7 +23,6 @@ import (
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/kava-labs/kava/app" "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.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome))
rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, app.DefaultNodeHome)) rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, app.DefaultNodeHome))
rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc)) rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc))
rootCmd.AddCommand(genutilcli.GenTxCmd(ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, rootCmd.AddCommand(genutilcli.GenTxCmd(
genaccounts.AppModuleBasic{}, app.DefaultNodeHome, app.DefaultCLIHome)) ctx,
cdc,
app.ModuleBasics,
staking.AppModuleBasic{},
genaccounts.AppModuleBasic{},
app.DefaultNodeHome,
app.DefaultCLIHome))
rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics)) rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics))
rootCmd.AddCommand(genaccscli.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome)) rootCmd.AddCommand(genaccscli.AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome))
rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true)) rootCmd.AddCommand(client.NewCompletionCmd(rootCmd, true))