diff --git a/.golangci.yml b/.golangci.yml index efba73afc04..ca8cf4dade5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,7 @@ linters: - exportloopref - fatcontext - ginkgolinter + - gocritic - goimports - gosec - loggercheck diff --git a/common/client/node_selector_highest_head_test.go b/common/client/node_selector_highest_head_test.go index ebee3f403e2..9d85c688e05 100644 --- a/common/client/node_selector_highest_head_test.go +++ b/common/client/node_selector_highest_head_test.go @@ -109,7 +109,7 @@ func TestHighestHeadNodeSelectorWithOrder(t *testing.T) { nodes = append(nodes, node) } selector := newNodeSelector(NodeSelectionModeHighestHead, nodes) - //Should select the first node because all things are equal + // Should select the first node because all things are equal assert.Same(t, nodes[0], selector.Select()) }) @@ -128,7 +128,7 @@ func TestHighestHeadNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3} selector := newNodeSelector(NodeSelectionModeHighestHead, nodes) - //Should select the second node as it has the highest priority + // Should select the second node as it has the highest priority assert.Same(t, nodes[1], selector.Select()) }) @@ -147,7 +147,7 @@ func TestHighestHeadNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3} selector := newNodeSelector(NodeSelectionModeHighestHead, nodes) - //Should select the third node as it has the highest head + // Should select the third node as it has the highest head assert.Same(t, nodes[2], selector.Select()) }) @@ -170,7 +170,7 @@ func TestHighestHeadNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3, node4} selector := newNodeSelector(NodeSelectionModeHighestHead, nodes) - //Should select the third node as it has the highest head and will win the priority tie-breaker + // Should select the third node as it has the highest head and will win the priority tie-breaker assert.Same(t, nodes[2], selector.Select()) }) } diff --git a/common/client/node_selector_total_difficulty.go b/common/client/node_selector_total_difficulty.go index 7defcd741ca..3a4b9733f0d 100644 --- a/common/client/node_selector_total_difficulty.go +++ b/common/client/node_selector_total_difficulty.go @@ -41,7 +41,7 @@ func (s totalDifficultyNodeSelector[CHAIN_ID, RPC]) Select() Node[CHAIN_ID, RPC] } } - //If all nodes have td == nil pick one from the nodes that are alive + // If all nodes have td == nil pick one from the nodes that are alive if len(nodes) == 0 { return firstOrHighestPriority(aliveNodes) } diff --git a/common/client/node_selector_total_difficulty_test.go b/common/client/node_selector_total_difficulty_test.go index ed45cfdf9ac..7cd5867ddca 100644 --- a/common/client/node_selector_total_difficulty_test.go +++ b/common/client/node_selector_total_difficulty_test.go @@ -111,7 +111,7 @@ func TestTotalDifficultyNodeSelectorWithOrder(t *testing.T) { nodes = append(nodes, node) } selector := newNodeSelector(NodeSelectionModeTotalDifficulty, nodes) - //Should select the first node because all things are equal + // Should select the first node because all things are equal assert.Same(t, nodes[0], selector.Select()) }) @@ -130,7 +130,7 @@ func TestTotalDifficultyNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3} selector := newNodeSelector(NodeSelectionModeTotalDifficulty, nodes) - //Should select the second node as it has the highest priority + // Should select the second node as it has the highest priority assert.Same(t, nodes[1], selector.Select()) }) @@ -149,7 +149,7 @@ func TestTotalDifficultyNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3} selector := newNodeSelector(NodeSelectionModeTotalDifficulty, nodes) - //Should select the third node as it has the highest td + // Should select the third node as it has the highest td assert.Same(t, nodes[2], selector.Select()) }) @@ -172,7 +172,7 @@ func TestTotalDifficultyNodeSelectorWithOrder(t *testing.T) { nodes := []Node[types.ID, nodeClient]{node1, node2, node3, node4} selector := newNodeSelector(NodeSelectionModeTotalDifficulty, nodes) - //Should select the third node as it has the highest td and will win the priority tie-breaker + // Should select the third node as it has the highest td and will win the priority tie-breaker assert.Same(t, nodes[2], selector.Select()) }) } diff --git a/common/txmgr/confirmer.go b/common/txmgr/confirmer.go index dd3dc4e4b33..a42b5985226 100644 --- a/common/txmgr/confirmer.go +++ b/common/txmgr/confirmer.go @@ -1077,7 +1077,7 @@ func (ec *Confirmer[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Ens "chainLength", head.ChainLength(), } - //Here, we rely on the finalized block provided in the chain instead of the one + // Here, we rely on the finalized block provided in the chain instead of the one //provided via a dedicated method to avoid the false warning of the chain being //too short. When `FinalityTagBypass = true,` HeadTracker tracks `finality depth //+ history depth` to prevent excessive CPU usage. Thus, the provided chain may diff --git a/core/capabilities/ccip/ccip_integration_tests/home_chain_test.go b/core/capabilities/ccip/ccip_integration_tests/home_chain_test.go index 8c8e4f05c38..2d0d2c3ba1c 100644 --- a/core/capabilities/ccip/ccip_integration_tests/home_chain_test.go +++ b/core/capabilities/ccip/ccip_integration_tests/home_chain_test.go @@ -35,7 +35,7 @@ func TestHomeChainReader_ChainConfigs(t *testing.T) { p2pIDs := integrationhelpers.P2pIDsFromInts(arr) uni.AddCapability(p2pIDs) - //==============================Apply configs to Capability Contract================================= + // ==============================Apply configs to Capability Contract================================= encodedChainConfig, err := chainconfig.EncodeChainConfig(chainconfig.ChainConfig{ GasPriceDeviationPPB: cciptypes.NewBigIntFromInt64(1000), DAGasPriceDeviationPPB: cciptypes.NewBigIntFromInt64(1_000_000), @@ -62,7 +62,7 @@ func TestHomeChainReader_ChainConfigs(t *testing.T) { t.Logf("homchain reader is ready") - //================================Test HomeChain Reader=============================== + // ================================Test HomeChain Reader=============================== expectedChainConfigs := map[cciptypes.ChainSelector]ccipreader.ChainConfig{} for _, c := range inputConfig { expectedChainConfigs[cciptypes.ChainSelector(c.ChainSelector)] = ccipreader.ChainConfig{ diff --git a/core/capabilities/ccip/ccip_integration_tests/rmn/rmn_home_test.go b/core/capabilities/ccip/ccip_integration_tests/rmn/rmn_home_test.go index bb12f3f5dc9..95ee77f2a7c 100644 --- a/core/capabilities/ccip/ccip_integration_tests/rmn/rmn_home_test.go +++ b/core/capabilities/ccip/ccip_integration_tests/rmn/rmn_home_test.go @@ -39,7 +39,7 @@ func TestRMNHomeReader_GetRMNNodesInfo(t *testing.T) { observerBitmap2 = 1 ) - //================================Deploy and configure RMNHome=============================== + // ================================Deploy and configure RMNHome=============================== rmnHomeAddress, _, rmnHome, err := rmn_home.DeployRMNHome(uni.Transactor, uni.Backend) require.NoError(t, err) uni.Backend.Commit() @@ -83,7 +83,7 @@ func TestRMNHomeReader_GetRMNNodesInfo(t *testing.T) { require.NoError(t, err1) }) - //================================Test RMNHome Reader=============================== + // ================================Test RMNHome Reader=============================== expectedNodesInfo := integrationhelpers.GenerateExpectedRMNHomeNodesInfo(staticConfig, chainID1) require.Eventually( diff --git a/core/capabilities/ccip/types/mocks/home_chain_reader.go b/core/capabilities/ccip/types/mocks/home_chain_reader.go index 4624332c055..7aa857d46cb 100644 --- a/core/capabilities/ccip/types/mocks/home_chain_reader.go +++ b/core/capabilities/ccip/types/mocks/home_chain_reader.go @@ -20,47 +20,47 @@ type HomeChainReader struct { } func (_m *HomeChainReader) GetChainConfig(chainSelector cciptypes.ChainSelector) (ccipreaderpkg.ChainConfig, error) { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) GetAllChainConfigs() (map[cciptypes.ChainSelector]ccipreaderpkg.ChainConfig, error) { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) GetSupportedChainsForPeer(id types.PeerID) (mapset.Set[cciptypes.ChainSelector], error) { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) GetKnownCCIPChains() (mapset.Set[cciptypes.ChainSelector], error) { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) GetFChain() (map[cciptypes.ChainSelector]int, error) { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) Start(ctx context.Context) error { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) Close() error { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) HealthReport() map[string]error { - //TODO implement me + // TODO implement me panic("implement me") } func (_m *HomeChainReader) Name() string { - //TODO implement me + // TODO implement me panic("implement me") } diff --git a/core/capabilities/integration_tests/framework/peer.go b/core/capabilities/integration_tests/framework/peer.go index 1ea24fba3ca..d97abadf646 100644 --- a/core/capabilities/integration_tests/framework/peer.go +++ b/core/capabilities/integration_tests/framework/peer.go @@ -172,7 +172,7 @@ func NewPeerID() string { peerID := append(libp2pMagic(), privKey[:]...) - return base58.Encode(peerID[:]) + return base58.Encode(peerID) } func libp2pMagic() []byte { diff --git a/core/capabilities/remote/target/endtoend_test.go b/core/capabilities/remote/target/endtoend_test.go index 3b077bbafe0..0cade4f7855 100644 --- a/core/capabilities/remote/target/endtoend_test.go +++ b/core/capabilities/remote/target/endtoend_test.go @@ -436,7 +436,7 @@ func NewPeerID() string { peerID := append(libp2pMagic(), privKey[:]...) - return base58.Encode(peerID[:]) + return base58.Encode(peerID) } func libp2pMagic() []byte { diff --git a/core/capabilities/remote/target/request/server_request_test.go b/core/capabilities/remote/target/request/server_request_test.go index 619142d0a6f..b4bddbc955f 100644 --- a/core/capabilities/remote/target/request/server_request_test.go +++ b/core/capabilities/remote/target/request/server_request_test.go @@ -276,7 +276,7 @@ func NewPeerID() string { peerID := append(libp2pMagic(), privKey[:]...) - return base58.Encode(peerID[:]) + return base58.Encode(peerID) } func libp2pMagic() []byte { diff --git a/core/chains/chain_kv_test.go b/core/chains/chain_kv_test.go index 7c9336285e8..ababb2da3c3 100644 --- a/core/chains/chain_kv_test.go +++ b/core/chains/chain_kv_test.go @@ -44,13 +44,13 @@ func Test_ChainKV(t *testing.T) { assert.NoError(t, err) assert.Len(t, cs, 1) - //List explicit chain + // List explicit chain cs, err = kv.List(testChainID) assert.NoError(t, err) assert.Len(t, cs, 1) assert.Equal(t, testChain, cs[0]) - //List no such id + // List no such id cs, err = kv.List("no such id") assert.Error(t, err) assert.Len(t, cs, 0) diff --git a/core/chains/evm/abi/selector_parser.go b/core/chains/evm/abi/selector_parser.go index 329ed6eb181..74683b0ed28 100644 --- a/core/chains/evm/abi/selector_parser.go +++ b/core/chains/evm/abi/selector_parser.go @@ -112,7 +112,7 @@ func parseCompositeType(unescapedSelector string) ([]abi.ArgumentMarshaling, str // if we're at a delimiter the parameter is unnamed if !(rest[0] == ',' || rest[0] == ')') { // attempt to parse name - name, rest, err = parseIdentifier(rest[:]) + name, rest, err = parseIdentifier(rest) if err != nil { return nil, "", fmt.Errorf("failed to parse name: %v", err) } diff --git a/core/chains/evm/client/chain_client.go b/core/chains/evm/client/chain_client.go index 6a6e89e10b9..ee45226ab16 100644 --- a/core/chains/evm/client/chain_client.go +++ b/core/chains/evm/client/chain_client.go @@ -461,7 +461,7 @@ func (c *chainClient) TransactionReceipt(ctx context.Context, txHash common.Hash if err != nil { return receipt, err } - //return rpc.TransactionReceipt(ctx, txHash) + // return rpc.TransactionReceipt(ctx, txHash) return r.TransactionReceiptGeth(ctx, txHash) } diff --git a/core/chains/evm/client/simulated_backend_client.go b/core/chains/evm/client/simulated_backend_client.go index a831f38d10d..7935434edce 100644 --- a/core/chains/evm/client/simulated_backend_client.go +++ b/core/chains/evm/client/simulated_backend_client.go @@ -483,7 +483,7 @@ func (c *SimulatedBackendClient) BatchCallContext(ctx context.Context, b []rpc.B case <-ctx.Done(): return errors.New("context canceled") default: - //do nothing + // do nothing } for i, elem := range b { diff --git a/core/chains/evm/config/chain_scoped_ocr2_test.go b/core/chains/evm/config/chain_scoped_ocr2_test.go index 5a41b4dedac..338524e3460 100644 --- a/core/chains/evm/config/chain_scoped_ocr2_test.go +++ b/core/chains/evm/config/chain_scoped_ocr2_test.go @@ -9,6 +9,6 @@ import ( ) func Test_ocr2Config(t *testing.T) { - cfg := testutils.NewTestChainScopedConfig(t, nil) //fallback.toml values + cfg := testutils.NewTestChainScopedConfig(t, nil) // fallback.toml values require.Equal(t, uint32(5400000), cfg.EVM().OCR2().Automation().GasLimit()) } diff --git a/core/chains/evm/config/chain_scoped_ocr_test.go b/core/chains/evm/config/chain_scoped_ocr_test.go index e027037031c..59e823f0c56 100644 --- a/core/chains/evm/config/chain_scoped_ocr_test.go +++ b/core/chains/evm/config/chain_scoped_ocr_test.go @@ -10,7 +10,7 @@ import ( ) func Test_ocrConfig(t *testing.T) { - cfg := testutils.NewTestChainScopedConfig(t, nil) //fallback.toml values + cfg := testutils.NewTestChainScopedConfig(t, nil) // fallback.toml values require.Equal(t, uint16(4), cfg.EVM().OCR().ContractConfirmations()) require.Equal(t, mustParseDuration(t, "10s"), cfg.EVM().OCR().ContractTransmitterTransmitTimeout()) diff --git a/core/chains/evm/headtracker/head_saver_test.go b/core/chains/evm/headtracker/head_saver_test.go index 266172b67df..469dc5cb757 100644 --- a/core/chains/evm/headtracker/head_saver_test.go +++ b/core/chains/evm/headtracker/head_saver_test.go @@ -149,7 +149,7 @@ func TestHeadSaver_Load(t *testing.T) { // verify latest head loaded from db verifyLatestHead(latestHead) - //verify latest head loaded from memory store + // verify latest head loaded from memory store latestHead = saver.LatestChain() require.NotNil(t, latestHead) verifyLatestHead(latestHead) diff --git a/core/chains/evm/logpoller/orm_test.go b/core/chains/evm/logpoller/orm_test.go index 6e618ba9cef..326b206d326 100644 --- a/core/chains/evm/logpoller/orm_test.go +++ b/core/chains/evm/logpoller/orm_test.go @@ -1530,7 +1530,7 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { topicC := common.HexToHash("0x000c") topicD := common.HexToHash("0x000d") - //Insert two logs that mimics an oracle request from 2 different addresses (matching will be on topic index 1) + // Insert two logs that mimics an oracle request from 2 different addresses (matching will be on topic index 1) require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1559,19 +1559,19 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { })) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x1"), 1, time.Now(), 0)) - //Get any requestSigA from addressA that do not have a equivalent responseSigA + // Get any requestSigA from addressA that do not have a equivalent responseSigA logs, err := orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigA, responseSigA, 1, addressA, 0, 3, 0) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-A1")) - //Get any requestSigB from addressB that do not have a equivalent responseSigB + // Get any requestSigB from addressB that do not have a equivalent responseSigB logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 1, addressB, 0, 3, 0) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-B1")) - //Insert a log that mimics response for requestID-A1 + // Insert a log that mimics response for requestID-A1 require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1588,18 +1588,18 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { })) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x2"), 2, time.Now(), 0)) - //Should return nothing as requestID-A1 has been fulfilled + // Should return nothing as requestID-A1 has been fulfilled logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigA, responseSigA, 1, addressA, 0, 3, 0) require.NoError(t, err) require.Len(t, logs, 0) - //requestID-B1 should still be unfulfilled + // requestID-B1 should still be unfulfilled logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 1, addressB, 0, 3, 0) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-B1")) - //Insert 3 request from addressC (matching will be on topic index 3) + // Insert 3 request from addressC (matching will be on topic index 3) require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1639,7 +1639,7 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { })) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x3"), 3, time.Now(), 0)) - //Get all unfulfilled requests from addressC, match on topic index 3 + // Get all unfulfilled requests from addressC, match on topic index 3 logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 4, 0) require.NoError(t, err) require.Len(t, logs, 3) @@ -1647,7 +1647,7 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { require.Equal(t, logs[1].Data, []byte("requestID-C2")) require.Equal(t, logs[2].Data, []byte("requestID-C3")) - //Fulfill requestID-C2 + // Fulfill requestID-C2 require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1663,14 +1663,14 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { }, })) - //Verify that requestID-C2 is now fulfilled (not returned) + // Verify that requestID-C2 is now fulfilled (not returned) logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 4, 0) require.NoError(t, err) require.Len(t, logs, 2) require.Equal(t, logs[0].Data, []byte("requestID-C1")) require.Equal(t, logs[1].Data, []byte("requestID-C3")) - //Fulfill requestID-C3 + // Fulfill requestID-C3 require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1686,13 +1686,13 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { }, })) - //Verify that requestID-C3 is now fulfilled (not returned) + // Verify that requestID-C3 is now fulfilled (not returned) logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 4, 0) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-C1")) - //Should return no logs as the number of confirmations is not satisfied + // Should return no logs as the number of confirmations is not satisfied logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 4, 3) require.NoError(t, err) require.Len(t, logs, 0) @@ -1705,7 +1705,7 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x9"), 9, time.Now(), 0)) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x10"), 10, time.Now(), 0)) - //Fulfill requestID-C3 + // Fulfill requestID-C3 require.NoError(t, orm.InsertLogs(ctx, []logpoller.Log{ { EvmChainId: (*ubig.Big)(th.ChainID), @@ -1721,18 +1721,18 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { }, })) - //All logs for addressC should be fulfilled, query should return 0 logs + // All logs for addressC should be fulfilled, query should return 0 logs logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 10, 0) require.NoError(t, err) require.Len(t, logs, 0) - //Should return 1 log as it does not satisfy the required number of confirmations + // Should return 1 log as it does not satisfy the required number of confirmations logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 3, addressC, 0, 10, 3) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-C1")) - //Insert 3 more blocks so that the requestID-C1 has enough confirmations + // Insert 3 more blocks so that the requestID-C1 has enough confirmations require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x11"), 11, time.Now(), 0)) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x12"), 12, time.Now(), 0)) require.NoError(t, orm.InsertBlock(ctx, common.HexToHash("0x13"), 13, time.Now(), 0)) @@ -1741,19 +1741,19 @@ func TestSelectLogsWithSigsExcluding(t *testing.T) { require.NoError(t, err) require.Len(t, logs, 0) - //AddressB should still have an unfulfilled log (requestID-B1) + // AddressB should still have an unfulfilled log (requestID-B1) logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 1, addressB, 0, 3, 0) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-B1")) - //Should return requestID-A1 as the fulfillment event is out of the block range + // Should return requestID-A1 as the fulfillment event is out of the block range logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigA, responseSigA, 1, addressA, 0, 1, 10) require.NoError(t, err) require.Len(t, logs, 1) require.Equal(t, logs[0].Data, []byte("requestID-A1")) - //Should return nothing as requestID-B1 is before the block range + // Should return nothing as requestID-B1 is before the block range logs, err = orm.SelectIndexedLogsWithSigsExcluding(ctx, requestSigB, responseSigB, 1, addressB, 2, 13, 0) require.NoError(t, err) require.Len(t, logs, 0) diff --git a/core/chains/evm/testutils/client.go b/core/chains/evm/testutils/client.go index ba455c08a85..4c281afc125 100644 --- a/core/chains/evm/testutils/client.go +++ b/core/chains/evm/testutils/client.go @@ -30,7 +30,7 @@ func NewEthClientMock(t *testing.T) *evmclmocks.Client { func NewEthClientMockWithDefaultChain(t *testing.T) *evmclmocks.Client { c := NewEthClientMock(t) c.On("ConfiguredChainID").Return(FixtureChainID).Maybe() - //c.On("IsL2").Return(false).Maybe() + // c.On("IsL2").Return(false).Maybe() return c } diff --git a/core/chains/evm/utils/utils.go b/core/chains/evm/utils/utils.go index 708a0ac5ff8..ac82dffea48 100644 --- a/core/chains/evm/utils/utils.go +++ b/core/chains/evm/utils/utils.go @@ -54,7 +54,7 @@ func IsEmptyAddress(addr common.Address) bool { func RandomBytes32() (r [32]byte) { b := make([]byte, 32) - _, _ = rand.Read(b[:]) // Assignment for errcheck. Only used in tests so we can ignore. + _, _ = rand.Read(b) // Assignment for errcheck. Only used in tests so we can ignore. copy(r[:], b) return } diff --git a/core/cmd/blocks_commands_test.go b/core/cmd/blocks_commands_test.go index f7656b94ae1..2a4532549f1 100644 --- a/core/cmd/blocks_commands_test.go +++ b/core/cmd/blocks_commands_test.go @@ -25,18 +25,18 @@ func Test_ReplayFromBlock(t *testing.T) { set := flag.NewFlagSet("test", 0) flagSetApplyFromAction(client.ReplayFromBlock, set, "") - //Incorrect block number + // Incorrect block number require.NoError(t, set.Set("block-number", "0")) c := cli.NewContext(nil, set, nil) require.ErrorContains(t, client.ReplayFromBlock(c), "Must pass a positive value in") - //Incorrect chain ID + // Incorrect chain ID require.NoError(t, set.Set("block-number", "1")) require.NoError(t, set.Set("evm-chain-id", "1")) c = cli.NewContext(nil, set, nil) require.ErrorContains(t, client.ReplayFromBlock(c), "does not match any local chains") - //Correct chain ID + // Correct chain ID require.NoError(t, set.Set("evm-chain-id", "5")) c = cli.NewContext(nil, set, nil) require.NoError(t, client.ReplayFromBlock(c)) @@ -45,7 +45,7 @@ func Test_ReplayFromBlock(t *testing.T) { func Test_FindLCA(t *testing.T) { t.Parallel() - //ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) + // ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Return(big.NewInt(42), nil) app := startNewApplicationV2(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].ChainID = (*ubig.Big)(big.NewInt(5)) c.EVM[0].Enabled = ptr(true) @@ -56,12 +56,12 @@ func Test_FindLCA(t *testing.T) { set := flag.NewFlagSet("test", 0) flagSetApplyFromAction(client.FindLCA, set, "") - //Incorrect chain ID + // Incorrect chain ID require.NoError(t, set.Set("evm-chain-id", "1")) c := cli.NewContext(nil, set, nil) require.ErrorContains(t, client.FindLCA(c), "does not match any local chains") - //Correct chain ID + // Correct chain ID require.NoError(t, set.Set("evm-chain-id", "5")) c = cli.NewContext(nil, set, nil) require.ErrorContains(t, client.FindLCA(c), "FindLCA is only available if LogPoller is enabled") diff --git a/core/cmd/cosmos_node_commands_test.go b/core/cmd/cosmos_node_commands_test.go index 3197c48aa94..f6fa367440c 100644 --- a/core/cmd/cosmos_node_commands_test.go +++ b/core/cmd/cosmos_node_commands_test.go @@ -56,7 +56,7 @@ func TestShell_IndexCosmosNodes(t *testing.T) { assert.Equal(t, string(wantConfig), n.Config) assertTableRenders(t, r) - //Render table and check the fields order + // Render table and check the fields order b := new(bytes.Buffer) rt := cmd.RendererTable{b} require.NoError(t, nodes.RenderTable(rt)) diff --git a/core/cmd/csa_keys_commands_test.go b/core/cmd/csa_keys_commands_test.go index 86e1b7d544f..603e410e199 100644 --- a/core/cmd/csa_keys_commands_test.go +++ b/core/cmd/csa_keys_commands_test.go @@ -128,7 +128,7 @@ func TestShell_ImportExportCsaKey(t *testing.T) { require.NoError(t, utils.JustError(app.GetKeyStore().CSA().Delete(ctx, key.ID()))) requireCSAKeyCount(t, app, 0) - //Import test + // Import test set = flag.NewFlagSet("test CSA import", 0) flagSetApplyFromAction(client.ImportCSAKey, set, "") diff --git a/core/cmd/evm_node_commands_test.go b/core/cmd/evm_node_commands_test.go index 96269c9e028..d743ee28e1b 100644 --- a/core/cmd/evm_node_commands_test.go +++ b/core/cmd/evm_node_commands_test.go @@ -73,7 +73,7 @@ func TestShell_IndexEVMNodes(t *testing.T) { assert.Equal(t, string(wantConfig2), n2.Config) assertTableRenders(t, r) - //Render table and check the fields order + // Render table and check the fields order b := new(bytes.Buffer) rt := cmd.RendererTable{b} require.NoError(t, nodes.RenderTable(rt)) diff --git a/core/cmd/shell.go b/core/cmd/shell.go index 59514d3a1fc..56a7eb001ed 100644 --- a/core/cmd/shell.go +++ b/core/cmd/shell.go @@ -368,7 +368,7 @@ func takeBackupIfVersionUpgrade(dbUrl url.URL, rootDir string, cfg periodicbacku return errors.Wrap(err, "takeBackupIfVersionUpgrade failed") } - //Because backups can take a long time we must start a "fake" health report to prevent + // Because backups can take a long time we must start a "fake" health report to prevent //node shutdown because of healthcheck fail/timeout err = databaseBackup.RunBackup(appv.String()) return err diff --git a/core/cmd/solana_node_commands_test.go b/core/cmd/solana_node_commands_test.go index bc4aa15f7bc..f08fcd7aaf0 100644 --- a/core/cmd/solana_node_commands_test.go +++ b/core/cmd/solana_node_commands_test.go @@ -67,7 +67,7 @@ func TestShell_IndexSolanaNodes(t *testing.T) { assert.Equal(t, string(wantConfig2), n2.Config) assertTableRenders(t, r) - //Render table and check the fields order + // Render table and check the fields order b := new(bytes.Buffer) rt := cmd.RendererTable{b} require.NoError(t, nodes.RenderTable(rt)) diff --git a/core/cmd/starknet_node_commands_test.go b/core/cmd/starknet_node_commands_test.go index 95f712d29bd..dae93682085 100644 --- a/core/cmd/starknet_node_commands_test.go +++ b/core/cmd/starknet_node_commands_test.go @@ -67,7 +67,7 @@ func TestShell_IndexStarkNetNodes(t *testing.T) { assert.Equal(t, string(wantConfig2), n2.Config) assertTableRenders(t, r) - //Render table and check the fields order + // Render table and check the fields order b := new(bytes.Buffer) rt := cmd.RendererTable{b} require.NoError(t, nodes.RenderTable(rt)) diff --git a/core/config/docs/docs.go b/core/config/docs/docs.go index 5a17ab0090a..fed814986ad 100644 --- a/core/config/docs/docs.go +++ b/core/config/docs/docs.go @@ -265,7 +265,7 @@ func parseTOMLDocs(s string) (items []fmt.Stringer, err error) { } } if len(globalTable.codes) == 0 { - //drop it + // drop it items = items[1:] } if len(desc) > 0 { diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index eb25f995052..a6dac7dbc92 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -658,11 +658,11 @@ func setupOCRContracts(t *testing.T) (*bind.TransactOpts, *backends.SimulatedBac max.Sub(max, big.NewInt(1)) ocrContractAddress, _, ocrContract, err := offchainaggregator.DeployOffchainAggregator(owner, b, 1000, // _maximumGasPrice uint32, - 200, //_reasonableGasPrice uint32, + 200, // _reasonableGasPrice uint32, 3.6e7, // 3.6e7 microLINK, or 36 LINK 1e8, // _linkGweiPerObservation uint32, 4e8, // _linkGweiPerTransmission uint32, - linkTokenAddress, //_link common.Address, + linkTokenAddress, // _link common.Address, min, // -2**191 max, // 2**191 - 1 accessAddress, diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index 9160310261f..bb5ae05436d 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -84,7 +84,7 @@ func setupOCR2Contracts(t *testing.T) (*bind.TransactOpts, *backends.SimulatedBa ocrContractAddress, _, ocrContract, err := ocr2aggregator.DeployOCR2Aggregator( owner, b, - linkTokenAddress, //_link common.Address, + linkTokenAddress, // _link common.Address, minAnswer, // -2**191 maxAnswer, // 2**191 - 1 accessAddress, diff --git a/core/services/blockhashstore/test_util.go b/core/services/blockhashstore/test_util.go index 0ab07931295..950fa2b3388 100644 --- a/core/services/blockhashstore/test_util.go +++ b/core/services/blockhashstore/test_util.go @@ -140,7 +140,7 @@ type TestBlockHeaderProvider struct { func (p *TestBlockHeaderProvider) RlpHeadersBatch(ctx context.Context, blockRange []*big.Int) ([][]byte, error) { var headers [][]byte for range blockRange { - var randomBytes [30]byte //random length + var randomBytes [30]byte // random length _, err := rand.Read(randomBytes[:]) if err != nil { return nil, err diff --git a/core/services/ccip/orm_test.go b/core/services/ccip/orm_test.go index e778ddf6ce3..a98b7736d8d 100644 --- a/core/services/ccip/orm_test.go +++ b/core/services/ccip/orm_test.go @@ -324,7 +324,7 @@ func TestORM_InsertTokenPricesWhenExpired(t *testing.T) { require.NoError(t, err) assert.Equal(t, int64(numAddresses), rowsUpdated) - //time.Sleep(100 * time.Millisecond) + // time.Sleep(100 * time.Millisecond) // Insert the second time, no updates, because prices haven't changed rowsUpdated, err = orm.UpsertTokenPricesForDestChain(ctx, destSelector, initTokenUpdates, time.Minute) diff --git a/core/services/fluxmonitorv2/flux_monitor_test.go b/core/services/fluxmonitorv2/flux_monitor_test.go index 0c6edb5ec63..88b364cdeb3 100644 --- a/core/services/fluxmonitorv2/flux_monitor_test.go +++ b/core/services/fluxmonitorv2/flux_monitor_test.go @@ -621,7 +621,7 @@ func TestPollingDeviationChecker_BuffersLogs(t *testing.T) { mock.Anything, contractAddress, uint32(1), - mock.AnythingOfType("int64"), //int64(1), + mock.AnythingOfType("int64"), // int64(1), mock.Anything, ). Return(nil).Once() @@ -660,7 +660,7 @@ func TestPollingDeviationChecker_BuffersLogs(t *testing.T) { mock.Anything, contractAddress, uint32(3), - mock.AnythingOfType("int64"), //int64(2), + mock.AnythingOfType("int64"), // int64(2), mock.Anything, ). Return(nil).Once() @@ -699,7 +699,7 @@ func TestPollingDeviationChecker_BuffersLogs(t *testing.T) { mock.Anything, contractAddress, uint32(4), - mock.AnythingOfType("int64"), //int64(3), + mock.AnythingOfType("int64"), // int64(3), mock.Anything, ). Return(nil). diff --git a/core/services/fluxmonitorv2/integrations_test.go b/core/services/fluxmonitorv2/integrations_test.go index 40bdf71743d..2153d1a5327 100644 --- a/core/services/fluxmonitorv2/integrations_test.go +++ b/core/services/fluxmonitorv2/integrations_test.go @@ -1067,7 +1067,7 @@ ds1 -> ds1_parse -> ds1_multiply assert.Error(t, err, "FA allowed chainlink node to start a new round early") //- finally, ensure it can start a legitimate round after restartDelay is - //reached start an intervening round + // reached start an intervening round submitAnswer(t, answerParams{fa: &fa, roundId: newRound, answer: processedAnswer, from: fa.ned, isNewRound: true, completesAnswer: false}) diff --git a/core/services/keeper/registry_synchronizer_core.go b/core/services/keeper/registry_synchronizer_core.go index a720fa8f13c..e578e126cd9 100644 --- a/core/services/keeper/registry_synchronizer_core.go +++ b/core/services/keeper/registry_synchronizer_core.go @@ -52,7 +52,7 @@ type RegistrySynchronizer struct { orm *ORM logger logger.SugaredLogger wgDone sync.WaitGroup - syncUpkeepQueueSize uint32 //Represents the max number of upkeeps that can be synced in parallel + syncUpkeepQueueSize uint32 // Represents the max number of upkeeps that can be synced in parallel mailMon *mailbox.Monitor } diff --git a/core/services/keystore/eth_test.go b/core/services/keystore/eth_test.go index b27ec54956b..dce11865b28 100644 --- a/core/services/keystore/eth_test.go +++ b/core/services/keystore/eth_test.go @@ -181,13 +181,13 @@ func Test_EthKeyStore(t *testing.T) { require.NoError(t, err) assert.Len(t, keys, 2) - //get enabled addresses for FixtureChainID + // get enabled addresses for FixtureChainID enabledAddresses, err := ethKeyStore.EnabledAddressesForChain(ctx, testutils.FixtureChainID) require.NoError(t, err) require.Len(t, enabledAddresses, 1) require.Equal(t, key.Address, enabledAddresses[0]) - //get enabled addresses for chain 1337 + // get enabled addresses for chain 1337 enabledAddresses, err = ethKeyStore.EnabledAddressesForChain(ctx, big.NewInt(1337)) require.NoError(t, err) require.Len(t, enabledAddresses, 1) diff --git a/core/services/keystore/keys/ocr2key/cosmos_keyring.go b/core/services/keystore/keys/ocr2key/cosmos_keyring.go index 1d1a477f2d0..dc17448880b 100644 --- a/core/services/keystore/keys/ocr2key/cosmos_keyring.go +++ b/core/services/keystore/keys/ocr2key/cosmos_keyring.go @@ -43,7 +43,7 @@ func (ckr *cosmosKeyring) reportToSigData(reportCtx ocrtypes.ReportContext, repo } reportLen := make([]byte, 4) binary.BigEndian.PutUint32(reportLen[0:], uint32(len(report))) - h.Write(reportLen[:]) + h.Write(reportLen) h.Write(report) h.Write(rawReportContext[0][:]) h.Write(rawReportContext[1][:]) diff --git a/core/services/keystore/keys/ocrkey/off_chain_public_key.go b/core/services/keystore/keys/ocrkey/off_chain_public_key.go index cb499412e05..be41c28a471 100644 --- a/core/services/keystore/keys/ocrkey/off_chain_public_key.go +++ b/core/services/keystore/keys/ocrkey/off_chain_public_key.go @@ -47,7 +47,7 @@ func (ocpk *OffChainPublicKey) UnmarshalText(bs []byte) error { if err != nil { return err } - copy(result[:], result[:common.AddressLength]) + copy(result, result[:common.AddressLength]) *ocpk = result return nil } diff --git a/core/services/keystore/keys/p2pkey/key_v2.go b/core/services/keystore/keys/p2pkey/key_v2.go index 6af71d5e2d7..5f796c3ede4 100644 --- a/core/services/keystore/keys/p2pkey/key_v2.go +++ b/core/services/keystore/keys/p2pkey/key_v2.go @@ -66,7 +66,7 @@ func NewV2() (KeyV2, error) { func MustNewV2XXXTestingOnly(k *big.Int) KeyV2 { seed := make([]byte, ed25519.SeedSize) copy(seed, k.Bytes()) - pk := ed25519.NewKeyFromSeed(seed[:]) + pk := ed25519.NewKeyFromSeed(seed) key, err := fromPrivkey(pk) if err != nil { panic(err) diff --git a/core/services/keystore/models_test.go b/core/services/keystore/models_test.go index 8f7881809ea..a828fbbf4f6 100644 --- a/core/services/keystore/models_test.go +++ b/core/services/keystore/models_test.go @@ -106,7 +106,7 @@ func TestKeyRing_Encrypt_Decrypt(t *testing.T) { }) t.Run("test legacy system", func(t *testing.T) { - //Add unsupported keys to raw json + // Add unsupported keys to raw json rawJson, _ := json.Marshal(originalKeyRing.raw()) var allKeys = map[string][]string{ "foo": { @@ -115,19 +115,19 @@ func TestKeyRing_Encrypt_Decrypt(t *testing.T) { } err := json.Unmarshal(rawJson, &allKeys) require.NoError(t, err) - //Add more ocr2 keys + // Add more ocr2 keys newOCR2Key1 := ocrkey.MustNewV2XXXTestingOnly(big.NewInt(5)) newOCR2Key2 := ocrkey.MustNewV2XXXTestingOnly(big.NewInt(6)) allKeys["OCR2"] = append(allKeys["OCR2"], newOCR2Key1.Raw().String()) allKeys["OCR2"] = append(allKeys["OCR2"], newOCR2Key2.Raw().String()) - //Add more p2p keys + // Add more p2p keys newP2PKey1 := p2pkey.MustNewV2XXXTestingOnly(big.NewInt(5)) newP2PKey2 := p2pkey.MustNewV2XXXTestingOnly(big.NewInt(7)) allKeys["P2P"] = append(allKeys["P2P"], newP2PKey1.Raw().String()) allKeys["P2P"] = append(allKeys["P2P"], newP2PKey2.Raw().String()) - //Run legacy system + // Run legacy system newRawJson, _ := json.Marshal(allKeys) err = originalKeyRing.LegacyKeys.StoreUnsupported(newRawJson, originalKeyRing) require.NoError(t, err) @@ -140,14 +140,14 @@ func TestKeyRing_Encrypt_Decrypt(t *testing.T) { err = json.Unmarshal(unloadedKeysJson, &shouldHaveAllKeys) require.NoError(t, err) - //Check if keys where added to the raw json + // Check if keys where added to the raw json require.Equal(t, shouldHaveAllKeys["foo"], []string{"bar", "biz"}) require.Contains(t, shouldHaveAllKeys["OCR2"], newOCR2Key1.Raw().String()) require.Contains(t, shouldHaveAllKeys["OCR2"], newOCR2Key2.Raw().String()) require.Contains(t, shouldHaveAllKeys["P2P"], newP2PKey1.Raw().String()) require.Contains(t, shouldHaveAllKeys["P2P"], newP2PKey2.Raw().String()) - //Check error + // Check error err = originalKeyRing.LegacyKeys.StoreUnsupported(newRawJson, nil) require.Error(t, err) _, err = originalKeyRing.LegacyKeys.UnloadUnsupported(nil) diff --git a/core/services/keystore/p2p.go b/core/services/keystore/p2p.go index e4dc7b0ff39..bf7437ac3e6 100644 --- a/core/services/keystore/p2p.go +++ b/core/services/keystore/p2p.go @@ -173,7 +173,7 @@ func (ks *p2p) GetOrFirst(id p2pkey.PeerID) (p2pkey.KeyV2, error) { for _, key := range ks.keyRing.P2P { possibleKeys = append(possibleKeys, key.ID()) } - //To avoid ambiguity, we require the user to specify a peer ID if there are multiple keys + // To avoid ambiguity, we require the user to specify a peer ID if there are multiple keys return p2pkey.KeyV2{}, errors.New( "multiple p2p keys found but peer ID was not set - you must specify a P2P.PeerID " + "config var if you have more than one key, or delete the keys you aren't using" + diff --git a/core/services/keystore/p2p_test.go b/core/services/keystore/p2p_test.go index f6c86a12814..d18179d1f80 100644 --- a/core/services/keystore/p2p_test.go +++ b/core/services/keystore/p2p_test.go @@ -146,7 +146,7 @@ func Test_P2PKeyStore_E2E(t *testing.T) { require.NoError(t, err) _, err = ks.GetOrFirst(p2pkey.PeerID{}) require.Contains(t, err.Error(), "multiple p2p keys found") - //Check for possible keys in error message + // Check for possible keys in error message require.Contains(t, err.Error(), k1.ID()) require.Contains(t, err.Error(), k2.ID()) require.Contains(t, err.Error(), k3.ID()) diff --git a/core/services/ocr/database_test.go b/core/services/ocr/database_test.go index 12f9309450c..e22b592da76 100644 --- a/core/services/ocr/database_test.go +++ b/core/services/ocr/database_test.go @@ -172,7 +172,7 @@ func assertPendingTransmissionEqual(t *testing.T, pt1, pt2 ocrtypes.PendingTrans require.Equal(t, pt1.Rs, pt2.Rs) require.Equal(t, pt1.Ss, pt2.Ss) assert.True(t, bytes.Equal(pt1.Vs[:], pt2.Vs[:])) - assert.True(t, bytes.Equal(pt1.SerializedReport[:], pt2.SerializedReport[:])) + assert.True(t, bytes.Equal(pt1.SerializedReport, pt2.SerializedReport)) assert.Equal(t, pt1.Median, pt2.Median) for i := range pt1.Ss { assert.True(t, bytes.Equal(pt1.Ss[i][:], pt2.Ss[i][:])) diff --git a/core/services/ocr2/database.go b/core/services/ocr2/database.go index 83ee3240a46..919d8ff5741 100644 --- a/core/services/ocr2/database.go +++ b/core/services/ocr2/database.go @@ -219,7 +219,7 @@ func (d *db) StorePendingTransmission(ctx context.Context, t ocrtypes.ReportTime copy(digest, t.ConfigDigest[:]) extraHash := make([]byte, 32) - copy(extraHash[:], tx.ExtraHash[:]) + copy(extraHash, tx.ExtraHash[:]) stmt := ` INSERT INTO ocr2_pending_transmissions ( diff --git a/core/services/ocr2/delegate.go b/core/services/ocr2/delegate.go index cf45822cb37..ce2ad8ae763 100644 --- a/core/services/ocr2/delegate.go +++ b/core/services/ocr2/delegate.go @@ -682,7 +682,7 @@ func (d *Delegate) newServicesGenericPlugin( if ok { providerClientConn = providerConn.ClientConn() } else { - //We chose to deal with the difference between a LOOP provider and an embedded provider here rather than + // We chose to deal with the difference between a LOOP provider and an embedded provider here rather than //in NewServerAdapter because this has a smaller blast radius, as the scope of this workaround is to //enable the medianpoc for EVM and not touch the other providers. //TODO: remove this workaround when the EVM relayer is running inside of an LOOPP @@ -754,7 +754,7 @@ func (d *Delegate) newServicesGenericPlugin( srvs = append(srvs, job.NewServiceAdapter(oracle)) case 3: - //OCR3 with OCR2 OnchainKeyring and ContractTransmitter + // OCR3 with OCR2 OnchainKeyring and ContractTransmitter plugin := ocr3.NewLOOPPService( pluginLggr, grpcOpts, diff --git a/core/services/ocr2/plugins/ccip/ccipexec/gashelpers_test.go b/core/services/ocr2/plugins/ccip/ccipexec/gashelpers_test.go index 15607cc310e..afcd580e24b 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/gashelpers_test.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/gashelpers_test.go @@ -170,7 +170,7 @@ func TestWaitBoostedFee(t *testing.T) { assert.Equal(t, diff, tc.diff) // we check that the actual diff is approximately equals to expected diff, // as we might get slightly different results locally vs. CI therefore normal Equal() would be unstable - //diffUpperLimit := big.NewInt(0).Add(tc.diff, big.NewInt(1e9)) + // diffUpperLimit := big.NewInt(0).Add(tc.diff, big.NewInt(1e9)) //diffLowerLimit := big.NewInt(0).Add(tc.diff, big.NewInt(-1e9)) //require.Equalf(t, -1, diff.Cmp(diffUpperLimit), "actual diff (%s) is larger than expected (%s)", diff.String(), diffUpperLimit.String()) //require.Equal(t, 1, diff.Cmp(diffLowerLimit), "actual diff (%s) is smaller than expected (%s)", diff.String(), diffLowerLimit.String()) diff --git a/core/services/ocr2/plugins/ccip/ccipexec/inflight.go b/core/services/ocr2/plugins/ccip/ccipexec/inflight.go index c76bfdf7780..8eb62c37a24 100644 --- a/core/services/ocr2/plugins/ccip/ccipexec/inflight.go +++ b/core/services/ocr2/plugins/ccip/ccipexec/inflight.go @@ -40,7 +40,7 @@ func (container *inflightExecReportsContainer) getAll() []InflightInternalExecut defer container.locker.RUnlock() reports := make([]InflightInternalExecutionReport, len(container.reports)) - copy(reports[:], container.reports[:]) + copy(reports, container.reports) return reports } diff --git a/core/services/ocr2/plugins/ccip/clo_ccip_integration_test.go b/core/services/ocr2/plugins/ccip/clo_ccip_integration_test.go index 0a7594324bd..bb19d4c92ba 100644 --- a/core/services/ocr2/plugins/ccip/clo_ccip_integration_test.go +++ b/core/services/ocr2/plugins/ccip/clo_ccip_integration_test.go @@ -50,7 +50,7 @@ func Test_CLOSpecApprovalFlow_dynamicPriceGetter(t *testing.T) { ccip.DefaultDestFinalityDepth, ) - //Set up the aggregators here to avoid modifying ccipTH. + // Set up the aggregators here to avoid modifying ccipTH. dstLinkAddr := ccipTH.Dest.LinkToken.Address() srcNativeAddr, err := ccipTH.Source.Router.GetWrappedNative(nil) require.NoError(t, err) diff --git a/core/services/ocr2/plugins/ccip/internal/ccipcalc/calc.go b/core/services/ocr2/plugins/ccip/internal/ccipcalc/calc.go index 8ba57e77ed2..7b503ab12eb 100644 --- a/core/services/ocr2/plugins/ccip/internal/ccipcalc/calc.go +++ b/core/services/ocr2/plugins/ccip/internal/ccipcalc/calc.go @@ -38,7 +38,7 @@ func BigIntSortedMiddle(vals []*big.Int) *big.Int { } valsCopy := make([]*big.Int, len(vals)) - copy(valsCopy[:], vals[:]) + copy(valsCopy, vals) sort.Slice(valsCopy, func(i, j int) bool { return valsCopy[i].Cmp(valsCopy[j]) == -1 }) diff --git a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go index 952cfe2c9e2..64d3b5d26c1 100644 --- a/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go +++ b/core/services/ocr2/plugins/ccip/testhelpers/testhelpers_1_4_0/ccip_contracts_1_4_0.go @@ -689,7 +689,7 @@ func (c *CCIPContracts) SetupLockAndMintTokenPool( return [20]byte{}, nil, err } - //native token is used as fee token + // native token is used as fee token _, err = c.Source.PriceRegistry.UpdatePrices(c.Source.User, price_registry_1_2_0.InternalPriceUpdates{ TokenPriceUpdates: []price_registry_1_2_0.InternalTokenPriceUpdate{ { diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core/payload.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core/payload.go index 5077e7b74d5..15f11f526ac 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core/payload.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/core/payload.go @@ -20,7 +20,7 @@ func UpkeepWorkID(uid ocr2keepers.UpkeepIdentifier, trigger ocr2keepers.Trigger) triggerExtBytes = trigger.LogTriggerExtension.LogIdentifier() } hash := crypto.Keccak256(append(uid[:], triggerExtBytes...)) - return hex.EncodeToString(hash[:]) + return hex.EncodeToString(hash) } func NewUpkeepPayload(id *big.Int, trigger ocr2keepers.Trigger, checkData []byte) (ocr2keepers.UpkeepPayload, error) { diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v03/request.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v03/request.go index c2ffb2172b0..3ade8cc7261 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v03/request.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v03/request.go @@ -108,7 +108,7 @@ func (c *client) DoRequest(ctx context.Context, streamsLookup *mercury.StreamsLo func (c *client) multiFeedsRequest(ctx context.Context, ch chan<- mercury.MercuryData, sl *mercury.StreamsLookup) { // this won't work bc q.Encode() will encode commas as '%2C' but the server is strictly expecting a comma separated list - //q := url.Values{ + // q := url.Values{ // feedIDs: {strings.Join(sl.Feeds, ",")}, // timestamp: {sl.Time.String()}, //} diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/upkeepstate/store_test.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/upkeepstate/store_test.go index eae92aeca35..c65a34598cc 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/upkeepstate/store_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/upkeepstate/store_test.go @@ -516,7 +516,7 @@ func (s *mockScanner) ScanWorkIDs(context.Context, ...string) ([]string, error) s.lock.Lock() defer s.lock.Unlock() - res := s.workIDs[:] + res := s.workIDs s.workIDs = nil return res, s.err } @@ -559,7 +559,7 @@ func (_m *mockORM) SelectStatesByWorkIDs(ctx context.Context, workIDs []string) _m.lock.Lock() defer _m.lock.Unlock() - res := _m.records[:] + res := _m.records _m.records = nil return res, _m.err diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go index 00c1469abab..d0cea4a721a 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go @@ -565,7 +565,7 @@ func listenPerformedN(t *testing.T, backend *backends.SimulatedBackend, registry if iter.Event != nil { t.Logf("[automation-ocr3 | EvmRegistry] upkeep performed event emitted for id %s", iter.Event.Id.String()) - //cache.Store(iter.Event.Id.String(), true) + // cache.Store(iter.Event.Id.String(), true) count, ok := cache.Load(iter.Event.Id.String()) if !ok { cache.Store(iter.Event.Id.String(), 1) diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_test.go index 6ce0532f1b6..16f7f3ba398 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_test.go @@ -663,7 +663,7 @@ func TestIntegration_KeeperPluginForwarderEnabled(t *testing.T) { require.NoError(t, err) backend.Commit() - //Set upkeep to be performed + // Set upkeep to be performed _, err = upkeepContract.SetBytesToSend(carrol, payload1) require.NoError(t, err) _, err = upkeepContract.SetShouldPerformUpkeep(carrol, true) diff --git a/core/services/ocr2/plugins/threshold/plugin.go b/core/services/ocr2/plugins/threshold/plugin.go index ae9efa1ee5f..79a6ee85e1f 100644 --- a/core/services/ocr2/plugins/threshold/plugin.go +++ b/core/services/ocr2/plugins/threshold/plugin.go @@ -54,8 +54,8 @@ func NewThresholdService(sharedOracleArgs *libocr2.OCR2OracleArgs, conf *Thresho } type KeyshareWithPubKey struct { - PublicKey json.RawMessage //tdh2easy.PublicKey - PrivateKeyShare json.RawMessage //tdh2easy.PrivateShare + PublicKey json.RawMessage // tdh2easy.PublicKey + PrivateKeyShare json.RawMessage // tdh2easy.PrivateShare } func UnmarshalKeys(raw []byte) (publicKey tdh2easy.PublicKey, privateShare tdh2easy.PrivateShare, err error) { diff --git a/core/services/ocr2/testhelpers/onchain_config.go b/core/services/ocr2/testhelpers/onchain_config.go index ec7e619b936..a2cb6f91f29 100644 --- a/core/services/ocr2/testhelpers/onchain_config.go +++ b/core/services/ocr2/testhelpers/onchain_config.go @@ -9,19 +9,19 @@ import ( func GenerateDefaultOCR2OnchainConfig(minValue *big.Int, maxValue *big.Int) ([]byte, error) { serializedConfig := make([]byte, 0) - s1, err := bigbigendian.SerializeSigned(1, big.NewInt(1)) //version + s1, err := bigbigendian.SerializeSigned(1, big.NewInt(1)) // version if err != nil { return nil, err } serializedConfig = append(serializedConfig, s1...) - s2, err := bigbigendian.SerializeSigned(24, minValue) //min + s2, err := bigbigendian.SerializeSigned(24, minValue) // min if err != nil { return nil, err } serializedConfig = append(serializedConfig, s2...) - s3, err := bigbigendian.SerializeSigned(24, maxValue) //max + s3, err := bigbigendian.SerializeSigned(24, maxValue) // max if err != nil { return nil, err } diff --git a/core/services/ocr2/validate/validate.go b/core/services/ocr2/validate/validate.go index cf126fc1615..d631e3761c8 100644 --- a/core/services/ocr2/validate/validate.go +++ b/core/services/ocr2/validate/validate.go @@ -271,7 +271,7 @@ func validateGenericPluginSpec(ctx context.Context, spec *job.OCR2OracleSpec, rc } loopID := fmt.Sprintf("%s-%s-%s", p.PluginName, spec.ContractID, spec.GetID()) - //Starting and stopping a LOOPP isn't efficient; ideally, we'd initiate the LOOPP once and then reference + // Starting and stopping a LOOPP isn't efficient; ideally, we'd initiate the LOOPP once and then reference //it later to conserve resources. This code will be revisited once BCF-3126 is implemented, and we have //the ability to reference the LOOPP for future use. cmdFn, grpcOpts, err := rc.RegisterLOOP(plugins.CmdConfig{ diff --git a/core/services/registrysyncer/syncer.go b/core/services/registrysyncer/syncer.go index d4f343f12bf..40d105e2b8e 100644 --- a/core/services/registrysyncer/syncer.go +++ b/core/services/registrysyncer/syncer.go @@ -352,7 +352,7 @@ func deepCopyLocalRegistry(lr *LocalRegistry) LocalRegistry { capCfgs := make(map[string]CapabilityConfiguration, len(don.CapabilityConfigurations)) for capID, capCfg := range don.CapabilityConfigurations { capCfgs[capID] = CapabilityConfiguration{ - Config: capCfg.Config[:], + Config: capCfg.Config, } } lrCopy.IDsToDONs[id] = DON{ diff --git a/core/services/relay/evm/evmtesting/run_tests.go b/core/services/relay/evm/evmtesting/run_tests.go index 908c4e1a81a..1e3d6ec8edc 100644 --- a/core/services/relay/evm/evmtesting/run_tests.go +++ b/core/services/relay/evm/evmtesting/run_tests.go @@ -235,7 +235,7 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac buf = binary.BigEndian.AppendUint32(buf, val2) buf = binary.BigEndian.AppendUint32(buf, val3) buf = binary.BigEndian.AppendUint64(buf, val4) - dataWordOnChainValueToQuery := buf[:] + dataWordOnChainValueToQuery := buf resExpected := append(buf, common.LeftPadBytes(val5[:], 32)...) resExpected = append(resExpected, common.LeftPadBytes(val6[:], 32)...) diff --git a/core/services/relay/evm/llo/config_poller.go b/core/services/relay/evm/llo/config_poller.go index feeff015862..66d9c185e38 100644 --- a/core/services/relay/evm/llo/config_poller.go +++ b/core/services/relay/evm/llo/config_poller.go @@ -199,7 +199,7 @@ func FullConfigFromProductionConfigSet(unpacked configurator.ConfiguratorProduct var signers []ocrtypes.OnchainPublicKey for _, addr := range unpacked.Signers { addr := addr - signers = append(signers, addr[:]) + signers = append(signers, addr) } donIDBig := common.Hash(unpacked.ConfigId).Big() @@ -231,7 +231,7 @@ func FullConfigFromStagingConfigSet(unpacked configurator.ConfiguratorStagingCon var signers []ocrtypes.OnchainPublicKey for _, addr := range unpacked.Signers { addr := addr - signers = append(signers, addr[:]) + signers = append(signers, addr) } donIDBig := common.Hash(unpacked.ConfigId).Big() diff --git a/core/services/relay/evm/mercury/transmitter.go b/core/services/relay/evm/mercury/transmitter.go index 90b5c7965e5..b55cc8cf028 100644 --- a/core/services/relay/evm/mercury/transmitter.go +++ b/core/services/relay/evm/mercury/transmitter.go @@ -570,7 +570,7 @@ func (mt *mercuryTransmitter) latestReport(ctx context.Context, feedID [32]byte) if resp.Report == nil { s.lggr.Tracew("latestReport success: returned nil") } else if !bytes.Equal(resp.Report.FeedId, feedID[:]) { - err = fmt.Errorf("latestReport failed; mismatched feed IDs, expected: 0x%x, got: 0x%x", mt.feedID[:], resp.Report.FeedId[:]) + err = fmt.Errorf("latestReport failed; mismatched feed IDs, expected: 0x%x, got: 0x%x", mt.feedID[:], resp.Report.FeedId) s.lggr.Errorw("latestReport failed", "err", err) return err } else { diff --git a/core/services/relay/evm/mercury/wsrpc/client_test.go b/core/services/relay/evm/mercury/wsrpc/client_test.go index b4a3dae733d..539148f4ff6 100644 --- a/core/services/relay/evm/mercury/wsrpc/client_test.go +++ b/core/services/relay/evm/mercury/wsrpc/client_test.go @@ -134,7 +134,7 @@ func Test_Client_LatestReport(t *testing.T) { }, { name: "with cache enabled", - ttl: 1000 * time.Hour, //some large value that will never expire during a test + ttl: 1000 * time.Hour, // some large value that will never expire during a test expectedCalls: 1, }, } diff --git a/core/services/relay/evm/ocr3_capability_provider.go b/core/services/relay/evm/ocr3_capability_provider.go index 56a8d37bbe9..00859befe4c 100644 --- a/core/services/relay/evm/ocr3_capability_provider.go +++ b/core/services/relay/evm/ocr3_capability_provider.go @@ -81,7 +81,7 @@ func (d *ocr3CapabilityLogDecoder) Decode(rawLog []byte) (ocrtypes.ContractConfi allPubKeys[raw] = struct{}{} } - signers = append(signers, pubKey[:]) + signers = append(signers, pubKey) } return ocrtypes.ContractConfig{ diff --git a/core/services/relay/evm/types/types.go b/core/services/relay/evm/types/types.go index 2a5e59fe66e..a96dd9f9508 100644 --- a/core/services/relay/evm/types/types.go +++ b/core/services/relay/evm/types/types.go @@ -233,7 +233,7 @@ func NewRelayOpts(args types.RelayArgs) *RelayOpts { func (o *RelayOpts) RelayConfig() (RelayConfig, error) { var empty RelayConfig - //TODO this should be done once and the error should be cached + // TODO this should be done once and the error should be cached if o.c == nil { var c RelayConfig err := json.Unmarshal(o.RelayArgs.RelayConfig, &c) diff --git a/core/services/signatures/ethdss/ethdss_test.go b/core/services/signatures/ethdss/ethdss_test.go index 014f0f94186..4cc203ef400 100644 --- a/core/services/signatures/ethdss/ethdss_test.go +++ b/core/services/signatures/ethdss/ethdss_test.go @@ -283,6 +283,6 @@ func genDistSecret(checkValidPublicKey bool) []*dkg.DistKeyShare { func randomBytes(n int) []byte { var buff = make([]byte, n) - _, _ = rand.Read(buff[:]) + _, _ = rand.Read(buff) return buff } diff --git a/core/services/telemetry/manager_test.go b/core/services/telemetry/manager_test.go index fef065b572c..df8e87018bc 100644 --- a/core/services/telemetry/manager_test.go +++ b/core/services/telemetry/manager_test.go @@ -245,7 +245,7 @@ func TestCorrectEndpointRouting(t *testing.T) { client: clientMock, } } - //Unknown networks or chainID + // Unknown networks or chainID noopEndpoint := tm.GenMonitoringEndpoint("unknown-network", "unknown-chainID", "some-contractID", "some-type") require.Equal(t, "*telemetry.NoopAgent", reflect.TypeOf(noopEndpoint).String()) require.Equal(t, 1, obsLogs.Len()) @@ -261,7 +261,7 @@ func TestCorrectEndpointRouting(t *testing.T) { require.Equal(t, 1, obsLogs.Len()) require.Contains(t, obsLogs.TakeAll()[0].Message, "no telemetry endpoint found") - //Known networks and chainID + // Known networks and chainID for i, e := range testEndpoints { telemType := fmt.Sprintf("TelemType_%s", e.chainID) contractID := fmt.Sprintf("contractID_%s", e.chainID) diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 7f94e98ff9f..7ef3febd021 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -334,7 +334,7 @@ func TestDelegate_ValidLog(t *testing.T) { }).Return(nil).Once() // If we send a completed log we should the respCount increase var reqIDBytes []byte - copy(reqIDBytes[:], tc.reqID[:]) + copy(reqIDBytes, tc.reqID[:]) listener.HandleLog(ctx, log.NewLogBroadcast(types.Log{ // Data has all the NON-indexed parameters Data: bytes.Join([][]byte{reqIDBytes, // output diff --git a/core/services/vrf/v2/integration_v2_plus_test.go b/core/services/vrf/v2/integration_v2_plus_test.go index b4c47c3e0b9..1b2d9fdde88 100644 --- a/core/services/vrf/v2/integration_v2_plus_test.go +++ b/core/services/vrf/v2/integration_v2_plus_test.go @@ -710,7 +710,7 @@ func TestVRFV2PlusIntegration_ExternalOwnerConsumerExample(t *testing.T) { backend.Commit() coordinatorAddress, _, coordinator, err := vrf_coordinator_v2_5.DeployVRFCoordinatorV25( - owner, backend, common.Address{}) //bhs not needed for this test + owner, backend, common.Address{}) // bhs not needed for this test require.NoError(t, err) _, err = coordinator.SetConfig(owner, uint16(1), // minimumRequestConfirmations diff --git a/core/services/workflows/monitoring.go b/core/services/workflows/monitoring.go index 48c1519914f..8f5601554ed 100644 --- a/core/services/workflows/monitoring.go +++ b/core/services/workflows/monitoring.go @@ -15,7 +15,7 @@ import ( var registerTriggerFailureCounter metric.Int64Counter var workflowsRunningGauge metric.Int64Gauge var capabilityInvocationCounter metric.Int64Counter -var workflowExecutionLatencyGauge metric.Int64Gauge //ms +var workflowExecutionLatencyGauge metric.Int64Gauge // ms var workflowStepErrorCounter metric.Int64Counter func initMonitoringResources() (err error) { diff --git a/core/sessions/localauth/reaper.go b/core/sessions/localauth/reaper.go index 7b91e4ce2c0..a3ba1693765 100644 --- a/core/sessions/localauth/reaper.go +++ b/core/sessions/localauth/reaper.go @@ -35,7 +35,7 @@ func (sr *sessionReaper) Name() string { } func (sr *sessionReaper) Work() { - ctx := context.Background() //TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 + ctx := context.Background() // TODO https://smartcontract-it.atlassian.net/browse/BCF-2887 recordCreationStaleThreshold := sr.config.SessionReaperExpiration().Before( sr.config.SessionTimeout().Before(time.Now())) err := sr.deleteStaleSessions(ctx, recordCreationStaleThreshold) diff --git a/core/web/cosmos_transfer_controller.go b/core/web/cosmos_transfer_controller.go index ea2c1cfa2ad..ab3d8c20f30 100644 --- a/core/web/cosmos_transfer_controller.go +++ b/core/web/cosmos_transfer_controller.go @@ -68,7 +68,7 @@ func (tc *CosmosTransfersController) Create(c *gin.Context) { } gasToken = cfgs[i].GasToken() - //TODO move this inside? + // TODO move this inside? coin, err := denom.ConvertDecCoinToDenom(sdk.NewDecCoinFromDec(tr.Token, tr.Amount), gasToken) if err != nil { jsonAPIError(c, http.StatusBadRequest, errors.Errorf("unable to convert %s to %s: %v", tr.Token, gasToken, err)) diff --git a/core/web/health_template_test.go b/core/web/health_template_test.go index fa9750fed22..94bef0ac7cc 100644 --- a/core/web/health_template_test.go +++ b/core/web/health_template_test.go @@ -34,7 +34,7 @@ original error`}, {Name: "foo.bar.2.B", Status: passing}, {Name: "foo.baz", Status: passing}, } - //TODO truncated error + // TODO truncated error } func Test_checkTree_WriteHTMLTo(t *testing.T) { diff --git a/core/web/resolver/query.go b/core/web/resolver/query.go index d3e1215834a..3fe425f290e 100644 --- a/core/web/resolver/query.go +++ b/core/web/resolver/query.go @@ -112,7 +112,7 @@ func (r *Resolver) Chains(ctx context.Context, args struct { count := len(chains) if count == 0 { - //No chains are configured, return an empty ChainsPayload, so we don't break the UI + // No chains are configured, return an empty ChainsPayload, so we don't break the UI return NewChainsPayload(nil, 0), nil } @@ -191,7 +191,7 @@ func (r *Resolver) Job(ctx context.Context, args struct{ ID graphql.ID }) (*JobP return NewJobPayload(r.App, nil, err), nil } - //We still need to show the job in UI/CLI even if the chain id is disabled + // We still need to show the job in UI/CLI even if the chain id is disabled if errors.Is(err, chains.ErrNoSuchChainID) { return NewJobPayload(r.App, &j, err), nil }