From 7f6575eedfa3e050acc861ef09dedf1d447960e3 Mon Sep 17 00:00:00 2001 From: Cihat Imamoglu Date: Mon, 2 Oct 2023 10:04:10 +0300 Subject: [PATCH] Fix imports --- http/validators.go | 5 ++--- mock/validators.go | 2 +- multi/validators.go | 3 +-- service.go | 3 +-- testclients/erroring.go | 3 +-- testclients/sleepy.go | 3 +-- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/http/validators.go b/http/validators.go index 17a392a4..9a974b82 100644 --- a/http/validators.go +++ b/http/validators.go @@ -20,7 +20,6 @@ import ( "strings" api "github.com/attestantio/go-eth2-client/api/v1" - v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" "github.com/pkg/errors" ) @@ -72,7 +71,7 @@ func (s *Service) indexChunkSize(ctx context.Context) int { // stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". // validatorIndices is a list of validators to restrict the returned values. If no validators are supplied no filter will be applied. // validatorStates is a list of validator states to restrict the returned values. If no states are supplied no filter will be applied. -func (s *Service) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []v1.ValidatorState) (map[phase0.ValidatorIndex]*api.Validator, error) { +func (s *Service) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []api.ValidatorState) (map[phase0.ValidatorIndex]*api.Validator, error) { if stateID == "" { return nil, errors.New("no state ID specified") } @@ -181,7 +180,7 @@ func (s *Service) validatorsFromState(ctx context.Context, stateID string) (map[ } // chunkedValidators obtains the validators a chunk at a time. -func (s *Service) chunkedValidators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []v1.ValidatorState) (map[phase0.ValidatorIndex]*api.Validator, error) { +func (s *Service) chunkedValidators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []api.ValidatorState) (map[phase0.ValidatorIndex]*api.Validator, error) { res := make(map[phase0.ValidatorIndex]*api.Validator) indexChunkSize := s.indexChunkSize(ctx) for i := 0; i < len(validatorIndices); i += indexChunkSize { diff --git a/mock/validators.go b/mock/validators.go index 4c9ac1d5..d9da02f3 100644 --- a/mock/validators.go +++ b/mock/validators.go @@ -24,6 +24,6 @@ import ( // stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". // validatorIndices is a list of validator indices to restrict the returned values. If no validators IDs are supplied no filter // will be applied. -func (s *Service) Validators(_ context.Context, _ string, _ []phase0.ValidatorIndex) (map[phase0.ValidatorIndex]*api.Validator, error) { +func (s *Service) Validators(_ context.Context, _ string, _ []phase0.ValidatorIndex, _ []api.ValidatorState) (map[phase0.ValidatorIndex]*api.Validator, error) { return map[phase0.ValidatorIndex]*api.Validator{}, nil } diff --git a/multi/validators.go b/multi/validators.go index 91fd550a..b4c5dc58 100644 --- a/multi/validators.go +++ b/multi/validators.go @@ -18,7 +18,6 @@ import ( consensusclient "github.com/attestantio/go-eth2-client" api "github.com/attestantio/go-eth2-client/api/v1" - v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec/phase0" ) @@ -30,7 +29,7 @@ import ( func (s *Service) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, - validatorStates []v1.ValidatorState, + validatorStates []api.ValidatorState, ) ( map[phase0.ValidatorIndex]*api.Validator, error, diff --git a/service.go b/service.go index 8f069baf..ccd6230b 100644 --- a/service.go +++ b/service.go @@ -19,7 +19,6 @@ import ( api "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" - v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/capella" @@ -371,7 +370,7 @@ type ValidatorsProvider interface { // will be applied. // validatorStates is a list of validator states to restrict the returned values. If no validators states are supplied no filter // will be applied. - Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []v1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) + Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []apiv1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) // ValidatorsByPubKey provides the validators, with their balance and status, for a given state. // stateID can be a slot number or state root, or one of the special values "genesis", "head", "justified" or "finalized". diff --git a/testclients/erroring.go b/testclients/erroring.go index 854e219a..9d58007f 100644 --- a/testclients/erroring.go +++ b/testclients/erroring.go @@ -23,7 +23,6 @@ import ( consensusclient "github.com/attestantio/go-eth2-client" "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" - v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/altair" "github.com/attestantio/go-eth2-client/spec/deneb" @@ -583,7 +582,7 @@ func (s *Erroring) ValidatorBalances(ctx context.Context, stateID string, valida // will be applied. // validatorStates is a list of validator states to restrict the returned values. If no validators states are supplied no filter // will be applied. -func (s *Erroring) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []v1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) { +func (s *Erroring) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []apiv1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) { if err := s.maybeError(ctx); err != nil { return nil, err } diff --git a/testclients/sleepy.go b/testclients/sleepy.go index fd1ac4f0..77ba87cb 100644 --- a/testclients/sleepy.go +++ b/testclients/sleepy.go @@ -23,7 +23,6 @@ import ( consensusclient "github.com/attestantio/go-eth2-client" "github.com/attestantio/go-eth2-client/api" apiv1 "github.com/attestantio/go-eth2-client/api/v1" - v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/attestantio/go-eth2-client/spec" "github.com/attestantio/go-eth2-client/spec/deneb" "github.com/attestantio/go-eth2-client/spec/phase0" @@ -398,7 +397,7 @@ func (s *Sleepy) ValidatorBalances(ctx context.Context, stateID string, validato // will be applied. // validatorStates is a list of validator states to restrict the returned values. If no validators states are supplied no filter // will be applied. -func (s *Sleepy) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []v1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) { +func (s *Sleepy) Validators(ctx context.Context, stateID string, validatorIndices []phase0.ValidatorIndex, validatorStates []apiv1.ValidatorState) (map[phase0.ValidatorIndex]*apiv1.Validator, error) { s.sleep(ctx) next, isNext := s.next.(consensusclient.ValidatorsProvider) if !isNext {