diff --git a/airgapped/airgapped.go b/airgapped/airgapped.go index 66e0403e..2b80ba4f 100644 --- a/airgapped/airgapped.go +++ b/airgapped/airgapped.go @@ -11,6 +11,8 @@ import ( "github.com/corestario/kyber" "github.com/corestario/kyber/encrypt/ecies" vss "github.com/corestario/kyber/share/vss/rabin" + "github.com/syndtr/goleveldb/leveldb" + client "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/dkg" "github.com/lidofinance/dc4bc/fsm/fsm" @@ -18,7 +20,6 @@ import ( "github.com/lidofinance/dc4bc/fsm/state_machines/signature_proposal_fsm" "github.com/lidofinance/dc4bc/fsm/state_machines/signing_proposal_fsm" "github.com/lidofinance/dc4bc/fsm/types/requests" - "github.com/syndtr/goleveldb/leveldb" ) const ( diff --git a/airgapped/airgapped_test.go b/airgapped/airgapped_test.go index 3261eaae..0f2a505f 100644 --- a/airgapped/airgapped_test.go +++ b/airgapped/airgapped_test.go @@ -10,6 +10,8 @@ import ( "time" "github.com/google/uuid" + "github.com/stretchr/testify/require" + client "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/fsm/fsm" "github.com/lidofinance/dc4bc/fsm/state_machines/dkg_proposal_fsm" @@ -18,7 +20,6 @@ import ( "github.com/lidofinance/dc4bc/fsm/types/requests" "github.com/lidofinance/dc4bc/fsm/types/responses" "github.com/lidofinance/dc4bc/storage" - "github.com/stretchr/testify/require" ) const ( diff --git a/airgapped/bls.go b/airgapped/bls.go index 87bdf883..8c2d4306 100644 --- a/airgapped/bls.go +++ b/airgapped/bls.go @@ -7,6 +7,7 @@ import ( "github.com/corestario/kyber/pairing" "github.com/corestario/kyber/sign/bls" "github.com/corestario/kyber/sign/tbls" + client "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/fsm/state_machines/signing_proposal_fsm" "github.com/lidofinance/dc4bc/fsm/types/requests" diff --git a/airgapped/dkg.go b/airgapped/dkg.go index fdca6b16..8876aba3 100644 --- a/airgapped/dkg.go +++ b/airgapped/dkg.go @@ -12,6 +12,7 @@ import ( "github.com/corestario/kyber" dkgPedersen "github.com/corestario/kyber/share/dkg/pedersen" + client "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/dkg" "github.com/lidofinance/dc4bc/fsm/state_machines/dkg_proposal_fsm" diff --git a/airgapped/storage.go b/airgapped/storage.go index 701e2a92..fb6c0b78 100644 --- a/airgapped/storage.go +++ b/airgapped/storage.go @@ -10,10 +10,11 @@ import ( bls12381 "github.com/corestario/kyber/pairing/bls12381" - client "github.com/lidofinance/dc4bc/client/types" "github.com/syndtr/goleveldb/leveldb" "github.com/tyler-smith/go-bip39" "golang.org/x/crypto/pbkdf2" + + client "github.com/lidofinance/dc4bc/client/types" ) const ( diff --git a/airgapped/storage_test.go b/airgapped/storage_test.go index 9304a3ac..765147c1 100644 --- a/airgapped/storage_test.go +++ b/airgapped/storage_test.go @@ -5,8 +5,9 @@ import ( "os" "testing" - client "github.com/lidofinance/dc4bc/client/types" "github.com/stretchr/testify/require" + + client "github.com/lidofinance/dc4bc/client/types" ) func TestMachine_DropOperationsLog(t *testing.T) { diff --git a/airgapped/types.go b/airgapped/types.go index cc3d1fa3..c365ca94 100644 --- a/airgapped/types.go +++ b/airgapped/types.go @@ -4,8 +4,9 @@ import ( "fmt" "strings" - "github.com/lidofinance/dc4bc/dkg" "github.com/syndtr/goleveldb/leveldb/util" + + "github.com/lidofinance/dc4bc/dkg" ) const ( diff --git a/client/api/http_api/handlers/dkg.go b/client/api/http_api/handlers/dkg.go index 45117bfb..50ec4da2 100644 --- a/client/api/http_api/handlers/dkg.go +++ b/client/api/http_api/handlers/dkg.go @@ -9,6 +9,7 @@ import ( "github.com/censync/go-dto" "github.com/censync/go-validator" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/fsm.go b/client/api/http_api/handlers/fsm.go index 1a6d5d03..911daf29 100644 --- a/client/api/http_api/handlers/fsm.go +++ b/client/api/http_api/handlers/fsm.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/keys.go b/client/api/http_api/handlers/keys.go index 3c4a2396..fd90a93a 100644 --- a/client/api/http_api/handlers/keys.go +++ b/client/api/http_api/handlers/keys.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" ) diff --git a/client/api/http_api/handlers/messages.go b/client/api/http_api/handlers/messages.go index 9031d910..1e7fa68c 100644 --- a/client/api/http_api/handlers/messages.go +++ b/client/api/http_api/handlers/messages.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/operations.go b/client/api/http_api/handlers/operations.go index 4cab929b..0a07bf6a 100644 --- a/client/api/http_api/handlers/operations.go +++ b/client/api/http_api/handlers/operations.go @@ -5,6 +5,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/signatures.go b/client/api/http_api/handlers/signatures.go index 67b6f1d5..59bc5e36 100644 --- a/client/api/http_api/handlers/signatures.go +++ b/client/api/http_api/handlers/signatures.go @@ -7,6 +7,7 @@ import ( "github.com/google/uuid" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/state.go b/client/api/http_api/handlers/state.go index 4296168f..fb6ae12f 100644 --- a/client/api/http_api/handlers/state.go +++ b/client/api/http_api/handlers/state.go @@ -5,6 +5,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + . "github.com/lidofinance/dc4bc/client/api/dto" cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" req "github.com/lidofinance/dc4bc/client/api/http_api/requests" diff --git a/client/api/http_api/handlers/username.go b/client/api/http_api/handlers/username.go index eeb45451..1ed02ea4 100644 --- a/client/api/http_api/handlers/username.go +++ b/client/api/http_api/handlers/username.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/labstack/echo/v4" + cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" ) diff --git a/client/api/http_api/http_api.go b/client/api/http_api/http_api.go index f6c09f79..56943fcb 100644 --- a/client/api/http_api/http_api.go +++ b/client/api/http_api/http_api.go @@ -3,12 +3,12 @@ package http_api import ( "context" + "github.com/labstack/echo/v4" echo_middleware "github.com/labstack/echo/v4/middleware" - "github.com/lidofinance/dc4bc/client/services" - "github.com/labstack/echo/v4" "github.com/lidofinance/dc4bc/client/api/http_api/router" "github.com/lidofinance/dc4bc/client/config" + "github.com/lidofinance/dc4bc/client/services" "github.com/lidofinance/dc4bc/client/services/node" ) diff --git a/client/api/http_api/middlewares.go b/client/api/http_api/middlewares.go index 61ebd60d..b2818b02 100644 --- a/client/api/http_api/middlewares.go +++ b/client/api/http_api/middlewares.go @@ -5,6 +5,7 @@ import ( "net/http" . "github.com/labstack/echo/v4" + cs "github.com/lidofinance/dc4bc/client/api/http_api/context_service" ) diff --git a/client/api/http_api/router/default_router.go b/client/api/http_api/router/default_router.go index 1333493d..165bd105 100755 --- a/client/api/http_api/router/default_router.go +++ b/client/api/http_api/router/default_router.go @@ -2,6 +2,7 @@ package router import ( "github.com/labstack/echo/v4" + "github.com/lidofinance/dc4bc/client/api/http_api/handlers" "github.com/lidofinance/dc4bc/client/services" "github.com/lidofinance/dc4bc/client/services/node" diff --git a/client/modules/keystore/keystore.go b/client/modules/keystore/keystore.go index fb28ec75..423d999f 100644 --- a/client/modules/keystore/keystore.go +++ b/client/modules/keystore/keystore.go @@ -6,8 +6,9 @@ import ( "encoding/json" "fmt" - "github.com/lidofinance/dc4bc/client/repositories/operation" "github.com/syndtr/goleveldb/leveldb" + + "github.com/lidofinance/dc4bc/client/repositories/operation" ) const ( diff --git a/client/repositories/operation/operation_test.go b/client/repositories/operation/operation_test.go index 84bac84f..3b41eba2 100644 --- a/client/repositories/operation/operation_test.go +++ b/client/repositories/operation/operation_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/lidofinance/dc4bc/client/modules/state" "github.com/lidofinance/dc4bc/client/types" - "github.com/stretchr/testify/require" ) func TestPutOperation(t *testing.T) { diff --git a/client/services/fsmservice/fsmservice_test.go b/client/services/fsmservice/fsmservice_test.go index abc4d386..b02ac374 100644 --- a/client/services/fsmservice/fsmservice_test.go +++ b/client/services/fsmservice/fsmservice_test.go @@ -7,10 +7,11 @@ import ( "time" "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/lidofinance/dc4bc/client/api/dto" "github.com/lidofinance/dc4bc/mocks/clientMocks" "github.com/lidofinance/dc4bc/mocks/storageMocks" - "github.com/stretchr/testify/require" ) func TestClient_ResetState(t *testing.T) { diff --git a/client/services/node/adapt_dkg.go b/client/services/node/adapt_dkg.go index d3551477..6494ea63 100644 --- a/client/services/node/adapt_dkg.go +++ b/client/services/node/adapt_dkg.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/google/uuid" + "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/fsm/fsm" "github.com/lidofinance/dc4bc/fsm/state_machines/dkg_proposal_fsm" diff --git a/client/services/node/node_service.go b/client/services/node/node_service.go index b9790a7e..7e0971a3 100644 --- a/client/services/node/node_service.go +++ b/client/services/node/node_service.go @@ -19,20 +19,19 @@ import ( "github.com/corestario/kyber/pairing" "github.com/corestario/kyber/pairing/bls12381" "github.com/corestario/kyber/sign/tbls" - "github.com/lidofinance/dc4bc/dkg" - - "github.com/lidofinance/dc4bc/client/services/fsmservice" - "github.com/lidofinance/dc4bc/client/services/operation" - "github.com/lidofinance/dc4bc/client/services/signature" - "github.com/google/uuid" + "github.com/lidofinance/dc4bc/client/api/dto" "github.com/lidofinance/dc4bc/client/config" "github.com/lidofinance/dc4bc/client/modules/keystore" "github.com/lidofinance/dc4bc/client/modules/logger" "github.com/lidofinance/dc4bc/client/modules/state" "github.com/lidofinance/dc4bc/client/services" + "github.com/lidofinance/dc4bc/client/services/fsmservice" + "github.com/lidofinance/dc4bc/client/services/operation" + "github.com/lidofinance/dc4bc/client/services/signature" "github.com/lidofinance/dc4bc/client/types" + "github.com/lidofinance/dc4bc/dkg" "github.com/lidofinance/dc4bc/fsm/fsm" "github.com/lidofinance/dc4bc/fsm/state_machines" dpf "github.com/lidofinance/dc4bc/fsm/state_machines/dkg_proposal_fsm" diff --git a/client/services/node/node_service_test.go b/client/services/node/node_service_test.go index a0918a6f..9c226f0e 100644 --- a/client/services/node/node_service_test.go +++ b/client/services/node/node_service_test.go @@ -7,8 +7,9 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" "github.com/google/uuid" - "github.com/lidofinance/dc4bc/mocks/serviceMocks" + "github.com/stretchr/testify/require" "github.com/lidofinance/dc4bc/client/config" "github.com/lidofinance/dc4bc/client/modules/keystore" @@ -17,12 +18,10 @@ import ( "github.com/lidofinance/dc4bc/fsm/state_machines" spf "github.com/lidofinance/dc4bc/fsm/state_machines/signature_proposal_fsm" "github.com/lidofinance/dc4bc/fsm/types/requests" - "github.com/lidofinance/dc4bc/storage" - - "github.com/golang/mock/gomock" "github.com/lidofinance/dc4bc/mocks/clientMocks" + "github.com/lidofinance/dc4bc/mocks/serviceMocks" "github.com/lidofinance/dc4bc/mocks/storageMocks" - "github.com/stretchr/testify/require" + "github.com/lidofinance/dc4bc/storage" ) func TestClient_ProcessMessage(t *testing.T) { diff --git a/cmd/airgapped/main.go b/cmd/airgapped/main.go index 8826abce..8a8f9fef 100644 --- a/cmd/airgapped/main.go +++ b/cmd/airgapped/main.go @@ -19,10 +19,11 @@ import ( "syscall" "time" - "github.com/lidofinance/dc4bc/airgapped" - client "github.com/lidofinance/dc4bc/client/types" "github.com/syndtr/goleveldb/leveldb" "golang.org/x/crypto/ssh/terminal" + + "github.com/lidofinance/dc4bc/airgapped" + client "github.com/lidofinance/dc4bc/client/types" ) func init() { diff --git a/cmd/dc4bc_cli/main.go b/cmd/dc4bc_cli/main.go index b02386f9..b26f3c58 100644 --- a/cmd/dc4bc_cli/main.go +++ b/cmd/dc4bc_cli/main.go @@ -22,22 +22,20 @@ import ( "time" "github.com/corestario/kyber/pairing/bls12381" - "github.com/lidofinance/dc4bc/dkg" - fsmtypes "github.com/lidofinance/dc4bc/fsm/types" - "github.com/lidofinance/dc4bc/pkg/utils" + "github.com/fatih/color" + "github.com/spf13/cobra" httprequests "github.com/lidofinance/dc4bc/client/api/http_api/requests" httpresponses "github.com/lidofinance/dc4bc/client/api/http_api/responses" - "github.com/lidofinance/dc4bc/client/types" + "github.com/lidofinance/dc4bc/dkg" "github.com/lidofinance/dc4bc/fsm/fsm" "github.com/lidofinance/dc4bc/fsm/state_machines" spf "github.com/lidofinance/dc4bc/fsm/state_machines/signature_proposal_fsm" + fsmtypes "github.com/lidofinance/dc4bc/fsm/types" "github.com/lidofinance/dc4bc/fsm/types/requests" "github.com/lidofinance/dc4bc/fsm/types/responses" - - "github.com/fatih/color" - "github.com/spf13/cobra" + "github.com/lidofinance/dc4bc/pkg/utils" ) const ( diff --git a/cmd/dc4bc_d/main.go b/cmd/dc4bc_d/main.go index d5699d3b..5ca00b4f 100644 --- a/cmd/dc4bc_d/main.go +++ b/cmd/dc4bc_d/main.go @@ -8,15 +8,15 @@ import ( "os/signal" "syscall" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/lidofinance/dc4bc/client/api/http_api" + apiconfig "github.com/lidofinance/dc4bc/client/config" "github.com/lidofinance/dc4bc/client/modules/keystore" "github.com/lidofinance/dc4bc/client/services" "github.com/lidofinance/dc4bc/client/services/node" - - apiconfig "github.com/lidofinance/dc4bc/client/config" "github.com/lidofinance/dc4bc/fsm/config" - "github.com/spf13/cobra" - "github.com/spf13/viper" ) const ( diff --git a/cmd/dkg_reinitializer/main.go b/cmd/dkg_reinitializer/main.go index 8bdb1063..86ce0a40 100644 --- a/cmd/dkg_reinitializer/main.go +++ b/cmd/dkg_reinitializer/main.go @@ -4,16 +4,16 @@ import ( "encoding/json" "errors" "fmt" - "github.com/lidofinance/dc4bc/pkg/utils" "io/ioutil" "log" "os" - "github.com/lidofinance/dc4bc/client/services/node" + "github.com/lidofinance/dc4bc/pkg/utils" + "github.com/spf13/cobra" + "github.com/lidofinance/dc4bc/client/services/node" "github.com/lidofinance/dc4bc/client/types" "github.com/lidofinance/dc4bc/storage" - "github.com/spf13/cobra" ) const ( diff --git a/fsm/types/requests/dkg_proposal.go b/fsm/types/requests/dkg_proposal.go index 3e5c33a5..2041585d 100644 --- a/fsm/types/requests/dkg_proposal.go +++ b/fsm/types/requests/dkg_proposal.go @@ -39,16 +39,18 @@ type DKGProposalMasterKeyConfirmationRequest struct { } // States: "state_dkg_pub_keys_await_confirmations" -// "state_dkg_commits_sending_await_confirmations" -// "state_dkg_deals_await_confirmations" -// "state_dkg_responses_await_confirmations" -// "state_dkg_master_key_await_confirmations" +// +// "state_dkg_commits_sending_await_confirmations" +// "state_dkg_deals_await_confirmations" +// "state_dkg_responses_await_confirmations" +// "state_dkg_master_key_await_confirmations" // // Events: "event_dkg_pub_key_confirm_canceled_by_error", -// "event_dkg_commit_confirm_canceled_by_error" -// "event_dkg_deal_confirm_canceled_by_error" -// "event_dkg_response_confirm_canceled_by_error" -// "event_dkg_master_key_confirm_canceled_by_error" +// +// "event_dkg_commit_confirm_canceled_by_error" +// "event_dkg_deal_confirm_canceled_by_error" +// "event_dkg_response_confirm_canceled_by_error" +// "event_dkg_master_key_confirm_canceled_by_error" type DKGProposalConfirmationErrorRequest struct { ParticipantId int Error *FSMError diff --git a/fsm/types/requests/signature_proposal.go b/fsm/types/requests/signature_proposal.go index 332b3b3b..58db0c49 100644 --- a/fsm/types/requests/signature_proposal.go +++ b/fsm/types/requests/signature_proposal.go @@ -20,7 +20,8 @@ type SignatureProposalParticipantsEntry struct { // States: "__idle" // Events: "event_sig_proposal_confirm_by_participant" -// "event_sig_proposal_decline_by_participant" +// +// "event_sig_proposal_decline_by_participant" type SignatureProposalParticipantRequest struct { ParticipantId int CreatedAt time.Time diff --git a/mocks/clientMocks/keystore_mock.go b/mocks/clientMocks/keystore_mock.go index 6369351e..69040ffc 100644 --- a/mocks/clientMocks/keystore_mock.go +++ b/mocks/clientMocks/keystore_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + keystore "github.com/lidofinance/dc4bc/client/modules/keystore" ) diff --git a/mocks/repoMocks/operation_mock.go b/mocks/repoMocks/operation_mock.go index b2948867..d028e81d 100644 --- a/mocks/repoMocks/operation_mock.go +++ b/mocks/repoMocks/operation_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + types "github.com/lidofinance/dc4bc/client/types" ) diff --git a/mocks/repoMocks/signature_mock.go b/mocks/repoMocks/signature_mock.go index 56a3fc0f..c94a1994 100644 --- a/mocks/repoMocks/signature_mock.go +++ b/mocks/repoMocks/signature_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + signature "github.com/lidofinance/dc4bc/client/repositories/signature" types "github.com/lidofinance/dc4bc/fsm/types" ) diff --git a/mocks/serviceMocks/fsmservice_mock.go b/mocks/serviceMocks/fsmservice_mock.go index 197cc23a..a5ac8c13 100644 --- a/mocks/serviceMocks/fsmservice_mock.go +++ b/mocks/serviceMocks/fsmservice_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + dto "github.com/lidofinance/dc4bc/client/api/dto" state_machines "github.com/lidofinance/dc4bc/fsm/state_machines" ) diff --git a/mocks/serviceMocks/operation_mock.go b/mocks/serviceMocks/operation_mock.go index 1496f823..0616260f 100644 --- a/mocks/serviceMocks/operation_mock.go +++ b/mocks/serviceMocks/operation_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + types "github.com/lidofinance/dc4bc/client/types" ) diff --git a/mocks/serviceMocks/signature_mock.go b/mocks/serviceMocks/signature_mock.go index e1bf2867..4137db5a 100644 --- a/mocks/serviceMocks/signature_mock.go +++ b/mocks/serviceMocks/signature_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + dto "github.com/lidofinance/dc4bc/client/api/dto" signature "github.com/lidofinance/dc4bc/client/repositories/signature" types "github.com/lidofinance/dc4bc/fsm/types" diff --git a/mocks/storageMocks/storage_mock.go b/mocks/storageMocks/storage_mock.go index 549ebde6..1f5038ca 100644 --- a/mocks/storageMocks/storage_mock.go +++ b/mocks/storageMocks/storage_mock.go @@ -8,6 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + storage "github.com/lidofinance/dc4bc/storage" ) diff --git a/pkg/prysm/prysm.go b/pkg/prysm/prysm.go index f40da156..50b18e3e 100644 --- a/pkg/prysm/prysm.go +++ b/pkg/prysm/prysm.go @@ -6,8 +6,9 @@ import ( "io/ioutil" "path" - "github.com/lidofinance/dc4bc/dkg" prysmBLS "github.com/prysmaticlabs/prysm/crypto/bls" + + "github.com/lidofinance/dc4bc/dkg" ) func BatchVerification(exportedSignatures dkg.ExportedSignatures, pubkeyb64 string, dataDir string) error { diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index a1ba2b71..628bd166 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -4,9 +4,10 @@ import ( "encoding/csv" "encoding/json" "fmt" - "github.com/lidofinance/dc4bc/storage" "os" + "github.com/lidofinance/dc4bc/storage" + "github.com/lidofinance/dc4bc/dkg" fsmtypes "github.com/lidofinance/dc4bc/fsm/types" ) diff --git a/pkg/wc_rotation/rotation.go b/pkg/wc_rotation/rotation.go index 6a1fb058..9c4b8bb7 100644 --- a/pkg/wc_rotation/rotation.go +++ b/pkg/wc_rotation/rotation.go @@ -2,10 +2,7 @@ package wc_rotation import ( _ "embed" - "errors" - "fmt" "github.com/lidofinance/dc4bc/pkg/wc_rotation/entity" - "strconv" ) var ( @@ -44,28 +41,6 @@ var ( ValidatorsIndexes string ) -func GetValidatorsIndexes(start, end int) ([]uint64, error) { - var strids []string - - if end > len(strids) { - end = len(strids) - } - - if start >= end { - return nil, errors.New("invalid range, end should be greater than start") - } - - ids := make([]uint64, 0, end-start) - for _, strid := range strids[start:end] { - id, err := strconv.Atoi(strid) - if err != nil { - return nil, fmt.Errorf("failed to parse id into int: %w", err) - } - ids = append(ids, uint64(id)) - } - return ids, nil -} - func GetSigningRoot(validatorIndex uint64) ([32]byte, error) { domain, computeDomainErr := computeDomain( DomainBlsToExecutionChange, @@ -94,14 +69,18 @@ func GetSigningRoot(validatorIndex uint64) ([32]byte, error) { }).HashTreeRoot() } -// computeDomain returns the domain for the ``domain_type`` and ``fork_version``. +// computeDomain returns the domain for the “domain_type“ and “fork_version“. // // Spec pseudocode definition: // def compute_domain(domain_type: DomainType, fork_version: Version=None, genesis_validators_root: Root=None) -> Domain: // if fork_version is None: -// fork_version = GENESIS_FORK_VERSION +// +// fork_version = GENESIS_FORK_VERSION +// // if genesis_validators_root is None: -// genesis_validators_root = Root() # all bytes zero by default +// +// genesis_validators_root = Root() # all bytes zero by default +// // fork_data_root = compute_fork_data_root(fork_version, genesis_validators_root) // return Domain(domain_type + fork_data_root[:28]) // @@ -126,15 +105,16 @@ func computeDomain(domainType [4]byte, forkVersion [4]byte, genesisValidatorsRoo return domain, nil } -// computeForkDataRoot returns the 32byte fork data root for the ``current_version`` and ``genesis_validators_root``. +// computeForkDataRoot returns the 32byte fork data root for the “current_version“ and “genesis_validators_root“. // This is used primarily in signature domains to avoid collisions across forks/chains. // // Spec pseudocode definition: -// def compute_fork_data_root(current_version: Version, genesis_validators_root: Root) -> Root: -// return hash_tree_root(ForkData( -// current_version=current_version, -// genesis_validators_root=genesis_validators_root, -// )) +// +// def compute_fork_data_root(current_version: Version, genesis_validators_root: Root) -> Root: +// return hash_tree_root(ForkData( +// current_version=current_version, +// genesis_validators_root=genesis_validators_root, +// )) // // https://github.com/ethereum/consensus-specs/blob/5337da5dff85cd584c4330b46a881510c1218ca3/specs/phase0/beacon-chain.md#compute_signing_root func computeForkDataRoot(forkVersion [4]byte, genesisValidatorsRoot [32]byte) ([32]byte, error) { diff --git a/storage/kafka_storage/kafka_storage.go b/storage/kafka_storage/kafka_storage.go index 05139a07..86a408f5 100644 --- a/storage/kafka_storage/kafka_storage.go +++ b/storage/kafka_storage/kafka_storage.go @@ -11,11 +11,11 @@ import ( "strings" "time" - "github.com/lidofinance/dc4bc/client/config" - - "github.com/lidofinance/dc4bc/storage" "github.com/segmentio/kafka-go" "github.com/segmentio/kafka-go/sasl/plain" + + "github.com/lidofinance/dc4bc/client/config" + "github.com/lidofinance/dc4bc/storage" ) const ( diff --git a/storage/kafka_storage/kafka_storage_test.go b/storage/kafka_storage/kafka_storage_test.go index 683fce0d..f17608e6 100644 --- a/storage/kafka_storage/kafka_storage_test.go +++ b/storage/kafka_storage/kafka_storage_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/lidofinance/dc4bc/client/config" + "github.com/stretchr/testify/require" + "github.com/lidofinance/dc4bc/client/config" "github.com/lidofinance/dc4bc/storage" - "github.com/stretchr/testify/require" ) var (