-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c815250
commit eb45a38
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright © 2022 Obol Labs Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation, either version 3 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along with | ||
// this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package cmd | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/obolnetwork/charon/dkg" | ||
) | ||
|
||
func newDKGCmd(runFunc func(context.Context, dkg.Config) error) *cobra.Command { | ||
var config dkg.Config | ||
|
||
cmd := &cobra.Command{ | ||
Use: "dkg", | ||
Short: "Create distributed validator key shares by participating in a DKG ceremony", | ||
Long: `Participate in a distributed key generation ceremony for a specific cluster definition that creates | ||
distributed validator key shares and a final cluster lock configuration. Note that all other cluster operators should run | ||
this command at the same time.`, | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return runFunc(cmd.Context(), config) | ||
}, | ||
} | ||
|
||
bindDataDirFlag(cmd.Flags(), &config.DataDir) | ||
bindDefDirFlag(cmd.Flags(), &config.DefFile) | ||
bindP2PFlags(cmd.Flags(), &config.P2P) | ||
bindLogFlags(cmd.Flags(), &config.Log) | ||
|
||
return cmd | ||
} | ||
|
||
func bindDefDirFlag(flags *pflag.FlagSet, dataDir *string) { | ||
flags.StringVar(dataDir, "definition-file", ".charon/cluster_definition.json", "The path to the cluster definition file.") | ||
} |