Skip to content

Commit

Permalink
fix golangci-linters
Browse files Browse the repository at this point in the history
  • Loading branch information
xenowits committed Oct 19, 2023
1 parent f22ac64 commit 9965481
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/eth2wrap/eth2wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ package eth2wrap

import (
"context"
eth2api "github.com/attestantio/go-eth2-client/api"
"net"
"net/url"
"sync"
"time"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2http "github.com/attestantio/go-eth2-client/http"
"github.com/attestantio/go-eth2-client/spec/bellatrix"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
Expand Down
2 changes: 2 additions & 0 deletions app/eth2wrap/eth2wrap_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions app/eth2wrap/eth2wrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestSyncState(t *testing.T) {

resp, err := eth2Cl.NodeSyncing(context.Background())
require.NoError(t, err)
require.False(t, resp.IsSyncing)
require.False(t, resp.Data.IsSyncing)
}

func TestErrors(t *testing.T) {
Expand Down Expand Up @@ -203,18 +203,6 @@ func TestErrors(t *testing.T) {
require.ErrorContains(t, err, "beacon api slots_per_epoch: context canceled")
})

t.Run("go-eth2-client http error", func(t *testing.T) {
bmock, err := beaconmock.New()
require.NoError(t, err)
eth2Cl, err := eth2wrap.NewMultiHTTP(time.Second, bmock.Address())
require.NoError(t, err)

_, err = eth2Cl.AggregateAttestation(ctx, 0, eth2p0.Root{})
log.Error(ctx, "See this error log for fields", err)
require.Error(t, err)
require.ErrorContains(t, err, "beacon api aggregate_attestation: nok http response")
})

t.Run("zero net op error", func(t *testing.T) {
bmock, err := beaconmock.New()
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion app/eth2wrap/valcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package eth2wrap

import (
"context"
eth2api "github.com/attestantio/go-eth2-client/api"
"sync"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"

"github.com/obolnetwork/charon/app/errors"
Expand Down
2 changes: 1 addition & 1 deletion core/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ package scheduler

import (
"context"
eth2api "github.com/attestantio/go-eth2-client/api"
"math"
"sort"
"sync"
"testing"
"time"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/jonboulle/clockwork"
"github.com/stretchr/testify/require"
Expand Down
1 change: 1 addition & 0 deletions core/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"encoding/json"
"fmt"

eth2api "github.com/attestantio/go-eth2-client/api"

"github.com/obolnetwork/charon/app/errors"
Expand Down
6 changes: 3 additions & 3 deletions core/tracker/tracker_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"reflect"
"testing"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
eth2http "github.com/attestantio/go-eth2-client/http"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -760,7 +760,7 @@ func TestAnalyseFetcherFailed(t *testing.T) {
dutyAtt: {event{
duty: dutyAtt,
step: fetcher,
stepErr: errors.Wrap(eth2http.Error{
stepErr: errors.Wrap(eth2api.Error{
Method: http.MethodGet,
Endpoint: "/eth/v1/validator/attestation_data",
StatusCode: 404,
Expand All @@ -770,7 +770,7 @@ func TestAnalyseFetcherFailed(t *testing.T) {
},
reason: reasonFetcherBN,
failed: true,
err: errors.Wrap(eth2http.Error{
err: errors.Wrap(eth2api.Error{
Method: http.MethodGet,
Endpoint: "/eth/v1/validator/attestation_data",
StatusCode: 404,
Expand Down
2 changes: 1 addition & 1 deletion testutil/beaconmock/beaconmock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package beaconmock_test

import (
"context"
eth2api "github.com/attestantio/go-eth2-client/api"
"testing"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/stretchr/testify/require"

Expand Down
8 changes: 4 additions & 4 deletions testutil/validatormock/attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package validatormock

import (
"context"
"github.com/attestantio/go-eth2-client/api"
"sync"

eth2api "github.com/attestantio/go-eth2-client/api"
eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
"github.com/prysmaticlabs/go-bitfield"
Expand Down Expand Up @@ -195,7 +195,7 @@ func prepareAttesters(ctx context.Context, eth2Cl eth2wrap.Client, vals eth2wrap
return nil, err
}

opts := &api.AttesterDutiesOpts{
opts := &eth2api.AttesterDutiesOpts{
Epoch: epoch,
Indices: vals.Indices(),
}
Expand Down Expand Up @@ -305,7 +305,7 @@ func attest(ctx context.Context, eth2Cl eth2wrap.Client, signFunc SignFunc, slot
datas attDatas
)
for commIdx, duties := range dutyByComm {
opts := &api.AttestationDataOpts{
opts := &eth2api.AttestationDataOpts{
Slot: slot,
CommitteeIndex: commIdx,
}
Expand Down Expand Up @@ -442,7 +442,7 @@ func getAggregateAttestation(ctx context.Context, eth2Cl eth2wrap.Client, datas
return nil, errors.Wrap(err, "hash attestation data")
}

opts := &api.AggregateAttestationOpts{
opts := &eth2api.AggregateAttestationOpts{
Slot: data.Slot,
AttestationDataRoot: root,
}
Expand Down
8 changes: 4 additions & 4 deletions testutil/validatormock/synccomm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ package validatormock

import (
"context"
"github.com/attestantio/go-eth2-client/api"
"sync"

eth2client "github.com/attestantio/go-eth2-client"
eth2api "github.com/attestantio/go-eth2-client/api"
eth2v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/altair"
eth2p0 "github.com/attestantio/go-eth2-client/spec/phase0"
Expand Down Expand Up @@ -231,7 +231,7 @@ func (s *SyncCommMember) Message(ctx context.Context, slot eth2p0.Slot) error {
return s.setBlockRoot(slot, eth2p0.Root{})
}

opts := &api.BeaconBlockRootOpts{Block: "head"}
opts := &eth2api.BeaconBlockRootOpts{Block: "head"}
eth2Resp, err := s.eth2Cl.BeaconBlockRoot(ctx, opts)
if err != nil {
return err
Expand Down Expand Up @@ -260,7 +260,7 @@ func prepareSyncCommDuties(ctx context.Context, eth2Cl eth2wrap.Client, vals eth
return nil, nil
}

opts := &api.SyncCommitteeDutiesOpts{
opts := &eth2api.SyncCommitteeDutiesOpts{
Epoch: epoch,
Indices: vals.Indices(),
}
Expand Down Expand Up @@ -454,7 +454,7 @@ func aggContributions(ctx context.Context, eth2Cl eth2wrap.Client, signFunc Sign
var signedContribAndProofs []*altair.SignedContributionAndProof
for _, selection := range selections {
// Query BN to get sync committee contribution.
opts := &api.SyncCommitteeContributionOpts{
opts := &eth2api.SyncCommitteeContributionOpts{
Slot: selection.Slot,
SubcommitteeIndex: uint64(selection.SubcommitteeIndex),
BeaconBlockRoot: blockRoot,
Expand Down

0 comments on commit 9965481

Please sign in to comment.