Skip to content

Commit

Permalink
PR comments resolved #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelkrolevets committed Aug 21, 2024
1 parent 192e714 commit a805153
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 129 deletions.
14 changes: 5 additions & 9 deletions cli/initiator/initiator.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (
"fmt"
"log"

"github.com/sourcegraph/conc/pool"
"github.com/spf13/cobra"
"go.uber.org/zap"

e2m_core "github.com/bloxapp/eth2-key-manager/core"
cli_utils "github.com/bloxapp/ssv-dkg/cli/utils"
"github.com/bloxapp/ssv-dkg/pkgs/crypto"
"github.com/bloxapp/ssv-dkg/pkgs/initiator"
"github.com/bloxapp/ssv-dkg/pkgs/wire"
"github.com/sourcegraph/conc/pool"
"github.com/spf13/cobra"
"go.uber.org/zap"
)

const (
Expand Down Expand Up @@ -62,10 +61,7 @@ var StartDKG = &cobra.Command{
if err != nil {
logger.Fatal("😥 Failed to load operators: ", zap.Error(err))
}
ethnetwork := e2m_core.MainNetwork
if cli_utils.Network != "now_test_network" {
ethnetwork = e2m_core.NetworkFromString(cli_utils.Network)
}
ethNetwork := e2m_core.NetworkFromString(cli_utils.Network)
// start the ceremony
ctx := context.Background()
pool := pool.NewWithResults[*Result]().WithContext(ctx).WithFirstError().WithMaxGoroutines(maxConcurrency)
Expand All @@ -81,7 +77,7 @@ var StartDKG = &cobra.Command{
id := crypto.NewID()
nonce := cli_utils.Nonce + uint64(i)
// Perform the ceremony.
depositData, keyShares, proofs, err := dkgInitiator.StartDKG(id, cli_utils.WithdrawAddress.Bytes(), operatorIDs, ethnetwork, cli_utils.OwnerAddress, nonce)
depositData, keyShares, proofs, err := dkgInitiator.StartDKG(id, cli_utils.WithdrawAddress.Bytes(), operatorIDs, ethNetwork, cli_utils.OwnerAddress, nonce)
if err != nil {
return nil, err
}
Expand Down
19 changes: 7 additions & 12 deletions cli/initiator/resigning.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (
"fmt"
"log"

"github.com/sourcegraph/conc/pool"
"github.com/spf13/cobra"
"go.uber.org/zap"

e2m_core "github.com/bloxapp/eth2-key-manager/core"
cli_utils "github.com/bloxapp/ssv-dkg/cli/utils"
"github.com/bloxapp/ssv-dkg/pkgs/crypto"
"github.com/bloxapp/ssv-dkg/pkgs/initiator"
"github.com/bloxapp/ssv-dkg/pkgs/wire"
"github.com/sourcegraph/conc/pool"
"github.com/spf13/cobra"
"go.uber.org/zap"
)

func init() {
Expand Down Expand Up @@ -59,10 +58,7 @@ var StartResigning = &cobra.Command{
if err != nil {
logger.Fatal("😥 Failed to load participants: ", zap.Error(err))
}
ethnetwork := e2m_core.MainNetwork
if cli_utils.Network != "now_test_network" {
ethnetwork = e2m_core.NetworkFromString(cli_utils.Network)
}
ethNetwork := e2m_core.NetworkFromString(cli_utils.Network)
arrayOfSignedProofs, err := wire.LoadProofs(cli_utils.ProofsFilePath)
if err != nil {
logger.Fatal("😥 Failed to read proofs json file:", zap.Error(err))
Expand All @@ -78,12 +74,11 @@ var StartResigning = &cobra.Command{
if err != nil {
return nil, err
}
proofsData := wire.ConvertSignedProofsToSpec(arrayOfSignedProofs[i])
// Create a new ID.
// Create a new ID
id := crypto.NewID()
nonce := cli_utils.Nonce + uint64(i)
// Perform the resigning ceremony.
depositData, keyShares, proofs, err := dkgInitiator.StartResigning(id, operatorIDs, proofsData, ethnetwork, cli_utils.WithdrawAddress.Bytes(), cli_utils.OwnerAddress, nonce)
// Perform the resigning ceremony
depositData, keyShares, proofs, err := dkgInitiator.StartResigning(id, operatorIDs, arrayOfSignedProofs[i], ethNetwork, cli_utils.WithdrawAddress.Bytes(), cli_utils.OwnerAddress, nonce)
if err != nil {
return nil, err
}
Expand Down
24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/bloxapp/ssv-dkg

go 1.20
go 1.21

toolchain go1.23.0

require (
github.com/aquasecurity/table v1.8.0
Expand Down Expand Up @@ -66,9 +68,10 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
Expand All @@ -83,7 +86,6 @@ require (
github.com/gaukas/godicttls v0.0.3 // indirect
github.com/go-chi/httprate v0.7.4
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/google/uuid v1.3.0
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -97,19 +99,17 @@ require (
github.com/onsi/ginkgo/v2 v2.10.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
github.com/quic-go/quic-go v0.35.1 // indirect
github.com/quic-go/quic-go v0.46.0 // indirect
github.com/refraction-networking/utls v1.3.2 // indirect
github.com/spf13/viper v1.16.0
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.3.0
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.20.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.21.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit a805153

Please sign in to comment.