Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ With this configuration, a typical configuration file would look like this:
```yaml
validators: 10 # amount of validators to generate (nonce incrementing by 1) (default: 1)
operatorIDs: [143, 219, 33, 34] # array of Operator IDs which will be used for a DKG ceremony
withdrawAddress: "0xa1a66cc5d309f19fb2fda2b7601b223053d0f7f4" # address where reward payments for the validator are sent
withdrawAddress: "0xa1a66cc5d309f19fb2fda2b7601b223053d0f7f4" # ETH1 withdrawal address for the validator
# compounding: true # use 0x02 compounding withdrawal credentials instead of 0x01 (default: false)
owner: "0xb64923DA2c1A9907AdC63617d882D824033a091c" # address of owner of the Cluster that will manage the validator on ssv.network
nonce: 0 # owner nonce for the SSV contract (default: 0)
network: "holesky" # network name (default: mainnet)
Expand Down Expand Up @@ -215,6 +216,7 @@ ssv-dkg init \
--owner 0x81592c3de184a3e2c0dcb5a261bc107bfa91f494 \
--nonce 4 \
--withdrawAddress 0xa1a66cc5d309f19fb2fda2b7601b223053d0f7f4 \
--compounding \
--network "holesky" \
--outputPath ./output \
--logLevel info \
Expand All @@ -233,8 +235,9 @@ Here's an explanation of each parameter:
| `--operatorsInfoPath` | string | Path to a file containing operators operators information. ID, base64(RSA pub key), endpoint |
| `--owner` | address | Owner address for the SSV contract |
| `--nonce` | int | Owner nonce for the SSV contract (default: 0) |
| `--withdrawAddress` | address | Address where reward payments for the validator are sent |
| `--network` | mainnet / prater / holesky | Network name (default: `mainnet`) |
| `--withdrawAddress` | address | ETH1 withdrawal address for the validator |
| `--compounding` | bool | Use 0x02 compounding withdrawal credentials instead of 0x01 (default: `false`) |
| `--network` | mainnet / prater / holesky / hoodi | Network name (default: `mainnet`) |
| `--outputPath` | string | Path to store the output files (default `./output`) |
| `--configPath` | string | Path to config file, i.e. `init.yaml`. If not supplied command line parameters are being used. |
| `--logLevel` | debug / info / warning / error / critical | Logger's log level (default: `debug`) |
Expand Down
21 changes: 21 additions & 0 deletions cli/flags/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
validators = "validators"
clientCACertPath = "clientCACertPath"
tlsInsecure = "tlsInsecure"
compounding = "compounding"
)

// init flags
Expand All @@ -43,6 +44,7 @@ var (
Validators uint
ClientCACertPath []string
TLSInsecure bool
Compounding bool
)

func SetInitFlags(cmd *cobra.Command) {
Expand All @@ -58,6 +60,7 @@ func SetInitFlags(cmd *cobra.Command) {
ValidatorsFlag(cmd)
ClientCACertPathFlag(cmd)
SetTLSInsecureFlag(cmd)
CompoundingFlag(cmd)
}

// BindInitiatorBaseFlags binds flags to yaml config parameters
Expand Down Expand Up @@ -166,6 +169,10 @@ func BindInitFlags(cmd *cobra.Command) error {
if Validators > 100 || Validators == 0 {
return fmt.Errorf("🚨 Amount of generated validators should be 1 to 100")
}
if err := viper.BindPFlag(compounding, cmd.PersistentFlags().Lookup(compounding)); err != nil {
return err
}
Compounding = viper.GetBool(compounding)
return nil
}

Expand Down Expand Up @@ -249,3 +256,17 @@ func ValidatorsFlag(c *cobra.Command) {
func SetTLSInsecureFlag(c *cobra.Command) {
AddPersistentBoolFlag(c, tlsInsecure, false, "TLS 'InsecureSkipVerify' option. If true, allow any TLS certs to accept", false)
}

// CompoundingFlag adds a compounding flag to the command
func CompoundingFlag(c *cobra.Command) {
AddPersistentBoolFlag(c, compounding, false, "Use 0x02 compounding withdrawal credentials instead of 0x01", false)
}

// WithdrawalCredentials returns 32-byte withdrawal credentials based on the --compounding flag.
func WithdrawalCredentials() []byte {
prefix := spec_crypto.ETH1WithdrawalPrefix
if Compounding {
prefix = spec_crypto.CompoundingWithdrawalPrefix
}
return spec_crypto.WithdrawalCredentials(prefix, WithdrawAddress)
}
5 changes: 5 additions & 0 deletions cli/flags/reshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func SetBaseReshareFlags(cmd *cobra.Command) {
NetworkFlag(cmd)
SetProofsFilePath(cmd)
ProofsStringFlag(cmd)
CompoundingFlag(cmd)
}

func SetGenerateReshareMsgFlags(cmd *cobra.Command) {
Expand Down Expand Up @@ -153,6 +154,10 @@ func BindGenerateReshareMsgFlags(cmd *cobra.Command) error {
if !spec.ValidAmountSet(phase0.Gwei(Amount)) {
return fmt.Errorf("🚨 Amount should be in range between 32 ETH and 2048 ETH")
}
if err := viper.BindPFlag(compounding, cmd.PersistentFlags().Lookup(compounding)); err != nil {
return err
}
Compounding = viper.GetBool(compounding)
return nil
}

Expand Down
5 changes: 5 additions & 0 deletions cli/flags/resign.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func SetBaseResignMsgFlags(cmd *cobra.Command) {
WithdrawAddressFlag(cmd)
SetProofsFilePath(cmd)
ProofsStringFlag(cmd)
CompoundingFlag(cmd)
}

func SetGenerateResignMsgFlags(cmd *cobra.Command) {
Expand Down Expand Up @@ -129,6 +130,10 @@ func BindGenerateResignMsgFlags(cmd *cobra.Command) error {
if err != nil {
return fmt.Errorf("😥 failed to parse owner address: %w", err)
}
if err := viper.BindPFlag(compounding, cmd.PersistentFlags().Lookup(compounding)); err != nil {
return err
}
Compounding = viper.GetBool(compounding)
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions cli/initiator/initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ var StartDKG = &cobra.Command{
if err != nil {
logger.Fatal("😥 Failed to load operators: ", zap.Error(err))
}
ethNetwork := e2m_core.NetworkFromString(flags.Network)
if ethNetwork == "" {
logger.Fatal("😥 Cant recognize eth network")
ethNetwork, err := e2m_core.NetworkFromString(flags.Network)
if err != nil {
logger.Fatal("😥 Cant recognize eth network", zap.Error(err))
}
// start the ceremony
ctx := context.Background()
Expand All @@ -82,7 +82,7 @@ var StartDKG = &cobra.Command{
id := spec.NewID()
nonce := flags.Nonce + uint64(i)
// Perform the ceremony.
depositData, keyShares, proofs, err := dkgInitiator.StartDKG(id, flags.WithdrawAddress.Bytes(), operatorIDs, ethNetwork, flags.OwnerAddress, nonce, flags.Amount)
depositData, keyShares, proofs, err := dkgInitiator.StartDKG(id, flags.WithdrawalCredentials(), operatorIDs, ethNetwork, flags.OwnerAddress, nonce, flags.Amount)
if err != nil {
return nil, err
}
Expand Down
16 changes: 8 additions & 8 deletions cli/initiator/reshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ var GenerateReshareMsg = &cobra.Command{
logger.Fatal("😥 Failed to read proofs string:", zap.Error(err))
}
}
ethNetwork := e2m_core.NetworkFromString(flags.Network)
if ethNetwork == "" {
logger.Fatal("😥 Cant recognize eth network")
ethNetwork, err := e2m_core.NetworkFromString(flags.Network)
if err != nil {
logger.Fatal("😥 Cant recognize eth network", zap.Error(err))
}
rMsgs := []*wire.ReshareMessage{}
for i := 0; i < len(signedProofs); i++ {
Expand All @@ -85,7 +85,7 @@ var GenerateReshareMsg = &cobra.Command{
newOperatorIDs,
signedProofs[i][0].Proof.ValidatorPubKey,
ethNetwork,
flags.WithdrawAddress[:],
flags.WithdrawalCredentials(),
flags.OwnerAddress,
nonce,
flags.Amount,
Expand Down Expand Up @@ -174,9 +174,9 @@ var StartReshare = &cobra.Command{
logger.Fatal("😥 Failed to read proofs string:", zap.Error(err))
}
}
ethNetwork := e2m_core.NetworkFromString(flags.Network)
if ethNetwork == "" {
logger.Fatal("😥 Cant recognize eth network")
ethNetwork, err := e2m_core.NetworkFromString(flags.Network)
if err != nil {
logger.Fatal("😥 Cant recognize eth network", zap.Error(err))
}
signatures, err := cli_utils.SignaturesStringToBytes(flags.Signatures)
if err != nil {
Expand All @@ -191,7 +191,7 @@ var StartReshare = &cobra.Command{
newOperatorIDs,
signedProofs[i][0].Proof.ValidatorPubKey,
ethNetwork,
flags.WithdrawAddress[:],
flags.WithdrawalCredentials(),
flags.OwnerAddress,
nonce,
flags.Amount,
Expand Down
16 changes: 8 additions & 8 deletions cli/initiator/resigning.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ var GenerateResignMsg = &cobra.Command{
if err != nil {
logger.Fatal("😥 Failed to load participants: ", zap.Error(err))
}
ethNetwork := e2m_core.NetworkFromString(flags.Network)
if ethNetwork == "" {
logger.Fatal("😥 Cant recognize eth network")
ethNetwork, err := e2m_core.NetworkFromString(flags.Network)
if err != nil {
logger.Fatal("😥 Cant recognize eth network", zap.Error(err))
}
var signedProofs [][]*spec.SignedProof
if flags.ProofsFilePath != "" {
Expand Down Expand Up @@ -80,7 +80,7 @@ var GenerateResignMsg = &cobra.Command{
operatorIDs,
signedProofs[i][0].Proof.ValidatorPubKey,
ethNetwork,
flags.WithdrawAddress[:],
flags.WithdrawalCredentials(),
flags.OwnerAddress,
nonce,
flags.Amount,
Expand Down Expand Up @@ -144,9 +144,9 @@ var StartResigning = &cobra.Command{
if err != nil {
logger.Fatal("😥 Failed to load operator IDs: ", zap.Error(err))
}
ethNetwork := e2m_core.NetworkFromString(flags.Network)
if ethNetwork == "" {
logger.Fatal("😥 Cant recognize eth network")
ethNetwork, err := e2m_core.NetworkFromString(flags.Network)
if err != nil {
logger.Fatal("😥 Cant recognize eth network", zap.Error(err))
}
var signedProofs [][]*spec.SignedProof
if flags.ProofsFilePath != "" {
Expand Down Expand Up @@ -180,7 +180,7 @@ var StartResigning = &cobra.Command{
operatorIDs,
signedProofs[i][0].Proof.ValidatorPubKey,
ethNetwork,
flags.WithdrawAddress[:],
flags.WithdrawalCredentials(),
flags.OwnerAddress,
nonce, flags.Amount,
signedProofs[i],
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ require (
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
github.com/spf13/viper v1.21.0
github.com/ssvlabs/dkg-spec v1.0.2
github.com/ssvlabs/eth2-key-manager v1.5.3
github.com/ssvlabs/dkg-spec v1.1.0
github.com/ssvlabs/eth2-key-manager v1.5.4
github.com/stretchr/testify v1.11.1
github.com/wealdtech/go-eth2-util v1.8.2
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.4.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,10 @@ github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
github.com/spf13/viper v1.21.0/go.mod h1:P0lhsswPGWD/1lZJ9ny3fYnVqxiegrlNrEmgLjbTCAY=
github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YEwQ0=
github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I=
github.com/ssvlabs/dkg-spec v1.0.2 h1:wimkCQOLQcVwXx4A7xa6/cwcMyP28Py+oOesdFaDTXo=
github.com/ssvlabs/dkg-spec v1.0.2/go.mod h1:I17IZg8ugxN0FU8ySUGwm/DChjUBAFKWUI0fysXP1DM=
github.com/ssvlabs/eth2-key-manager v1.5.3 h1:B9U+mrdQpWMWfIEhWGW2m3b95IqvzFv9sLtq7kQEcyI=
github.com/ssvlabs/eth2-key-manager v1.5.3/go.mod h1:yeUzAP+SBJXgeXPiGBrLeLuHIQCpeJZV7Jz3Fwzm/zk=
github.com/ssvlabs/dkg-spec v1.1.0 h1:3NqwvJThVVM0OI7MeDlEmClekcJh91U18Z1yUfsV92g=
github.com/ssvlabs/dkg-spec v1.1.0/go.mod h1:LfokZtUAjnKiPpVXdBZzU/dur0YVI9tRH+LpATsdGQ4=
github.com/ssvlabs/eth2-key-manager v1.5.4 h1:TnKbS3HeWE+txUyxf0n0EhSIxeFWSKpLwm5VfmMeegw=
github.com/ssvlabs/eth2-key-manager v1.5.4/go.mod h1:yeUzAP+SBJXgeXPiGBrLeLuHIQCpeJZV7Jz3Fwzm/zk=
github.com/stbenjam/no-sprintf-host-port v0.3.1 h1:AyX7+dxI4IdLBPtDbsGAyqiTSLpCP9hWRrXQDU4Cm/g=
github.com/stbenjam/no-sprintf-host-port v0.3.1/go.mod h1:ODbZesTCHMVKthBHskvUUexdcNHAQRXk9NpSsL8p/HQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
2 changes: 1 addition & 1 deletion integration_test/init_bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func runBulkInit(t *testing.T, ops wire.OperatorsCLI, opIDs []uint64, owner, wit
return nil, err
}
id := spec.NewID()
depositData, ks, proofs, err := clnt.StartDKG(id, withdraw[:], opIDs, "mainnet", owner, uint64(1+i), uint64(spec_crypto.MIN_ACTIVATION_BALANCE)) //nolint:gosec // test values
depositData, ks, proofs, err := clnt.StartDKG(id, eth1Creds(withdraw), opIDs, "mainnet", owner, uint64(1+i), uint64(spec_crypto.MIN_ACTIVATION_BALANCE)) //nolint:gosec // test values
if err != nil {
return nil, err
}
Expand Down
Loading