Skip to content

Commit

Permalink
golangci-lint: deprecated types (#11044)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Oct 23, 2023
1 parent c1fc9d2 commit 1d7cec6
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 46 deletions.
3 changes: 2 additions & 1 deletion common/headtracker/head_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

htrktypes "github.com/smartcontractkit/chainlink/v2/common/headtracker/types"
"github.com/smartcontractkit/chainlink/v2/common/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

Expand Down
5 changes: 3 additions & 2 deletions common/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
"github.com/google/uuid"
pkgerrors "github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types"
txmgrtypes "github.com/smartcontractkit/chainlink/v2/common/txmgr/types"
"github.com/smartcontractkit/chainlink/v2/common/types"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

Expand All @@ -40,7 +41,7 @@ type TxManager[
FEE feetypes.Fee,
] interface {
types.HeadTrackable[HEAD, BLOCK_HASH]
services.ServiceCtx
services.Service
Trigger(addr ADDR)
CreateTransaction(ctx context.Context, txRequest txmgrtypes.TxRequest[ADDR, TX_HASH]) (etx txmgrtypes.Tx[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE], err error)
GetForwarderForEOA(eoa ADDR) (forwarder ADDR, err error)
Expand Down
3 changes: 1 addition & 2 deletions core/chains/cosmos/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import (
cosmosclient "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/client"
coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/db"
"github.com/smartcontractkit/chainlink/v2/core/services"

relaychains "github.com/smartcontractkit/chainlink-relay/pkg/chains"
"github.com/smartcontractkit/chainlink-relay/pkg/logger"
"github.com/smartcontractkit/chainlink-relay/pkg/loop"
"github.com/smartcontractkit/chainlink-relay/pkg/services"
relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/chains"
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/smartcontractkit/sqlx"

relaychains "github.com/smartcontractkit/chainlink-relay/pkg/chains"
"github.com/smartcontractkit/chainlink-relay/pkg/services"
"github.com/smartcontractkit/chainlink-relay/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/chains"
Expand All @@ -31,7 +32,6 @@ import (
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/utils"
Expand Down
3 changes: 2 additions & 1 deletion core/chains/evm/gas/arbitrum_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types"
"github.com/smartcontractkit/chainlink/v2/core/assets"
evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

Expand Down
7 changes: 4 additions & 3 deletions core/chains/evm/gas/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

commonfee "github.com/smartcontractkit/chainlink/v2/common/fee"
feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types"
commontypes "github.com/smartcontractkit/chainlink/v2/common/types"
Expand All @@ -20,7 +22,6 @@ import (
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/config"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/utils"
bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math"
)
Expand All @@ -29,7 +30,7 @@ import (
//
//go:generate mockery --quiet --name EvmFeeEstimator --output ./mocks/ --case=underscore
type EvmFeeEstimator interface {
services.ServiceCtx
services.Service
commontypes.HeadTrackable[*evmtypes.Head, common.Hash]

// L1Oracle returns the L1 gas price oracle only if the chain has one, e.g. OP stack L2s and Arbitrum.
Expand Down Expand Up @@ -106,7 +107,7 @@ type EvmPriorAttempt struct {
//go:generate mockery --quiet --name EvmEstimator --output ./mocks/ --case=underscore
type EvmEstimator interface {
commontypes.HeadTrackable[*evmtypes.Head, common.Hash]
services.ServiceCtx
services.Service

// GetLegacyGas Calculates initial gas fee for non-EIP1559 transaction
// maxGasPriceWei parameter is the highest possible gas fee cap that the function will return
Expand Down
6 changes: 4 additions & 2 deletions core/chains/evm/headtracker/head_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ import (
gethCommon "github.com/ethereum/go-ethereum/common"
gethTypes "github.com/ethereum/go-ethereum/core/types"
"github.com/onsi/gomega"
"github.com/smartcontractkit/sqlx"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"github.com/smartcontractkit/sqlx"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

commonmocks "github.com/smartcontractkit/chainlink/v2/common/types/mocks"
evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker"
Expand All @@ -30,7 +33,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
"github.com/smartcontractkit/chainlink/v2/core/utils"
Expand Down
11 changes: 0 additions & 11 deletions core/services/checkable.go

This file was deleted.

3 changes: 2 additions & 1 deletion core/services/gateway/connectionmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"go.uber.org/multierr"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/api"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/common"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/config"
Expand Down
4 changes: 2 additions & 2 deletions core/services/gateway/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"sync"
"time"

"github.com/smartcontractkit/chainlink/v2/core/services"

"github.com/gorilla/websocket"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/api"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/network"
Expand Down
4 changes: 2 additions & 2 deletions core/services/gateway/network/wsconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"sync/atomic"

"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/gorilla/websocket"

Expand All @@ -30,7 +30,7 @@ import (
// All methods are thread-safe.
type WSConnectionWrapper interface {
job.ServiceCtx
services.Checkable
services.HealthReporter

// Update underlying connection object. Return a channel that gets an error on connection close.
// Cannot be called after Close().
Expand Down
4 changes: 2 additions & 2 deletions core/services/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import (
"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/logger"
)

var _ Checker = (*services.HealthChecker)(nil)

// Checker provides a service which can be probed for system health.
// Deprecated: use services.HealthChecker
//
//go:generate mockery --quiet --name Checker --output ./mocks/ --case=underscore
type Checker interface {
// Register a service for health checks.
Register(service Checkable) error
Register(service services.HealthReporter) error
// Unregister a service.
Unregister(name string) error
// IsReady returns the current readiness of the system.
Expand Down
6 changes: 4 additions & 2 deletions core/services/job/spawner.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

"github.com/smartcontractkit/sqlx"

relayservices "github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
Expand Down Expand Up @@ -168,7 +170,7 @@ func (js *spawner) stopService(jobID int32) {
for i := len(aj.services) - 1; i >= 0; i-- {
service := aj.services[i]
sLggr := lggr.With("subservice", i, "serviceType", reflect.TypeOf(service))
if c, ok := service.(services.Checkable); ok {
if c, ok := service.(relayservices.HealthReporter); ok {
if err := js.checker.Unregister(c.Name()); err != nil {
sLggr.Warnw("Failed to unregister service from health checker", "err", err)
}
Expand Down Expand Up @@ -228,7 +230,7 @@ func (js *spawner) StartService(ctx context.Context, jb Job, qopts ...pg.QOpt) e
lggr.Criticalw("Error starting service for job", "err", err)
return err
}
if c, ok := srv.(services.Checkable); ok {
if c, ok := srv.(relayservices.HealthReporter); ok {
err = js.checker.Register(c)
if err != nil {
lggr.Errorw("Error registering service with health checker", "err", err)
Expand Down
6 changes: 2 additions & 4 deletions core/services/job/spawner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"testing"
"time"

"github.com/smartcontractkit/chainlink/v2/core/services"

"github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand All @@ -14,7 +12,7 @@ import (
"github.com/smartcontractkit/sqlx"

"github.com/smartcontractkit/chainlink-relay/pkg/loop"

"github.com/smartcontractkit/chainlink-relay/pkg/services"
"github.com/smartcontractkit/chainlink/v2/core/bridges"
mocklp "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
Expand Down Expand Up @@ -334,7 +332,7 @@ func TestSpawner_CreateJobDeleteJob(t *testing.T) {

type noopChecker struct{}

func (n noopChecker) Register(service services.Checkable) error { return nil }
func (n noopChecker) Register(service services.HealthReporter) error { return nil }

func (n noopChecker) Unregister(name string) error { return nil }

Expand Down
9 changes: 4 additions & 5 deletions core/services/promreporter/prom_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ import (
"testing"
"time"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2"
"github.com/smartcontractkit/chainlink/v2/core/services/promreporter"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/mocks"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/promreporter"
"github.com/smartcontractkit/chainlink/v2/core/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
"github.com/smartcontractkit/sqlx"

"github.com/smartcontractkit/chainlink-relay/pkg/services"
relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types"

txmgrcommon "github.com/smartcontractkit/chainlink/v2/common/txmgr"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm"
txm "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore"
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
Expand Down
4 changes: 2 additions & 2 deletions core/services/relay/evm/mercury/transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"github.com/smartcontractkit/sqlx"

relaymercury "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury"
"github.com/smartcontractkit/chainlink-relay/pkg/services"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
mercuryutils "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/utils"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury/wsrpc"
Expand Down Expand Up @@ -70,7 +70,7 @@ var (

type Transmitter interface {
relaymercury.Transmitter
services.ServiceCtx
services.Service
}

type ConfigTracker interface {
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/mercury_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
relaymercuryv1 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v1"
relaymercuryv2 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v2"
relaymercuryv3 "github.com/smartcontractkit/chainlink-relay/pkg/reportingplugins/mercury/v3"
"github.com/smartcontractkit/chainlink-relay/pkg/services"
relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services"
"github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/mercury"
)

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type ServerAdapter struct {
}

// NewServerAdapter returns a new ServerAdapter.
func NewServerAdapter(r types.Relayer, e loop.RelayerExt) *ServerAdapter {
func NewServerAdapter(r types.Relayer, e loop.RelayerExt) *ServerAdapter { //nolint:staticcheck
return &ServerAdapter{RelayerAdapter: loop.RelayerAdapter{Relayer: r, RelayerExt: e}}
}

Expand Down

0 comments on commit 1d7cec6

Please sign in to comment.