diff --git a/PENDING.md b/PENDING.md index 109e18ab5002..84b24b28d4c7 100644 --- a/PENDING.md +++ b/PENDING.md @@ -15,6 +15,7 @@ BREAKING CHANGES - `--insecure` flag is removed. - `--tls` is now used to enable secure layer. - [\#3451](https://github.com/cosmos/cosmos-sdk/pull/3451) `gaiacli` now returns transactions in plain text including tags. + - [\#3497](https://github.com/cosmos/cosmos-sdk/issues/3497) `gaiad init` now takes moniker as required arguments, not as parameter. * Gaia * [\#3457](https://github.com/cosmos/cosmos-sdk/issues/3457) Changed governance tally validatorGovInfo to use sdk.Int power instead of sdk.Dec @@ -60,6 +61,7 @@ IMPROVEMENTS * Gaia CLI (`gaiacli`) * [\#3476](https://github.com/cosmos/cosmos-sdk/issues/3476) New `withdraw-all-rewards` command to withdraw all delegations rewards for delegators. + - [\#3497](https://github.com/cosmos/cosmos-sdk/issues/3497) `gaiad gentx` supports `--ip` flag to take a custom ip address. * Gaia * [\#3418](https://github.com/cosmos/cosmos-sdk/issues/3418) Add vesting account diff --git a/cmd/gaia/init/gentx.go b/cmd/gaia/init/gentx.go index ec3ae3573946..111dbfbbd8fa 100644 --- a/cmd/gaia/init/gentx.go +++ b/cmd/gaia/init/gentx.go @@ -62,10 +62,13 @@ following delegation and commission default parameters: return err } - ip, err := server.ExternalIP() - if err != nil { - fmt.Fprintf(os.Stderr, "couldn't retrieve an external IP, "+ - "consequently the tx's memo field will be unset: %s", err) + ip := viper.GetString(cli.FlagIP) + if ip == "" { + ip, err = server.ExternalIP() + if err != nil { + fmt.Fprintf(os.Stderr, "couldn't retrieve an external IP, "+ + "consequently the tx's memo field will be unset: %s", err) + } } genDoc, err := LoadGenesisDoc(cdc, config.GenesisFile()) @@ -161,6 +164,7 @@ following delegation and commission default parameters: cmd.Flags().String(client.FlagName, "", "name of private key with which to sign the gentx") cmd.Flags().String(client.FlagOutputDocument, "", "write the genesis transaction JSON document to the given file instead of the default location") + cmd.Flags().String(cli.FlagIP, "", "The node's public IP.") cmd.Flags().AddFlagSet(cli.FsCommissionCreate) cmd.Flags().AddFlagSet(cli.FsAmount) cmd.Flags().AddFlagSet(cli.FsPk) diff --git a/cmd/gaia/init/init.go b/cmd/gaia/init/init.go index 922cfbafa5c1..a2af2a1c27e2 100644 --- a/cmd/gaia/init/init.go +++ b/cmd/gaia/init/init.go @@ -21,7 +21,6 @@ import ( const ( flagOverwrite = "overwrite" flagClientHome = "home-client" - flagMoniker = "moniker" ) type printInfo struct { @@ -46,11 +45,11 @@ func displayInfo(cdc *codec.Codec, info printInfo) error { // nolint func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command { cmd := &cobra.Command{ - Use: "init", + Use: "init [moniker]", Short: "Initialize private validator, p2p, genesis, and application configuration files", Long: `Initialize validators's and node's configuration files.`, - Args: cobra.NoArgs, - RunE: func(_ *cobra.Command, _ []string) error { + Args: cobra.ExactArgs(1), + RunE: func(_ *cobra.Command, args []string) error { config := ctx.Config config.SetRoot(viper.GetString(cli.HomeFlag)) @@ -64,7 +63,7 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command { return err } - config.Moniker = viper.GetString(flagMoniker) + config.Moniker = args[0] var appState json.RawMessage genFile := config.GenesisFile() @@ -89,8 +88,6 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command { cmd.Flags().String(cli.HomeFlag, app.DefaultNodeHome, "node's home directory") cmd.Flags().BoolP(flagOverwrite, "o", false, "overwrite the genesis.json file") cmd.Flags().String(client.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") - cmd.Flags().String(flagMoniker, "", "set the validator's moniker") - cmd.MarkFlagRequired(flagMoniker) return cmd } diff --git a/docs/gaia/deploy-testnet.md b/docs/gaia/deploy-testnet.md index c617e2052bc8..a91c6d09c6f2 100644 --- a/docs/gaia/deploy-testnet.md +++ b/docs/gaia/deploy-testnet.md @@ -26,7 +26,7 @@ This guide helps you create a single validator node that runs a network locally cd $HOME # Initialize the genesis.json file that will help you to bootstrap the network -gaiad init --chain-id testing --moniker testing +gaiad init --chain-id=testing testing # Create a key to hold your validator account gaiacli keys add validator diff --git a/docs/gaia/join-testnet.md b/docs/gaia/join-testnet.md index 91b3afef613f..a4bbb915f22d 100644 --- a/docs/gaia/join-testnet.md +++ b/docs/gaia/join-testnet.md @@ -19,11 +19,11 @@ These instructions are for setting up a brand new full node from scratch. First, initialize the node and create the necessary config files: ```bash -gaiad init --moniker +gaiad init ``` ::: warning Note -Only ASCII characters are supported for the `--moniker`. Using Unicode characters will render your node unreachable. +Monikers can contain only Only ASCII characters. Using Unicode characters will render your node unreachable. ::: You can edit this `moniker` later, in the `~/.gaiad/config/config.toml` file: