diff --git a/cmd/seda-chaind/cmd/init.go b/cmd/seda-chaind/cmd/init.go index a696a9c5..cd4e356c 100644 --- a/cmd/seda-chaind/cmd/init.go +++ b/cmd/seda-chaind/cmd/init.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -119,12 +120,13 @@ func downloadAndApplyNetworkConfig(network, moniker string, config *cfg.Config) seedsBytes, err := os.ReadFile(seedsFile) if err != nil { if !os.IsNotExist(err) { - return "", "", err + return "", "", errors.Wrapf(err, "error reading seeds file at %s", seedsFile) } + } else { + seeds = strings.TrimRight(string(seedsBytes), " \n") + config.P2P.Seeds = seeds } - seeds = string(seedsBytes) - config.P2P.Seeds = seeds config.Moniker = moniker cfg.WriteConfigFile(filepath.Join(configDir, "config.toml"), config) diff --git a/cmd/seda-chaind/cmd/init_cmds.go b/cmd/seda-chaind/cmd/init_cmds.go index a10b3943..787d3b25 100644 --- a/cmd/seda-chaind/cmd/init_cmds.go +++ b/cmd/seda-chaind/cmd/init_cmds.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "strings" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -18,6 +19,7 @@ import ( "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/sedaprotocol/seda-chain/app/params" @@ -141,10 +143,18 @@ func newNetworkCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Comma func joinNetworkCommand(mbm module.BasicManager, defaultNodeHome string) *cobra.Command { cmd := &cobra.Command{ - Use: "join [moniker] [network]", + Use: "join [moniker]", Short: "Grabs an existing network configuration and initializes node based on it", - Long: `Initialize validator and node configuration files for an existing network.`, - Args: cobra.ExactArgs(1), + Long: strings.TrimSpace( + fmt.Sprintf(`Initialize validator and node configuration files for an existing network. + +Example: +$ %s init join moniker --network devnet +`, + version.AppName, + ), + ), + Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { clientCtx := client.GetClientContextFromCmd(cmd) serverCtx := server.GetServerContextFromCmd(cmd)