Skip to content

Commit

Permalink
refactor create command
Browse files Browse the repository at this point in the history
  • Loading branch information
dB2510 committed May 17, 2022
1 parent dd4336b commit fedd36f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 93 deletions.
6 changes: 1 addition & 5 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,13 @@ func New() *cobra.Command {
return newRootCmd(
newVersionCmd(runVersionCmd),
newEnrCmd(runNewENR),
// TODO(dhruv): remove genp2pkey command once charon-docker-compose and docs are updated
newGenP2PKeyCmd(runGenP2PKey),
newRunCmd(app.Run),
newBootnodeCmd(RunBootnode),
// TODO(dhruv): replace newCreateClusterCmdNew with newCreateClusterCmd once charon-docker-compose and docs are updated
newCreateClusterCmd(runCreateCluster),
newDKGCmd(dkg.Run),
newCreateCmd(
newCreateDKGCmd(runCreateDKG),
newCreateEnrCmd(runCreateEnrCmd),
newCreateClusterCmdNew(runCreateCluster),
newCreateClusterCmd(runCreateCluster),
),
)
}
Expand Down
21 changes: 1 addition & 20 deletions cmd/createcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,6 @@ type clusterConfig struct {
func newCreateClusterCmd(runFunc func(io.Writer, clusterConfig) error) *cobra.Command {
var conf clusterConfig

cmd := &cobra.Command{
Use: "create-cluster",
Short: "Create a local charon cluster [DEPRECATED]",
Long: "Create a local charon cluster including validator keys, charon p2p keys, and a cluster manifest. [DEPRECATED]" +
"See flags for supported features.",
RunE: func(cmd *cobra.Command, args []string) error {
return runFunc(cmd.OutOrStdout(), conf)
},
}

bindClusterFlags(cmd.Flags(), &conf)

return cmd
}

// TODO(dhruv): replace newCreateClusterCmd with newCreateClusterCmdNew once charon-docker-compose are updated.
func newCreateClusterCmdNew(runFunc func(io.Writer, clusterConfig) error) *cobra.Command {
var conf clusterConfig

cmd := &cobra.Command{
Use: "cluster",
Short: "Create private keys and configuration files needed to run a distributed validator cluster locally",
Expand Down Expand Up @@ -372,7 +353,7 @@ func writeOutput(out io.Writer, conf clusterConfig) {
_, _ = sb.WriteString("├─ run_cluster.sh\tConvenience script to run all nodes\n")
_, _ = sb.WriteString("├─ teamocil.yml\t\tTeamocil config for splitting logs in tmux panes\n")
}
_, _ = sb.WriteString("├─ node[0-3]/\t\tDirectory for each node\n")
_, _ = sb.WriteString(fmt.Sprintf("├─ node[0-%d]/\t\tDirectory for each node\n", conf.NumNodes-1))
_, _ = sb.WriteString("│ ├─ p2pkey\t\tP2P networking private key for node authentication\n")
_, _ = sb.WriteString("│ ├─ keystore-*.json\tValidator private share key for duty signing\n")
_, _ = sb.WriteString("│ ├─ keystore-*.txt\tKeystore password files for keystore-*.json\n")
Expand Down
2 changes: 1 addition & 1 deletion cmd/createenr_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/obolnetwork/charon/p2p"
)

func TestRunGenP2P(t *testing.T) {
func TestRunCreateEnr(t *testing.T) {
temp, err := os.MkdirTemp("", "")
require.NoError(t, err)

Expand Down
67 changes: 0 additions & 67 deletions cmd/genp2pkey.go

This file was deleted.

0 comments on commit fedd36f

Please sign in to comment.