Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: "2"
run:
allow-parallel-runners: true
build-tags:
- integration
- dev
- trace
linters:
enable:
- containedctx
Expand Down
2 changes: 0 additions & 2 deletions core/capabilities/ccip/ccipevm/pluginconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ocrimpls"
)

const defaultCommitGasLimit = 500_000

// InitializePluginConfig returns a PluginConfig for EVM chains.
func InitializePluginConfig(lggr logger.Logger, extraDataCodec ccipocr3.ExtraDataCodecBundle) ccipcommon.PluginConfig {
return ccipcommon.PluginConfig{
Expand Down
1 change: 0 additions & 1 deletion core/capabilities/remote/executable/hasher.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func (r *writeReportExcludeSignaturesHasher) Hash(msg *types.MessageBody) ([32]b
}
default:
return [32]byte{}, fmt.Errorf("unexpected report family: %s", family)

}

req.Payload = payload
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/solana_transaction_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestShell_SolanaSendSol(t *testing.T) {
{amount: "0", expErr: "amount must be greater than zero"},
{amount: "asdf", expErr: "invalid amount:"},
} {
tt := tt

t.Run(tt.amount, func(t *testing.T) {
startBal, err := balance(from.PublicKey(), url)
require.NoError(t, err)
Expand All @@ -86,7 +86,7 @@ func TestShell_SolanaSendSol(t *testing.T) {
}

// Check CLI output
require.Greater(t, len(r.Renders), 0)
require.NotEmpty(t, r.Renders)
renderer := r.Renders[len(r.Renders)-1]
renderedMsg := renderer.(*cmd.SolanaMsgPresenter)
t.Logf("%+v\n", renderedMsg)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package types
package types //nolint:revive // meaningless name already referenced

import (
"github.com/ethereum/go-ethereum/common"
Expand Down
24 changes: 12 additions & 12 deletions core/services/chainlink/config_general_dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (

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

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

// Tests in this file only run in dev mode
Expand All @@ -18,7 +16,7 @@ func TestTOMLGeneralConfig_DevModeInsecureConfig(t *testing.T) {
t.Parallel()

t.Run("all insecure configs are false by default", func(t *testing.T) {
config, err := GeneralConfigOpts{}.New(logger.TestLogger(t))
config, err := GeneralConfigOpts{}.New()
require.NoError(t, err)

assert.False(t, config.Insecure().DevWebServer())
Expand All @@ -34,24 +32,26 @@ func TestTOMLGeneralConfig_DevModeInsecureConfig(t *testing.T) {
*c.Insecure.DisableRateLimiting = true
*c.Insecure.InfiniteDepthQueries = true
*c.Insecure.OCRDevelopmentMode = true
}}.New(logger.TestLogger(t))
}}.New()
require.NoError(t, err)

assert.True(t, config.Insecure().DevWebServer())
assert.True(t, config.Insecure().DisableRateLimiting())
assert.True(t, config.Insecure().InfiniteDepthQueries())
assert.True(t, config.OCRDevelopmentMode())
assert.True(t, config.Insecure().OCRDevelopmentMode())
})

t.Run("ParseConfig accepts insecure values on dev builds", func(t *testing.T) {
opts := GeneralConfigOpts{}
err := opts.ParseConfig(`
[insecure]
DevWebServer = true
`)
cfg, err := opts.init()
opts := GeneralConfigOpts{
ConfigStrings: []string{`
[insecure]
DevWebServer = true
`,
},
}
cfg, err := opts.New()
require.NoError(t, err)
err = cfg.c.Validate()
err = cfg.Validate()
require.NoError(t, err)
})
}
12 changes: 0 additions & 12 deletions core/services/gateway/handlers/capabilities/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/network/mocks"
)

const (
defaultSendChannelBufferSize = 1000
privateKey1 = "65456ffb8af4a2b93959256a8e04f6f2fe0943579fb3c9c3350593aabb89023f"
privateKey2 = "65456ffb8af4a2b93959256a8e04f6f2fe0943579fb3c9c3350593aabb89023e"
triggerID1 = "5"
triggerID2 = "6"
workflowID1 = "15c631d295ef5e32deb99a10ee6804bc4af13855687559d7ff6552ac6dbb2ce0"
workflowExecutionID1 = "95ef5e32deb99a10ee6804bc4af13855687559d7ff6552ac6dbb2ce0abbadeed"
owner1 = "0x00000000000000000000000000000000000000aa"
address1 = "0x853d51d5d9935964267a5050aC53aa63ECA39bc5"
)

func setupHandler(t *testing.T) (*handler, *mocks.HTTPClient, *handlermocks.DON, []gwcommon.TestNode) {
lggr := logger.Test(t)
httpClient := mocks.NewHTTPClient(t)
Expand Down
21 changes: 0 additions & 21 deletions core/services/gateway/handlers/vault/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,27 +646,6 @@ func (h *handler) handleSecretsDelete(ctx context.Context, ar *activeRequest) er
return h.fanOutToVaultNodes(ctx, l, ar)
}

func (h *handler) handleSecretsGet(ctx context.Context, ar *activeRequest) error {
l := logger.With(h.lggr, "method", ar.req.Method, "requestID", ar.req.ID)

secretsGetRequest := &vaultcommon.GetSecretsRequest{}
if err := json.Unmarshal(*ar.req.Params, &secretsGetRequest); err != nil {
return h.sendResponse(ctx, ar, h.errorResponse(ar.req, api.UserMessageParseError, err, nil))
}
for _, getRequest := range secretsGetRequest.Requests {
if getRequest.Id != nil && getRequest.Id.Namespace == "" {
getRequest.Id.Namespace = vaulttypes.DefaultNamespace
}
}
err := h.ValidateGetSecretsRequest(secretsGetRequest)
if err != nil {
l.Warnw("failed to validate get secrets request", "error", err)
return h.sendResponse(ctx, ar, h.errorResponse(ar.req, api.InvalidParamsError, fmt.Errorf("failed to validate get secrets request: %w", err), nil))
}

return h.fanOutToVaultNodes(ctx, l, ar)
}

func (h *handler) handleSecretsList(ctx context.Context, ar *activeRequest) error {
l := logger.With(h.lggr, "method", ar.req.Method, "requestID", ar.req.ID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ type HTTPClient interface {
// sets up the initial state, and applies any provided options. The cache must be started via Start()
// before it begins polling and fetching definitions.
func NewChannelDefinitionCache(lggr logger.Logger, orm ChannelDefinitionCacheORM, client HTTPClient, lp logpoller.LogPoller, addr common.Address, donID uint32, fromBlock int64, options ...Option) llotypes.ChannelDefinitionCache {

cdc := &channelDefinitionCache{
orm: orm,
client: client,
Expand Down
1 change: 0 additions & 1 deletion core/services/llo/observation/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ func (d *dataSource) Observe(ctx context.Context, streamValues llo.StreamValues,
// Based on the expected maxObservationDuration determine the pace of the observation loop
// and for how long to cache the observations.
func (d *dataSource) startObservationLoop(loopStartedCh chan struct{}) {

// atomically set the observation loop started flag to true
// or return if it's already started
if !d.observationLoopStarted.CompareAndSwap(false, true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func PackTrigger(id *big.Int, trig triggerWrapper) ([]byte, error) {
}
trigger, err = utilsABI.Pack("_conditionalTrigger", &trig)
case types.LogTrigger:
logTrig := ac.IAutomationV21PlusCommonLogTrigger(trig)
logTrig := trig
trigger, err = utilsABI.Pack("_logTrigger", &logTrig)
default:
err = fmt.Errorf("unknown trigger type: %d", upkeepType)
Expand Down
1 change: 0 additions & 1 deletion core/services/ocr2/plugins/vault/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,6 @@ func (r *ReportingPlugin) ValidateObservation(ctx context.Context, seqNr uint64,
return errors.New("duplicate item found in pending queue item observation")
}
seen[sha] = true

}

return nil
Expand Down
2 changes: 1 addition & 1 deletion core/services/ocr2/plugins/vault/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func TestPlugin_ReportingPluginFactory_UseDKGResult(t *testing.T) {
rpf, err := NewReportingPluginFactory(lggr, store, orm, &dkgrecipientKey, lpk, limits.Factory{Settings: cresettings.DefaultGetter})
require.NoError(t, err)

instanceIDString := string(instanceID)
instanceIDString := instanceID
rpCfg := vaultcommon.ReportingPluginConfig{
DKGInstanceID: &instanceIDString,
}
Expand Down
11 changes: 0 additions & 11 deletions core/services/registrysyncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest"
"github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer"
syncerMocks "github.com/smartcontractkit/chainlink/v2/core/services/registrysyncer/mocks"
captestutils "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/capabilities/testutils"
)

var writeChainCapability = kcr_v1.CapabilitiesRegistryCapability{
Expand Down Expand Up @@ -591,16 +590,6 @@ func TestSyncer_LocalNode(t *testing.T) {
assert.Equal(t, expectedNode, node)
}

// Add this helper struct to implement the ContractReaderFactory interface
type testContractReaderFactory struct {
backendTH *captestutils.EVMBackendTH
t *testing.T
}

func (f *testContractReaderFactory) NewContractReader(ctx context.Context, bytes []byte) (types.ContractReader, error) {
return f.backendTH.NewContractReader(ctx, f.t, bytes)
}

func newTestSyncer(
lggr logger.Logger,
getPeerID func() (p2ptypes.PeerID, error),
Expand Down
11 changes: 5 additions & 6 deletions core/services/relay/dummy/llo_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
relaytypes "github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types"
llotypes "github.com/smartcontractkit/chainlink-common/pkg/types/llo"
)

var _ commontypes.LLOProvider = (*lloProvider)(nil)
var _ types.LLOProvider = (*lloProvider)(nil)

type Transmitter interface {
services.Service
llotypes.Transmitter
}

type lloProvider struct {
cp commontypes.ConfigProvider
cp types.ConfigProvider
transmitter Transmitter
logger logger.Logger
channelDefinitionCache llotypes.ChannelDefinitionCache
Expand All @@ -32,11 +31,11 @@ type lloProvider struct {

func NewLLOProvider(
lggr logger.Logger,
cp commontypes.ConfigProvider,
cp types.ConfigProvider,
transmitter Transmitter,
channelDefinitionCache llotypes.ChannelDefinitionCache,
shouldRetireCache llotypes.ShouldRetireCache,
) relaytypes.LLOProvider {
) types.LLOProvider {
return &lloProvider{
cp,
transmitter,
Expand Down
3 changes: 1 addition & 2 deletions core/services/relay/evm/capabilities/testutils/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient/simulated"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -63,7 +62,7 @@ func NewEVMBackendTH(t *testing.T) *EVMBackendTH {
}

// Setup simulated go-ethereum EVM backend
genesisData := core.GenesisAlloc{
genesisData := ethtypes.GenesisAlloc{
ownerAddress: {Balance: assets.Ether(100000).ToInt()},
}

Expand Down
13 changes: 6 additions & 7 deletions core/services/relay/evm/evmtesting/run_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-common/pkg/types"
clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/types/query"
"github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives"
"github.com/smartcontractkit/chainlink-evm/pkg/read"
Expand Down Expand Up @@ -63,7 +62,7 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa
SubmitTransactionToCW(t, it, cw, "triggerEventWithDynamicTopic", DynamicEvent{Field: anyString}, bindings[0], types.Unconfirmed)

input := struct{ Field string }{Field: anyString}
tp := cr.(clcommontypes.ContractTypeProvider)
tp := cr.(types.ContractTypeProvider)

readName := types.BoundContract{
Address: bindings[0].Address,
Expand Down Expand Up @@ -162,9 +161,9 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa
addr := common.BigToAddress(big.NewInt(42))

ctx := it.Helper.Context(t)
err := reader.Bind(ctx, []clcommontypes.BoundContract{{Name: AnyContractName, Address: addr.Hex()}})
err := reader.Bind(ctx, []types.BoundContract{{Name: AnyContractName, Address: addr.Hex()}})

require.ErrorIs(t, err, read.NoContractExistsError{Err: clcommontypes.ErrInternal, Address: addr})
require.ErrorIs(t, err, read.NoContractExistsError{Err: types.ErrInternal, Address: addr})
},
},
}
Expand Down Expand Up @@ -338,7 +337,7 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac
}
}

func triggerFourTopics[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, i1, i2, i3 int32) {
func triggerFourTopics[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw types.ContractWriter, bindings []types.BoundContract, i1, i2, i3 int32) {
type DynamicEvent struct {
Field1 int32
Field2 int32
Expand All @@ -347,7 +346,7 @@ func triggerFourTopics[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester
SubmitTransactionToCW(t, it, cw, "triggerWithFourTopics", DynamicEvent{Field1: i1, Field2: i2, Field3: i3}, bindings[0], types.Unconfirmed)
}

func triggerFourTopicsWithHashed[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, i1 string, i2 [32]uint8, i3 [32]byte) {
func triggerFourTopicsWithHashed[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw types.ContractWriter, bindings []types.BoundContract, i1 string, i2 [32]uint8, i3 [32]byte) {
type DynamicEvent struct {
Field1 string
Field2 [32]uint8
Expand All @@ -357,7 +356,7 @@ func triggerFourTopicsWithHashed[T TestingT[T]](t T, it *EVMChainComponentsInter
}

// triggerStaticBytes emits a staticBytes events and returns the expected event bytes.
func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, val1, val2, val3 uint32, val4 uint64, val5, val6, val7 [32]byte, raw []byte) {
func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], cw types.ContractWriter, bindings []types.BoundContract, val1, val2, val3 uint32, val4 uint64, val5, val6, val7 [32]byte, raw []byte) {
type StaticBytesEvent struct {
Val1 uint32
Val2 uint32
Expand Down
1 change: 0 additions & 1 deletion core/services/ring/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/cespare/xxhash/v2"
)

var errInvalidRing = errors.New("RingOCR invalid ring for consistent hashing")
var errInvalidMember = errors.New("RingOCR invalid member for consistent hashing")

var ErrNoHealthyShards = errors.New("no healthy shards for routing")
Expand Down
1 change: 0 additions & 1 deletion core/services/workflows/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ type step struct {
workflows.Vertex
capability capabilities.ExecutableCapability
info capabilities.CapabilityInfo
config *values.Map
}

type triggerCapability struct {
Expand Down
1 change: 0 additions & 1 deletion core/services/workflows/syncer/engine_registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
func TestEngineRegistry(t *testing.T) {
var srv services.Service = &fakeService{}

const id1 = "foo"
owner := []byte{1, 2, 3, 4, 5}
name := "my-workflow"
workflowID := types.WorkflowID([32]byte{0, 1, 2, 3, 4})
Expand Down
2 changes: 1 addition & 1 deletion core/web/jobs_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ func TestJobsController_Update_NonExistentID(t *testing.T) {
DS1BridgeName: bridge2.Name.String(),
DS2BridgeName: bridge.Name.String(),
Name: "updated OCR job",
TransmitterAddress: app.Keys[0].EIP55Address.String(),
TransmitterAddress: app.Keys[0].String(),
EVMChainID: cltest.FixtureChainID.String(),
})
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion core/web/nodes_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type NodesController interface {
}

type NetworkScopedNodeStatuser struct {
network string
relayers chainlink.RelayerChainInteroperators
}

Expand Down
3 changes: 1 addition & 2 deletions core/web/resolver/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"net/url"
"testing"

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

Expand Down Expand Up @@ -369,7 +368,7 @@ func Test_DeleteBridgeMutation(t *testing.T) {

link := assets.Link{}
err = json.Unmarshal([]byte(`"1"`), &link)
assert.NoError(t, err)
require.NoError(t, err)

mutation := `
mutation DeleteBridge($id: ID!) {
Expand Down
Loading
Loading