diff --git a/.golangci.yml b/.golangci.yml index 00541302f08..3672692f599 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -10,6 +10,7 @@ linters: - misspell - rowserrcheck - errorlint + - unconvert - sqlclosecheck - noctx linters-settings: diff --git a/common/txmgr/txmgr.go b/common/txmgr/txmgr.go index 36a6a1304ae..25c3b9beb35 100644 --- a/common/txmgr/txmgr.go +++ b/common/txmgr/txmgr.go @@ -240,7 +240,7 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Reset(addr // - marks all pending and inflight transactions fatally errored (note: at this point all transactions are either confirmed or fatally errored) // this must not be run while Broadcaster or Confirmer are running func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) abandon(addr ADDR) (err error) { - ctx, cancel := services.StopChan(b.chStop).NewCtx() + ctx, cancel := b.chStop.NewCtx() defer cancel() if err = b.txStore.Abandon(ctx, b.chainID, addr); err != nil { return fmt.Errorf("abandon failed to update txes for key %s: %w", addr.String(), err) diff --git a/core/chains/evm/client/node_lifecycle_test.go b/core/chains/evm/client/node_lifecycle_test.go index f097c2bc078..0fcaf54ae3d 100644 --- a/core/chains/evm/client/node_lifecycle_test.go +++ b/core/chains/evm/client/node_lifecycle_test.go @@ -556,7 +556,7 @@ func TestUnit_NodeLifecycle_outOfSyncLoop(t *testing.T) { return }) - iN := NewNode(cfg, time.Duration(time.Second), logger.Test(t), *s.WSURL(), nil, "test node", 42, testutils.FixtureChainID, 1) + iN := NewNode(cfg, time.Second, logger.Test(t), *s.WSURL(), nil, "test node", 42, testutils.FixtureChainID, 1) n := iN.(*node) dial(t, n) diff --git a/core/chains/evm/config/config_test.go b/core/chains/evm/config/config_test.go index a8cbf6667f3..cd1967b9582 100644 --- a/core/chains/evm/config/config_test.go +++ b/core/chains/evm/config/config_test.go @@ -70,7 +70,7 @@ func TestChainScopedConfig(t *testing.T) { ChainID: id, Chain: toml.Defaults(id, &toml.Chain{ GasEstimator: toml.GasEstimator{ - BumpTxDepth: ptr(uint32(override)), + BumpTxDepth: ptr(override), }, }), } diff --git a/core/chains/evm/config/toml/config.go b/core/chains/evm/config/toml/config.go index e5b774edd17..2348e648696 100644 --- a/core/chains/evm/config/toml/config.go +++ b/core/chains/evm/config/toml/config.go @@ -380,7 +380,7 @@ func (c *Chain) ValidateConfig() (err error) { Msg: config.ErrInvalidChainType.Error()}) } - if c.GasEstimator.BumpTxDepth != nil && uint32(*c.GasEstimator.BumpTxDepth) > *c.Transactions.MaxInFlight { + if c.GasEstimator.BumpTxDepth != nil && *c.GasEstimator.BumpTxDepth > *c.Transactions.MaxInFlight { err = multierr.Append(err, commonconfig.ErrInvalid{Name: "GasEstimator.BumpTxDepth", Value: *c.GasEstimator.BumpTxDepth, Msg: "must be less than or equal to Transactions.MaxInFlight"}) } diff --git a/core/chains/evm/forwarders/forwarder_manager.go b/core/chains/evm/forwarders/forwarder_manager.go index 03792966fef..cabedf79aee 100644 --- a/core/chains/evm/forwarders/forwarder_manager.go +++ b/core/chains/evm/forwarders/forwarder_manager.go @@ -236,7 +236,7 @@ func (f *FwdMgr) runLoop() { defer f.wg.Done() tick := time.After(0) - for ; ; tick = time.After(utils.WithJitter(time.Duration(time.Minute))) { + for ; ; tick = time.After(utils.WithJitter(time.Minute)) { select { case <-tick: if err := f.logpoller.Ready(); err != nil { diff --git a/core/chains/evm/log/broadcaster.go b/core/chains/evm/log/broadcaster.go index 55a53211fc9..8321dd30bfe 100644 --- a/core/chains/evm/log/broadcaster.go +++ b/core/chains/evm/log/broadcaster.go @@ -564,7 +564,7 @@ func (b *broadcaster) onNewHeads() { b.lastSeenHeadNumber.Store(latestHead.Number) - keptLogsDepth := uint32(b.config.FinalityDepth()) + keptLogsDepth := b.config.FinalityDepth() if b.registrations.highestNumConfirmations > keptLogsDepth { keptLogsDepth = b.registrations.highestNumConfirmations } diff --git a/core/chains/evm/log/eth_subscriber.go b/core/chains/evm/log/eth_subscriber.go index 2f9cbb07cb3..ff20a6e74e8 100644 --- a/core/chains/evm/log/eth_subscriber.go +++ b/core/chains/evm/log/eth_subscriber.go @@ -131,7 +131,7 @@ func (sub *ethSubscriber) backfillLogs(fromBlockOverride null.Int64, addresses [ return true } - sub.logger.Infow(fmt.Sprintf("LogBroadcaster: Fetched a batch of %v logs from %v to %v%s", len(batchLogs), from, to, elapsedMessage), "len", len(batchLogs), "fromBlock", from, "toBlock", to, "remaining", int64(latestHeight)-to) + sub.logger.Infow(fmt.Sprintf("LogBroadcaster: Fetched a batch of %v logs from %v to %v%s", len(batchLogs), from, to, elapsedMessage), "len", len(batchLogs), "fromBlock", from, "toBlock", to, "remaining", latestHeight-to) select { case <-sub.chStop: diff --git a/core/chains/evm/logpoller/log_poller.go b/core/chains/evm/logpoller/log_poller.go index f82cec62b74..7006c1762ef 100644 --- a/core/chains/evm/logpoller/log_poller.go +++ b/core/chains/evm/logpoller/log_poller.go @@ -1060,7 +1060,7 @@ func (lp *logPoller) GetBlocksRange(ctx context.Context, numbers []uint64, qopts qopts = append(qopts, pg.WithParentCtx(ctx)) minRequestedBlock := int64(mathutil.Min(numbers[0], numbers[1:]...)) maxRequestedBlock := int64(mathutil.Max(numbers[0], numbers[1:]...)) - lpBlocks, err := lp.orm.GetBlocksRange(int64(minRequestedBlock), int64(maxRequestedBlock), qopts...) + lpBlocks, err := lp.orm.GetBlocksRange(minRequestedBlock, maxRequestedBlock, qopts...) if err != nil { lp.lggr.Warnw("Error while retrieving blocks from log pollers blocks table. Falling back to RPC...", "requestedBlocks", numbers, "err", err) } else { diff --git a/core/chains/evm/txmgr/attempts.go b/core/chains/evm/txmgr/attempts.go index ab143a0c963..91645bae6f6 100644 --- a/core/chains/evm/txmgr/attempts.go +++ b/core/chains/evm/txmgr/attempts.go @@ -124,7 +124,7 @@ func (c *evmTxAttemptBuilder) NewEmptyTxAttempt(nonce evmtypes.Nonce, feeLimit u uint64(nonce), fromAddress, value, - uint32(feeLimit), + feeLimit, fee.Legacy, payload, ) diff --git a/core/chains/evm/txmgr/attempts_test.go b/core/chains/evm/txmgr/attempts_test.go index 5635972d7ae..c7373e2c4f6 100644 --- a/core/chains/evm/txmgr/attempts_test.go +++ b/core/chains/evm/txmgr/attempts_test.go @@ -164,13 +164,13 @@ func TestTxm_NewDynamicFeeTx(t *testing.T) { {"gas tip < fee cap", assets.GWei(4), assets.GWei(5), nil, ""}, {"gas tip > fee cap", assets.GWei(6), assets.GWei(5), nil, "gas fee cap must be greater than or equal to gas tip cap (fee cap: 5 gwei, tip cap: 6 gwei)"}, {"fee cap exceeds max allowed", assets.GWei(5), assets.GWei(5), func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = (*assets.Wei)(assets.GWei(4)) + c.EVM[0].GasEstimator.PriceMax = assets.GWei(4) }, "specified gas fee cap of 5 gwei would exceed max configured gas price of 4 gwei"}, {"ignores global min gas price", assets.GWei(5), assets.GWei(5), func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMin = (*assets.Wei)(assets.GWei(6)) + c.EVM[0].GasEstimator.PriceMin = assets.GWei(6) }, ""}, {"tip cap below min allowed", assets.GWei(5), assets.GWei(5), func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.TipCapMin = (*assets.Wei)(assets.GWei(6)) + c.EVM[0].GasEstimator.TipCapMin = assets.GWei(6) }, "specified gas tip cap of 5 gwei is below min configured gas tip of 6 gwei"}, } diff --git a/core/chains/evm/txmgr/broadcaster_test.go b/core/chains/evm/txmgr/broadcaster_test.go index a0711a55a56..67e9b0d8f04 100644 --- a/core/chains/evm/txmgr/broadcaster_test.go +++ b/core/chains/evm/txmgr/broadcaster_test.go @@ -1142,7 +1142,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { }, evmcfg.EVM().GasEstimator().EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), evmcfg.EVM().GasEstimator(), ethKeyStore, estimator) localNextNonce = getLocalNextNonce(t, eb, fromAddress) - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce, nil).Once() eb2 := txmgr.NewEvmBroadcaster(txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTxmConfig(evmcfg.EVM()), txmgr.NewEvmTxmFeeConfig(evmcfg.EVM().GasEstimator()), evmcfg.EVM().Transactions(), evmcfg.Database().Listener(), ethKeyStore, txBuilder, nil, lggr, &testCheckerFactory{}, false) retryable, err := eb2.ProcessUnstartedTxs(ctx, fromAddress) assert.NoError(t, err) @@ -1193,7 +1193,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { require.Equal(t, int64(localNextNonce), int64(nonce)) // On the second try, the tx has been accepted into the mempool - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce+1), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce+1, nil).Once() retryable, err = eb.ProcessUnstartedTxs(ctx, fromAddress) assert.NoError(t, err) @@ -1217,10 +1217,10 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { localNextNonce := getLocalNextNonce(t, eb, fromAddress) etx := mustCreateUnstartedTx(t, txStore, fromAddress, toAddress, encodedPayload, gasLimit, value, &cltest.FixtureChainID) ethClient.On("SendTransactionReturnCode", mock.Anything, mock.MatchedBy(func(tx *gethTypes.Transaction) bool { - return tx.Nonce() == uint64(localNextNonce) + return tx.Nonce() == localNextNonce }), fromAddress).Return(commonclient.Unknown, errors.New(retryableErrorExample)).Once() // Nonce is the same as localNextNonce, implying that this sent transaction has not been accepted - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce, nil).Once() // Do the thing retryable, err := eb.ProcessUnstartedTxs(ctx, fromAddress) @@ -1269,7 +1269,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { localNextNonce := getLocalNextNonce(t, eb, fromAddress) etx := mustCreateUnstartedTx(t, txStore, fromAddress, toAddress, encodedPayload, gasLimit, value, &cltest.FixtureChainID) ethClient.On("SendTransactionReturnCode", mock.Anything, mock.MatchedBy(func(tx *gethTypes.Transaction) bool { - return tx.Nonce() == uint64(localNextNonce) + return tx.Nonce() == localNextNonce }), fromAddress).Return(commonclient.Unknown, errors.New(retryableErrorExample)).Once() ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(0), errors.New("pending nonce fetch failed")).Once() @@ -1324,7 +1324,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { return tx.Nonce() == localNextNonce }), fromAddress).Return(commonclient.Unknown, errors.New(retryableErrorExample)).Once() // Nonce is one higher than localNextNonce, implying that despite the error, this sent transaction has been accepted into the mempool - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce+1), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce+1, nil).Once() // Do the thing retryable, err := eb.ProcessUnstartedTxs(ctx, fromAddress) @@ -1466,7 +1466,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { c.EVM[0].GasEstimator.BumpMin = assets.NewWeiI(0) c.EVM[0].GasEstimator.BumpPercent = ptr[uint16](0) })) - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce, nil).Once() eb2 := NewTestEthBroadcaster(t, txStore, ethClient, ethKeyStore, evmcfg2, &testCheckerFactory{}, false) mustCreateUnstartedTx(t, txStore, fromAddress, toAddress, encodedPayload, gasLimit, value, &cltest.FixtureChainID) @@ -1558,7 +1558,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { c.EVM[0].GasEstimator.BumpPercent = ptr[uint16](0) })) localNextNonce := getLocalNextNonce(t, eb, fromAddress) - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(localNextNonce), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(localNextNonce, nil).Once() eb2 := NewTestEthBroadcaster(t, txStore, ethClient, ethKeyStore, evmcfg2, &testCheckerFactory{}, false) mustCreateUnstartedTx(t, txStore, fromAddress, toAddress, encodedPayload, gasLimit, value, &cltest.FixtureChainID) underpricedError := "transaction underpriced" @@ -1799,7 +1799,7 @@ func TestEthBroadcaster_SyncNonce(t *testing.T) { ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(0), nil).Once() eb := txmgr.NewEvmBroadcaster(txStore, txmgr.NewEvmTxmClient(ethClient), evmTxmCfg, txmgr.NewEvmTxmFeeConfig(ge), evmcfg.EVM().Transactions(), cfg.Database().Listener(), kst, txBuilder, txNonceSyncer, lggr, checkerFactory, true) - ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(uint64(ethNodeNonce), nil).Once() + ethClient.On("PendingNonceAt", mock.Anything, fromAddress).Return(ethNodeNonce, nil).Once() servicetest.Run(t, eb) testutils.WaitForLogMessage(t, observed, "Fast-forward sequence") diff --git a/core/chains/evm/txmgr/confirmer_test.go b/core/chains/evm/txmgr/confirmer_test.go index 8fa791a141e..9f267a8ea67 100644 --- a/core/chains/evm/txmgr/confirmer_test.go +++ b/core/chains/evm/txmgr/confirmer_test.go @@ -1724,7 +1724,7 @@ func TestEthConfirmer_RebroadcastWhereNecessary(t *testing.T) { db := pgtest.NewSqlxDB(t) cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = (*assets.Wei)(assets.GWei(500)) + c.EVM[0].GasEstimator.PriceMax = assets.GWei(500) }) txStore := cltest.NewTestTxStore(t, db, cfg.Database()) @@ -2373,7 +2373,7 @@ func TestEthConfirmer_RebroadcastWhereNecessary_TerminallyUnderpriced_ThenGoesTh db := pgtest.NewSqlxDB(t) cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.EVM[0].GasEstimator.PriceMax = (*assets.Wei)(assets.GWei(500)) + c.EVM[0].GasEstimator.PriceMax = assets.GWei(500) }) txStore := cltest.NewTestTxStore(t, db, cfg.Database()) diff --git a/core/chains/evm/txmgr/evm_tx_store.go b/core/chains/evm/txmgr/evm_tx_store.go index da206c46c7d..add4d915809 100644 --- a/core/chains/evm/txmgr/evm_tx_store.go +++ b/core/chains/evm/txmgr/evm_tx_store.go @@ -150,7 +150,7 @@ func fromDBReceiptsPlus(rs []dbReceiptPlus) []ReceiptPlus { func toOnchainReceipt(rs []*evmtypes.Receipt) []rawOnchainReceipt { receipts := make([]rawOnchainReceipt, len(rs)) for i := 0; i < len(rs); i++ { - receipts[i] = rawOnchainReceipt(*rs[i]) + receipts[i] = *rs[i] } return receipts } diff --git a/core/chains/evm/types/models.go b/core/chains/evm/types/models.go index 93b300aa532..44e150b6541 100644 --- a/core/chains/evm/types/models.go +++ b/core/chains/evm/types/models.go @@ -316,7 +316,7 @@ func (h *Head) MarshalJSON() ([]byte, error) { if h.StateRoot != (common.Hash{}) { jsonHead.StateRoot = &h.StateRoot } - jsonHead.Number = (*hexutil.Big)(big.NewInt(int64(h.Number))) + jsonHead.Number = (*hexutil.Big)(big.NewInt(h.Number)) if h.ParentHash != (common.Hash{}) { jsonHead.ParentHash = &h.ParentHash } diff --git a/core/chains/evm/types/nonce.go b/core/chains/evm/types/nonce.go index e9caf98c763..be295bdd2a9 100644 --- a/core/chains/evm/types/nonce.go +++ b/core/chains/evm/types/nonce.go @@ -19,5 +19,5 @@ func (n Nonce) String() string { } func GenerateNextNonce(prev Nonce) Nonce { - return Nonce(prev + 1) + return prev + 1 } diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index da899cef362..1c4d097d633 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -524,8 +524,8 @@ observationSource = """ cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) run := cltest.CreateJobRunViaUser(t, app, j.ExternalJobID, "") - assert.Equal(t, []*string([]*string(nil)), run.Outputs) - assert.Equal(t, []*string([]*string(nil)), run.Errors) + assert.Equal(t, []*string(nil), run.Outputs) + assert.Equal(t, []*string(nil), run.Errors) testutils.WaitForLogMessage(t, o, "Sending transaction") b.Commit() // Needs at least two confirmations @@ -570,8 +570,8 @@ observationSource = """ cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) run := cltest.CreateJobRunViaUser(t, app, j.ExternalJobID, "") - assert.Equal(t, []*string([]*string(nil)), run.Outputs) - assert.Equal(t, []*string([]*string(nil)), run.Errors) + assert.Equal(t, []*string(nil), run.Outputs) + assert.Equal(t, []*string(nil), run.Errors) testutils.WaitForLogMessage(t, o, "Sending transaction") b.Commit() // Needs at least two confirmations @@ -608,8 +608,8 @@ observationSource = """ cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) run := cltest.CreateJobRunViaUser(t, app, j.ExternalJobID, "") - assert.Equal(t, []*string([]*string(nil)), run.Outputs) - assert.Equal(t, []*string([]*string(nil)), run.Errors) + assert.Equal(t, []*string(nil), run.Outputs) + assert.Equal(t, []*string(nil), run.Errors) testutils.WaitForLogMessage(t, o, "Sending transaction") b.Commit() // Needs at least two confirmations diff --git a/core/null/int64.go b/core/null/int64.go index 2a31aea7594..ca236784486 100644 --- a/core/null/int64.go +++ b/core/null/int64.go @@ -43,7 +43,7 @@ func (i *Int64) UnmarshalJSON(data []byte) error { // Unmarshal again, directly to value, to avoid intermediate float64 err = json.Unmarshal(data, &i.Int64) case string: - str := string(x) + str := x if len(str) == 0 { i.Valid = false return nil @@ -85,7 +85,7 @@ func (i Int64) MarshalJSON() ([]byte, error) { if !i.Valid { return []byte("null"), nil } - return []byte(strconv.FormatInt(int64(i.Int64), 10)), nil + return []byte(strconv.FormatInt(i.Int64, 10)), nil } // MarshalText implements encoding.TextMarshaler. @@ -94,7 +94,7 @@ func (i Int64) MarshalText() ([]byte, error) { if !i.Valid { return []byte{}, nil } - return []byte(strconv.FormatInt(int64(i.Int64), 10)), nil + return []byte(strconv.FormatInt(i.Int64, 10)), nil } // SetValid changes this Int64's value and also sets it to be non-null. @@ -112,7 +112,7 @@ func (i Int64) Value() (driver.Value, error) { // golang's sql driver types as determined by IsValue only supports: // []byte, bool, float64, int64, string, time.Time // https://golang.org/src/database/sql/driver/types.go - return int64(i.Int64), nil + return i.Int64, nil } // Scan reads the database value and returns an instance. @@ -130,7 +130,7 @@ func (i *Int64) Scan(value interface{}) error { safe := int64(typed) *i = Int64From(safe) case int64: - safe := int64(typed) + safe := typed *i = Int64From(safe) case uint: if typed > uint(math.MaxInt64) { diff --git a/core/null/uint32.go b/core/null/uint32.go index 0bafef0c24e..1d4fbc15b79 100644 --- a/core/null/uint32.go +++ b/core/null/uint32.go @@ -42,7 +42,7 @@ func (i *Uint32) UnmarshalJSON(data []byte) error { // Unmarshal again, directly to value, to avoid intermediate float64 err = json.Unmarshal(data, &i.Uint32) case string: - str := string(x) + str := x if len(str) == 0 { i.Valid = false return nil diff --git a/core/scripts/ocr2vrf/main.go b/core/scripts/ocr2vrf/main.go index 532fbd3f22c..e7da4589951 100644 --- a/core/scripts/ocr2vrf/main.go +++ b/core/scripts/ocr2vrf/main.go @@ -364,7 +364,7 @@ func main() { *consumerAddress, uint16(*numWords), decimal.RequireFromString(*subID).BigInt(), - big.NewInt(int64(*confDelay)), + big.NewInt(*confDelay), uint32(*callbackGasLimit), nil, // test consumer doesn't use any args ) @@ -389,7 +389,7 @@ func main() { *consumerAddress, uint16(*numWords), decimal.RequireFromString(*subID).BigInt(), - big.NewInt(int64(*confDelay)), + big.NewInt(*confDelay), uint32(*callbackGasLimit), nil, // test consumer doesn't use any args, big.NewInt(*batchSize), @@ -411,7 +411,7 @@ func main() { *consumerAddress, uint16(*numWords), decimal.RequireFromString(*subID).BigInt(), - big.NewInt(int64(*confDelay)), + big.NewInt(*confDelay), uint32(*callbackGasLimit), nil, // test consumer doesn't use any args, big.NewInt(*batchSize), diff --git a/core/scripts/vrfv2/testnet/main.go b/core/scripts/vrfv2/testnet/main.go index 151549cc587..100440d6fb0 100644 --- a/core/scripts/vrfv2/testnet/main.go +++ b/core/scripts/vrfv2/testnet/main.go @@ -744,7 +744,7 @@ func main() { helpers.ParseArgs(addSubConsCmd, os.Args[2:], "coordinator-address", "sub-id", "consumer-address") coordinator, err := vrf_coordinator_v2.NewVRFCoordinatorV2(common.HexToAddress(*coordinatorAddress), e.Ec) helpers.PanicErr(err) - v2scripts.EoaAddConsumerToSub(e, *coordinator, uint64(*subID), *consumerAddress) + v2scripts.EoaAddConsumerToSub(e, *coordinator, *subID, *consumerAddress) case "eoa-create-fund-authorize-sub": // Lets just treat the owner key as the EOA controlling the sub cfaSubCmd := flag.NewFlagSet("eoa-create-fund-authorize-sub", flag.ExitOnError) diff --git a/core/services/blockhashstore/common.go b/core/services/blockhashstore/common.go index 677016253fb..a19a3b868f7 100644 --- a/core/services/blockhashstore/common.go +++ b/core/services/blockhashstore/common.go @@ -59,7 +59,7 @@ func GetUnfulfilledBlocksAndRequests( blockToRequests := make(map[uint64]map[string]struct{}) requestIDToBlock := make(map[string]uint64) - reqs, err := coordinator.Requests(ctx, uint64(fromBlock), uint64(toBlock)) + reqs, err := coordinator.Requests(ctx, fromBlock, toBlock) if err != nil { lggr.Errorw("Failed to fetch VRF requests", "err", err) @@ -73,7 +73,7 @@ func GetUnfulfilledBlocksAndRequests( requestIDToBlock[req.ID] = req.Block } - fuls, err := coordinator.Fulfillments(ctx, uint64(fromBlock)) + fuls, err := coordinator.Fulfillments(ctx, fromBlock) if err != nil { lggr.Errorw("Failed to fetch VRF fulfillments", "err", err) diff --git a/core/services/blockheaderfeeder/block_header_feeder.go b/core/services/blockheaderfeeder/block_header_feeder.go index 93799b8b419..a5bcb003613 100644 --- a/core/services/blockheaderfeeder/block_header_feeder.go +++ b/core/services/blockheaderfeeder/block_header_feeder.go @@ -120,7 +120,7 @@ func (f *BlockHeaderFeeder) Run(ctx context.Context) error { lggr.Debugw("found lowest block number without blockhash", "minBlockNumber", minBlockNumber) - earliestStoredBlockNumber, err := f.findEarliestBlockNumberWithBlockhash(ctx, lggr, minBlockNumber.Uint64()+1, uint64(toBlock)) + earliestStoredBlockNumber, err := f.findEarliestBlockNumberWithBlockhash(ctx, lggr, minBlockNumber.Uint64()+1, toBlock) if err != nil { return errors.Wrap(err, "finding earliest blocknumber with blockhash") } diff --git a/core/services/feeds/orm_test.go b/core/services/feeds/orm_test.go index 88d3b132beb..78af9bf6912 100644 --- a/core/services/feeds/orm_test.go +++ b/core/services/feeds/orm_test.go @@ -645,7 +645,7 @@ func Test_ORM_CountJobProposalsByStatus(t *testing.T) { jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) // Create a spec for the pending job proposal - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) // Defer the FK requirement of an existing job for a job proposal to be approved require.NoError(t, utils.JustError(orm.db.Exec( @@ -870,7 +870,7 @@ func Test_ORM_UpsertJobProposal(t *testing.T) { assert.True(t, actual.PendingUpdate) // Approve - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) // Defer the FK requirement of an existing job for a job proposal. require.NoError(t, utils.JustError(orm.db.Exec( @@ -943,7 +943,7 @@ func Test_ORM_ApproveSpec(t *testing.T) { PendingUpdate: true, }) require.NoError(t, err) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) // Defer the FK requirement of an existing job for a job proposal. require.NoError(t, utils.JustError(orm.db.Exec( @@ -982,7 +982,7 @@ func Test_ORM_CancelSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -994,7 +994,7 @@ func Test_ORM_CancelSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusDeleted, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1056,7 +1056,7 @@ func Test_ORM_DeleteProposal(t *testing.T) { before: func(orm *TestORM) int64 { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - createJobSpec(t, orm, int64(jpID)) + createJobSpec(t, orm, jpID) return jpID }, @@ -1068,7 +1068,7 @@ func Test_ORM_DeleteProposal(t *testing.T) { before: func(orm *TestORM) int64 { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) externalJobID := uuid.NullUUID{UUID: uuid.New(), Valid: true} @@ -1090,7 +1090,7 @@ func Test_ORM_DeleteProposal(t *testing.T) { before: func(orm *TestORM) int64 { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) externalJobID := uuid.NullUUID{UUID: uuid.New(), Valid: true} @@ -1131,7 +1131,7 @@ func Test_ORM_DeleteProposal(t *testing.T) { before: func(orm *TestORM) int64 { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusCancelled, fmID) - createJobSpec(t, orm, int64(jpID)) + createJobSpec(t, orm, jpID) return jpID }, @@ -1143,7 +1143,7 @@ func Test_ORM_DeleteProposal(t *testing.T) { before: func(orm *TestORM) int64 { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusRejected, fmID) - createJobSpec(t, orm, int64(jpID)) + createJobSpec(t, orm, jpID) return jpID }, @@ -1211,7 +1211,7 @@ func Test_ORM_RevokeSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1224,7 +1224,7 @@ func Test_ORM_RevokeSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) externalJobID := uuid.NullUUID{UUID: uuid.New(), Valid: true} @@ -1246,7 +1246,7 @@ func Test_ORM_RevokeSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusCancelled, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1258,7 +1258,7 @@ func Test_ORM_RevokeSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusRejected, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1270,7 +1270,7 @@ func Test_ORM_RevokeSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusDeleted, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1324,7 +1324,7 @@ func Test_ORM_ExistsSpecByJobProposalIDAndVersion(t *testing.T) { jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) ) - createJobSpec(t, orm, int64(jpID)) + createJobSpec(t, orm, jpID) exists, err := orm.ExistsSpecByJobProposalIDAndVersion(jpID, 1) require.NoError(t, err) @@ -1342,7 +1342,7 @@ func Test_ORM_GetSpec(t *testing.T) { orm = setupORM(t) fmID = createFeedsManager(t, orm) jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID = createJobSpec(t, orm, int64(jpID)) + specID = createJobSpec(t, orm, jpID) ) actual, err := orm.GetSpec(specID) @@ -1361,7 +1361,7 @@ func Test_ORM_GetApprovedSpec(t *testing.T) { orm = setupORM(t) fmID = createFeedsManager(t, orm) jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID = createJobSpec(t, orm, int64(jpID)) + specID = createJobSpec(t, orm, jpID) externalJobID = uuid.NullUUID{UUID: uuid.New(), Valid: true} ) @@ -1398,7 +1398,7 @@ func Test_ORM_GetLatestSpec(t *testing.T) { jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) ) - _ = createJobSpec(t, orm, int64(jpID)) + _ = createJobSpec(t, orm, jpID) spec2ID, err := orm.CreateSpec(feeds.JobProposalSpec{ Definition: "spec data", Version: 2, @@ -1429,8 +1429,8 @@ func Test_ORM_ListSpecsByJobProposalIDs(t *testing.T) { ) // Create the specs for the proposals - createJobSpec(t, orm, int64(jp1ID)) - createJobSpec(t, orm, int64(jp2ID)) + createJobSpec(t, orm, jp1ID) + createJobSpec(t, orm, jp2ID) specs, err := orm.ListSpecsByJobProposalIDs([]int64{jp1ID, jp2ID}) require.NoError(t, err) @@ -1466,7 +1466,7 @@ func Test_ORM_RejectSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1478,7 +1478,7 @@ func Test_ORM_RejectSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) externalJobID := uuid.NullUUID{UUID: uuid.New(), Valid: true} @@ -1500,7 +1500,7 @@ func Test_ORM_RejectSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusCancelled, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1512,7 +1512,7 @@ func Test_ORM_RejectSpec(t *testing.T) { before: func(orm *TestORM) (int64, int64) { fmID := createFeedsManager(t, orm) jpID := createJobProposal(t, orm, feeds.JobProposalStatusDeleted, fmID) - specID := createJobSpec(t, orm, int64(jpID)) + specID := createJobSpec(t, orm, jpID) return jpID, specID }, @@ -1566,7 +1566,7 @@ func Test_ORM_UpdateSpecDefinition(t *testing.T) { orm = setupORM(t) fmID = createFeedsManager(t, orm) jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID = createJobSpec(t, orm, int64(jpID)) + specID = createJobSpec(t, orm, jpID) ) prev, err := orm.GetSpec(specID) @@ -1596,7 +1596,7 @@ func Test_ORM_IsJobManaged(t *testing.T) { orm = setupORM(t) fmID = createFeedsManager(t, orm) jpID = createJobProposal(t, orm, feeds.JobProposalStatusPending, fmID) - specID = createJobSpec(t, orm, int64(jpID)) + specID = createJobSpec(t, orm, jpID) externalJobID = uuid.NullUUID{UUID: uuid.New(), Valid: true} ) diff --git a/core/services/fluxmonitorv2/integrations_test.go b/core/services/fluxmonitorv2/integrations_test.go index 580e7a1d086..7f45e6eb19c 100644 --- a/core/services/fluxmonitorv2/integrations_test.go +++ b/core/services/fluxmonitorv2/integrations_test.go @@ -519,7 +519,7 @@ func TestFluxMonitor_Deviation(t *testing.T) { s = fmt.Sprintf(s, fa.aggregatorContractAddress, 2*time.Second) requestBody, err := json.Marshal(web.CreateJobRequest{ - TOML: string(s), + TOML: s, }) assert.NoError(t, err) @@ -676,7 +676,7 @@ ds1 -> ds1_parse fa.backend.Commit() requestBody, err := json.Marshal(web.CreateJobRequest{ - TOML: string(s), + TOML: s, }) assert.NoError(t, err) @@ -786,7 +786,7 @@ ds1 -> ds1_parse fa.backend.Commit() requestBody, err := json.Marshal(web.CreateJobRequest{ - TOML: string(s), + TOML: s, }) assert.NoError(t, err) @@ -896,7 +896,7 @@ ds1 -> ds1_parse fa.backend.Commit() requestBody, err := json.Marshal(web.CreateJobRequest{ - TOML: string(s), + TOML: s, }) assert.NoError(t, err) @@ -991,7 +991,7 @@ ds1 -> ds1_parse -> ds1_multiply s = fmt.Sprintf(s, fa.aggregatorContractAddress, testutils.SimulatedChainID.String(), "200ms", mockServer.URL) requestBody, err := json.Marshal(web.CreateJobRequest{ - TOML: string(s), + TOML: s, }) assert.NoError(t, err) diff --git a/core/services/functions/listener_test.go b/core/services/functions/listener_test.go index 5d26f9a4f57..75161d3410b 100644 --- a/core/services/functions/listener_test.go +++ b/core/services/functions/listener_test.go @@ -161,7 +161,7 @@ func TestFunctionsListener_HandleOracleRequestV1_Success(t *testing.T) { request := types.OracleRequest{ RequestId: RequestID, - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner, Flags: packFlags(1, 0), // tier no 1 of request size, allows up to 100 bytes Data: make([]byte, 12), @@ -194,7 +194,7 @@ func TestFunctionsListener_HandleOffchainRequest_Success(t *testing.T) { request := &functions_service.OffchainRequest{ RequestId: RequestID[:], RequestInitiator: SubscriptionOwner.Bytes(), - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner.Bytes(), Timestamp: uint64(time.Now().Unix()), Data: functions_service.RequestData{}, @@ -210,7 +210,7 @@ func TestFunctionsListener_HandleOffchainRequest_Invalid(t *testing.T) { request := &functions_service.OffchainRequest{ RequestId: RequestID[:], RequestInitiator: []byte("invalid_address"), - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner.Bytes(), Timestamp: uint64(time.Now().Unix()), Data: functions_service.RequestData{}, @@ -238,7 +238,7 @@ func TestFunctionsListener_HandleOffchainRequest_InternalError(t *testing.T) { request := &functions_service.OffchainRequest{ RequestId: RequestID[:], RequestInitiator: SubscriptionOwner.Bytes(), - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner.Bytes(), Timestamp: uint64(time.Now().Unix()), Data: functions_service.RequestData{}, @@ -255,7 +255,7 @@ func TestFunctionsListener_HandleOracleRequestV1_ComputationError(t *testing.T) request := types.OracleRequest{ RequestId: RequestID, - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner, Flags: packFlags(1, 0), // tier no 1 of request size, allows up to 100 bytes Data: make([]byte, 12), @@ -291,7 +291,7 @@ func TestFunctionsListener_HandleOracleRequestV1_ThresholdDecryptedSecrets(t *te cborBytes = cborBytes[1:] request := types.OracleRequest{ RequestId: RequestID, - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner, Flags: packFlags(1, 1), // tiers no 1 of request size and secrets size, allow up to 100 bytes Data: cborBytes, @@ -324,7 +324,7 @@ func TestFunctionsListener_HandleOracleRequestV1_CBORTooBig(t *testing.T) { request := types.OracleRequest{ RequestId: RequestID, - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner, Flags: packFlags(0, 0), // tier no 0 of request size, allows only for max 10 bytes Data: make([]byte, 20), @@ -350,7 +350,7 @@ func TestFunctionsListener_ReportSourceCodeDomains(t *testing.T) { request := types.OracleRequest{ RequestId: RequestID, - SubscriptionId: uint64(SubscriptionID), + SubscriptionId: SubscriptionID, SubscriptionOwner: SubscriptionOwner, Flags: packFlags(1, 0), // tier no 1 of request size, allows up to 100 bytes Data: make([]byte, 12), diff --git a/core/services/gateway/connector/connector.go b/core/services/gateway/connector/connector.go index 6b399733a58..9f809a326c8 100644 --- a/core/services/gateway/connector/connector.go +++ b/core/services/gateway/connector/connector.go @@ -83,7 +83,7 @@ func NewGatewayConnector(config *ConnectorConfig, signer Signer, handler Gateway if config == nil || signer == nil || handler == nil || clock == nil || lggr == nil { return nil, errors.New("nil dependency") } - if len(config.DonId) == 0 || len(config.DonId) > int(network.HandshakeDonIdLen) { + if len(config.DonId) == 0 || len(config.DonId) > network.HandshakeDonIdLen { return nil, errors.New("invalid DON ID") } addressBytes, err := hex.DecodeString(config.NodeAddress) diff --git a/core/services/gateway/gateway_test.go b/core/services/gateway/gateway_test.go index 1c31a643c80..7a5457c788c 100644 --- a/core/services/gateway/gateway_test.go +++ b/core/services/gateway/gateway_test.go @@ -225,7 +225,7 @@ func TestGateway_ProcessRequest_HandlerTimeout(t *testing.T) { gw, handler := newGatewayWithMockHandler(t) handler.On("HandleUserMessage", mock.Anything, mock.Anything, mock.Anything).Return(nil) - timeoutCtx, cancel := context.WithTimeout(testutils.Context(t), time.Duration(time.Millisecond*10)) + timeoutCtx, cancel := context.WithTimeout(testutils.Context(t), time.Millisecond*10) defer cancel() req := newSignedRequest(t, "abcd", "request", "testDON", []byte{}) diff --git a/core/services/job/models.go b/core/services/job/models.go index 5dcf4928e35..31032d58e0e 100644 --- a/core/services/job/models.go +++ b/core/services/job/models.go @@ -236,7 +236,7 @@ func (pr *PipelineRun) SetID(value string) error { if err != nil { return err } - pr.ID = int64(ID) + pr.ID = ID return nil } diff --git a/core/services/job/orm.go b/core/services/job/orm.go index fb52dafdf5d..82c6be2963c 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -697,7 +697,7 @@ func (o *orm) FindJobs(offset, limit int) (jobs []Job, count int, err error) { return nil }) - return jobs, int(count), err + return jobs, count, err } func LoadDefaultVRFPollPeriod(vrfs VRFSpec) *VRFSpec { diff --git a/core/services/keystore/keys/ocr2key/offchain_keyring.go b/core/services/keystore/keys/ocr2key/offchain_keyring.go index 9e6d8f64e03..36fc1cfd02a 100644 --- a/core/services/keystore/keys/ocr2key/offchain_keyring.go +++ b/core/services/keystore/keys/ocr2key/offchain_keyring.go @@ -68,7 +68,7 @@ func (ok *OffchainKeyring) NaclBoxOpenAnonymous(ciphertext []byte) (plaintext [] // OffchainSign signs message using private key func (ok *OffchainKeyring) OffchainSign(msg []byte) (signature []byte, err error) { - return ed25519.Sign(ed25519.PrivateKey(ok.signingKey), msg), nil + return ed25519.Sign(ok.signingKey, msg), nil } // ConfigDiffieHellman returns the shared point obtained by multiplying someone's diff --git a/core/services/nurse_test.go b/core/services/nurse_test.go index 46ebd749036..7521168aa3f 100644 --- a/core/services/nurse_test.go +++ b/core/services/nurse_test.go @@ -31,8 +31,8 @@ type mockConfig struct { } var ( - testInterval = time.Duration(50 * time.Millisecond) - testDuration = time.Duration(20 * time.Millisecond) + testInterval = 50 * time.Millisecond + testDuration = 20 * time.Millisecond testRate = 100 testSize = 16 * 1024 * 1024 ) diff --git a/core/services/ocr2/plugins/dkg/persistence/db.go b/core/services/ocr2/plugins/dkg/persistence/db.go index 304422ace2d..72997e28699 100644 --- a/core/services/ocr2/plugins/dkg/persistence/db.go +++ b/core/services/ocr2/plugins/dkg/persistence/db.go @@ -65,7 +65,7 @@ func NewShareDB(db *sqlx.DB, lggr logger.Logger, cfg pg.QConfig, chainID *big.In q: pg.NewQ(db, lggr, cfg), lggr: lggr, chainID: chainID, - chainType: string(chainType), + chainType: chainType, } } diff --git a/core/services/ocr2/plugins/functions/aggregation.go b/core/services/ocr2/plugins/functions/aggregation.go index 32a2509e70e..7ae00532f3f 100644 --- a/core/services/ocr2/plugins/functions/aggregation.go +++ b/core/services/ocr2/plugins/functions/aggregation.go @@ -104,7 +104,7 @@ func aggregateMode(items [][]byte) []byte { mostFrequent = item } } - return []byte(mostFrequent) + return mostFrequent } func aggregateMedian(items [][]byte) []byte { diff --git a/core/services/ocr2/plugins/mercury/integration_test.go b/core/services/ocr2/plugins/mercury/integration_test.go index 51f9eaa6683..6d847098f94 100644 --- a/core/services/ocr2/plugins/mercury/integration_test.go +++ b/core/services/ocr2/plugins/mercury/integration_test.go @@ -357,7 +357,7 @@ func TestIntegration_MercuryV1(t *testing.T) { err = reportcodecv1.ReportTypes.UnpackIntoMap(reportElems, report.([]byte)) require.NoError(t, err) - feedID := ([32]byte)(reportElems["feedId"].([32]uint8)) + feedID := reportElems["feedId"].([32]uint8) feed, exists := feedM[feedID] require.True(t, exists) @@ -421,7 +421,7 @@ func TestIntegration_MercuryV1(t *testing.T) { err = reportcodecv1.ReportTypes.UnpackIntoMap(reportElems, report.([]byte)) require.NoError(t, err) - feedID := ([32]byte)(reportElems["feedId"].([32]uint8)) + feedID := reportElems["feedId"].([32]uint8) feed, exists := feedM[feedID] require.True(t, exists) @@ -691,7 +691,7 @@ func TestIntegration_MercuryV2(t *testing.T) { err = reportcodecv2.ReportTypes.UnpackIntoMap(reportElems, report.([]byte)) require.NoError(t, err) - feedID := ([32]byte)(reportElems["feedId"].([32]uint8)) + feedID := reportElems["feedId"].([32]uint8) feed, exists := feedM[feedID] require.True(t, exists) @@ -971,7 +971,7 @@ func TestIntegration_MercuryV3(t *testing.T) { err = reportcodecv3.ReportTypes.UnpackIntoMap(reportElems, report.([]byte)) require.NoError(t, err) - feedID := ([32]byte)(reportElems["feedId"].([32]uint8)) + feedID := reportElems["feedId"].([32]uint8) feed, exists := feedM[feedID] require.True(t, exists) diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go index 81f51311d44..f2c58fd30c1 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/logprovider/buffer.go @@ -176,8 +176,8 @@ func (b *logEventBuffer) enqueue(id *big.Int, logs ...logpoller.Log) int { lggr := b.lggr.With("id", id.String()) - maxBlockLogs := int(b.maxBlockLogs) - maxUpkeepLogs := int(b.maxUpkeepLogsPerBlock) + maxBlockLogs := b.maxBlockLogs + maxUpkeepLogs := b.maxUpkeepLogsPerBlock latestBlock := b.latestBlockSeen() added, dropped := 0, 0 diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v02/request.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v02/request.go index f69fbb35e35..202661145bf 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v02/request.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/mercury/v02/request.go @@ -81,7 +81,7 @@ func (c *client) DoRequest(ctx context.Context, streamsLookup *mercury.StreamsLo retryable = retryable && m.Retryable allSuccess = false if m.State != encoding.NoPipelineError { - state = encoding.PipelineExecutionState(m.State) + state = m.State } continue } diff --git a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/transmit/cache.go b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/transmit/cache.go index 99e1f1dc164..2c0055482ed 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/transmit/cache.go +++ b/core/services/ocr2/plugins/ocr2keeper/evmregistry/v21/transmit/cache.go @@ -28,7 +28,7 @@ func (c *transmitEventCache) get(block ocr2keepers.BlockNumber, logID string) (o c.lock.RLock() defer c.lock.RUnlock() - i := int64(block) % int64(c.cap) + i := int64(block) % c.cap b := c.buffer[i] if b.block != block { return ocr2keepers.TransmitEvent{}, false @@ -45,7 +45,7 @@ func (c *transmitEventCache) add(logID string, e ocr2keepers.TransmitEvent) { c.lock.Lock() defer c.lock.Unlock() - i := int64(e.TransmitBlock) % int64(c.cap) + i := int64(e.TransmitBlock) % c.cap b := c.buffer[i] isBlockEmpty := len(b.records) == 0 isNewBlock := b.block < e.TransmitBlock diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go index a25fcca9fec..88d6544d8c4 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator.go @@ -398,7 +398,7 @@ func (c *coordinator) ReportBlocks( // TODO BELOW: Write tests for the new blockhash retrieval. // Obtain recent blockhashes, ordered by ascending block height. - for i := recentBlockHashesStartHeight; i <= uint64(currentHeight); i++ { + for i := recentBlockHashesStartHeight; i <= currentHeight; i++ { recentBlockHashes = append(recentBlockHashes, blockhashesMapping[i]) } @@ -518,7 +518,7 @@ func (c *coordinator) getBlockhashesMappingFromRequests( } // Get a mapping of block numbers to block hashes. - blockhashesMapping, err = c.getBlockhashesMapping(ctx, append(requestedBlockNumbers, uint64(currentHeight), recentBlockHashesStartHeight)) + blockhashesMapping, err = c.getBlockhashesMapping(ctx, append(requestedBlockNumbers, currentHeight, recentBlockHashesStartHeight)) if err != nil { err = errors.Wrap(err, "get blockhashes for ReportBlocks") } diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go index 9c3eb087985..096589b2053 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/coordinator_test.go @@ -271,7 +271,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 1) assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -333,7 +333,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.False(t, b.ShouldStore) } assert.Len(t, callbacks, 3) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -400,7 +400,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 0) assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -471,7 +471,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 0) assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -533,7 +533,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 0) assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -635,7 +635,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 0) assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -705,7 +705,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.True(t, b.ShouldStore) } assert.Len(t, callbacks, 0) - assert.Equal(t, uint64(latestHeadNumber-blockhashLookback+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-blockhashLookback+1, recentHeightStart) assert.Len(t, recentBlocks, int(blockhashLookback)) }) @@ -772,7 +772,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.True(t, b.ShouldStore) } assert.Len(t, callbacks, 2) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -835,7 +835,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 1) assert.Len(t, callbacks, 1) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -901,7 +901,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { assert.NoError(t, err) assert.Len(t, blocks, 2) assert.Len(t, callbacks, 2) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Len(t, recentBlocks, int(lookbackBlocks)) }) @@ -956,7 +956,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { ) assert.NoError(t, err) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", 1)), recentBlocks[0]) assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", lookbackBlocks)), recentBlocks[len(recentBlocks)-1]) assert.Len(t, recentBlocks, int(lookbackBlocks)) @@ -1013,7 +1013,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { ) assert.NoError(t, err) - assert.Equal(t, uint64(latestHeadNumber-lookbackBlocks+1), recentHeightStart) + assert.Equal(t, latestHeadNumber-lookbackBlocks+1, recentHeightStart) assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", 1)), recentBlocks[0]) assert.Equal(t, common.HexToHash(fmt.Sprintf("0x00%d", lookbackBlocks)), recentBlocks[len(recentBlocks)-1]) assert.Len(t, recentBlocks, int(lookbackBlocks)) @@ -1035,7 +1035,7 @@ func TestCoordinator_ReportBlocks(t *testing.T) { lp.On("LatestBlock", mock.Anything). Return(logpoller.LogPollerBlock{BlockNumber: int64(latestHeadNumber)}, nil) - lp.On("GetBlocksRange", mock.Anything, append(requestedBlocks, uint64(latestHeadNumber-lookbackBlocks+1), uint64(latestHeadNumber)), mock.Anything). + lp.On("GetBlocksRange", mock.Anything, append(requestedBlocks, latestHeadNumber-lookbackBlocks+1, latestHeadNumber), mock.Anything). Return(nil, errors.New("GetBlocks error")) lp.On( "LogsWithSigs", diff --git a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go b/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go index 6a4b97b9f0e..57aaf1c5e03 100644 --- a/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go +++ b/core/services/ocr2/plugins/ocr2vrf/coordinator/ocr_cache_test.go @@ -11,7 +11,7 @@ import ( func TestNewCache(t *testing.T) { b := NewBlockCache[int](time.Second) - assert.Equal(t, time.Second, time.Duration(b.evictionWindow), "must set correct blockEvictionWindow") + assert.Equal(t, time.Second, b.evictionWindow, "must set correct blockEvictionWindow") } func TestCache(t *testing.T) { @@ -30,7 +30,7 @@ func TestCache(t *testing.T) { {Key: common.HexToHash("0x4"), Value: 5}, } - c := NewBlockCache[int](time.Second * 100) + c := NewBlockCache[int](100 * time.Second) // Populate cache with ordered items. for i, test := range tests { @@ -79,7 +79,7 @@ func TestCache(t *testing.T) { {Key: common.HexToHash("0x1"), Value: 5}, } - c := NewBlockCache[int](time.Duration(time.Second * 100)) + c := NewBlockCache[int](100 * time.Second) // Populate cache with items. for i, test := range tests { @@ -119,7 +119,7 @@ func TestCache(t *testing.T) { {Key: common.HexToHash("0x0"), Value: 5}, } - c := NewBlockCache[int](time.Duration(time.Second * 100)) + c := NewBlockCache[int](100 * time.Second) // Populate cache with items. for i, test := range tests { diff --git a/core/services/ocr2/plugins/promwrapper/plugin.go b/core/services/ocr2/plugins/promwrapper/plugin.go index a409b5ba86c..58d8e171f39 100644 --- a/core/services/ocr2/plugins/promwrapper/plugin.go +++ b/core/services/ocr2/plugins/promwrapper/plugin.go @@ -39,7 +39,7 @@ var ( labels = []string{"chainType", "chainID", "plugin", "oracleID", "configDigest"} getLabelsValues = func(p *promPlugin, t types.ReportTimestamp) []string { return []string{ - string(p.chainType), // chainType + p.chainType, // chainType p.chainID.String(), // chainID p.name, // plugin p.oracleID, // oracleID @@ -333,11 +333,11 @@ func (p *promPlugin) Close() error { defer func() { duration := float64(time.Now().UTC().Sub(start)) labelValues := []string{ - string(p.chainType), // chainType - p.chainID.String(), // chainID - p.name, // plugin - p.oracleID, // oracleID - p.configDigest, // configDigest + p.chainType, // chainType + p.chainID.String(), // chainID + p.name, // plugin + p.oracleID, // oracleID + p.configDigest, // configDigest } p.prometheusBackend.SetCloseDuration(labelValues, duration) }() diff --git a/core/services/ocr2/plugins/s4/plugin.go b/core/services/ocr2/plugins/s4/plugin.go index 677743c091d..2b55ebf3cc5 100644 --- a/core/services/ocr2/plugins/s4/plugin.go +++ b/core/services/ocr2/plugins/s4/plugin.go @@ -167,9 +167,9 @@ func (c *plugin) Observation(ctx context.Context, ts types.ReportTimestamp, quer if !sr.Confirmed { continue } - k := key{address: sr.Address.String(), slotID: uint(sr.SlotId)} + k := key{address: sr.Address.String(), slotID: sr.SlotId} if _, ok := snapshotVersionsMap[k]; ok { - toBeAdded = append(toBeAdded, rkey{address: sr.Address, slotID: uint(sr.SlotId)}) + toBeAdded = append(toBeAdded, rkey{address: sr.Address, slotID: sr.SlotId}) if len(toBeAdded) == maxRemainingRows { break } @@ -332,7 +332,7 @@ func snapshotToVersionMap(rows []*s4.SnapshotRow) map[key]uint64 { m := make(map[key]uint64) for _, row := range rows { if row.Confirmed { - m[key{address: row.Address.String(), slotID: uint(row.SlotId)}] = row.Version + m[key{address: row.Address.String(), slotID: row.SlotId}] = row.Version } } return m diff --git a/core/services/ocr2/plugins/s4/plugin_test.go b/core/services/ocr2/plugins/s4/plugin_test.go index e0aa84183e1..b53ab40bfcb 100644 --- a/core/services/ocr2/plugins/s4/plugin_test.go +++ b/core/services/ocr2/plugins/s4/plugin_test.go @@ -322,7 +322,7 @@ func TestPlugin_Query(t *testing.T) { assert.Len(t, qq.Rows, 16) for _, r := range qq.Rows { thisAddress := s4.UnmarshalAddress(r.Address) - assert.True(t, ar.Contains((*big.Big)(thisAddress))) + assert.True(t, ar.Contains(thisAddress)) } ar.Advance() diff --git a/core/services/pipeline/models.go b/core/services/pipeline/models.go index e198c1b788c..d2c722f98b8 100644 --- a/core/services/pipeline/models.go +++ b/core/services/pipeline/models.go @@ -75,7 +75,7 @@ func (r *Run) SetID(value string) error { if err != nil { return err } - r.ID = int64(ID) + r.ID = ID return nil } diff --git a/core/services/pipeline/scheduler.go b/core/services/pipeline/scheduler.go index 7c6fd78d0c2..7663ed948ff 100644 --- a/core/services/pipeline/scheduler.go +++ b/core/services/pipeline/scheduler.go @@ -33,7 +33,7 @@ func (s *scheduler) newMemoryTaskRun(task Task, vars Vars) *memoryTaskRun { // if we're confident that indices are within range for _, i := range task.Inputs() { if i.PropagateResult { - inputs = append(inputs, input{index: int32(i.InputTask.OutputIndex()), result: s.results[i.InputTask.ID()].Result}) + inputs = append(inputs, input{index: i.InputTask.OutputIndex(), result: s.results[i.InputTask.ID()].Result}) } } sort.Slice(inputs, func(i, j int) bool { diff --git a/core/services/pipeline/task.bridge.go b/core/services/pipeline/task.bridge.go index fbf861857f5..f9490ea791d 100644 --- a/core/services/pipeline/task.bridge.go +++ b/core/services/pipeline/task.bridge.go @@ -74,7 +74,7 @@ var _ Task = (*BridgeTask)(nil) var zeroURL = new(url.URL) -const stalenessCap = time.Duration(30 * time.Minute) +const stalenessCap = 30 * time.Minute func (t *BridgeTask) Type() TaskType { return TaskTypeBridge @@ -166,7 +166,7 @@ func (t *BridgeTask) Run(ctx context.Context, lggr logger.Logger, vars Vars, inp } var cachedResponse bool - responseBytes, statusCode, headers, elapsed, err := makeHTTPRequest(requestCtx, lggr, "POST", URLParam(url), reqHeaders, requestData, t.httpClient, t.config.DefaultHTTPLimit()) + responseBytes, statusCode, headers, elapsed, err := makeHTTPRequest(requestCtx, lggr, "POST", url, reqHeaders, requestData, t.httpClient, t.config.DefaultHTTPLimit()) if err != nil { promBridgeErrors.WithLabelValues(t.Name).Inc() if cacheTTL == 0 { diff --git a/core/services/pipeline/task_params.go b/core/services/pipeline/task_params.go index 261728fbe9e..72d0d619429 100644 --- a/core/services/pipeline/task_params.go +++ b/core/services/pipeline/task_params.go @@ -334,7 +334,7 @@ func (p *MaybeInt32Param) UnmarshalPipelineParam(val interface{}) error { case int16: n = int32(v) case int32: - n = int32(v) + n = v case int64: if v > math.MaxInt32 || v < math.MinInt32 { return errors.Wrap(ErrBadInput, "overflows int32") @@ -764,7 +764,7 @@ func (p *MaybeBigIntParam) UnmarshalPipelineParam(val interface{}) error { case int32: n = big.NewInt(int64(v)) case int64: - n = big.NewInt(int64(v)) + n = big.NewInt(v) case float64: // when decoding from db: JSON numbers are floats if v < math.MinInt64 || v > math.MaxUint64 { return errors.Wrapf(ErrBadInput, "cannot cast %v to u/int64", v) diff --git a/core/services/relay/evm/mercury/config_digest_test.go b/core/services/relay/evm/mercury/config_digest_test.go index 3e94d075dce..fe718e92fe5 100644 --- a/core/services/relay/evm/mercury/config_digest_test.go +++ b/core/services/relay/evm/mercury/config_digest_test.go @@ -107,7 +107,7 @@ func GenHash(t *testing.T) gopter.Gen { array, ok := byteArray.(*gopter.GenResult).Retrieve() require.True(t, ok, "failed to retrieve gen result") for i, byteVal := range array.([]interface{}) { - rv[i] = byte(byteVal.(uint8)) + rv[i] = byteVal.(uint8) } return rv }, @@ -199,7 +199,7 @@ func GenBytes(t *testing.T) gopter.Gen { iArray := array.([]interface{}) rv := make([]byte, len(iArray)) for i, byteVal := range iArray { - rv[i] = byte(byteVal.(uint8)) + rv[i] = byteVal.(uint8) } return rv }, diff --git a/core/services/s4/storage_test.go b/core/services/s4/storage_test.go index 86161f298e4..199e3e6924b 100644 --- a/core/services/s4/storage_test.go +++ b/core/services/s4/storage_test.go @@ -52,7 +52,7 @@ func TestStorage_Errors(t *testing.T) { SlotId: 1, Version: 0, } - ormMock.On("Get", big.New(key.Address.Big()), uint(key.SlotId), mock.Anything).Return(nil, s4.ErrNotFound) + ormMock.On("Get", big.New(key.Address.Big()), key.SlotId, mock.Anything).Return(nil, s4.ErrNotFound) _, _, err := storage.Get(testutils.Context(t), key) assert.ErrorIs(t, err, s4.ErrNotFound) }) diff --git a/core/services/signatures/secp256k1/field.go b/core/services/signatures/secp256k1/field.go index 1ff0d062f3c..bf9652e5dbd 100644 --- a/core/services/signatures/secp256k1/field.go +++ b/core/services/signatures/secp256k1/field.go @@ -49,7 +49,7 @@ func (f *fieldElt) modQ() *fieldElt { func fieldEltFromBigInt(v *big.Int) *fieldElt { return (*fieldElt)(v).modQ() } func fieldEltFromInt(v int64) *fieldElt { - return fieldEltFromBigInt(big.NewInt(int64(v))).modQ() + return fieldEltFromBigInt(big.NewInt(v)).modQ() } var fieldZero = fieldEltFromInt(0) diff --git a/core/services/streams/delegate.go b/core/services/streams/delegate.go index 3b9b5c773ae..b62ceb9857b 100644 --- a/core/services/streams/delegate.go +++ b/core/services/streams/delegate.go @@ -47,7 +47,7 @@ func (d *Delegate) ServicesForSpec(jb job.Job) (services []job.ServiceCtx, err e if !jb.Name.Valid { return nil, errors.New("job name is required to be present for stream specs") } - id := StreamID(jb.Name.String) + id := jb.Name.String lggr := d.lggr.Named(id).With("streamID", id) rrs := ocrcommon.NewResultRunSaver(d.runner, lggr, d.cfg.MaxSuccessfulRuns(), d.cfg.ResultWriteQueueDepth()) diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 591ca3e9508..8ad88d7b73b 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -693,7 +693,7 @@ func Test_VRFV2PlusServiceFailsWhenVRFOwnerProvided(t *testing.T) { vs := testspecs.GenerateVRFSpec(testspecs.VRFSpecParams{ VRFVersion: vrfcommon.V2Plus, PublicKey: vuni.vrfkey.PublicKey.String(), - FromAddresses: []string{string(vuni.submitter.Hex())}, + FromAddresses: []string{vuni.submitter.Hex()}, GasLanePrice: chain.Config().EVM().GasEstimator().PriceMax(), }) toml := "vrfOwnerAddress=\"0xF62fEFb54a0af9D32CDF0Db21C52710844c7eddb\"\n" + vs.Toml() diff --git a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go index 3603230fea0..24639af2f0d 100644 --- a/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go +++ b/core/services/vrf/solidity_cross_tests/vrf_coordinator_interface.go @@ -35,7 +35,7 @@ func toGethLog(log types.Log) types.Log { return types.Log{ Address: log.Address, Topics: log.Topics, - Data: []byte(log.Data), + Data: log.Data, BlockNumber: log.BlockNumber, TxHash: log.TxHash, TxIndex: log.TxIndex, diff --git a/core/web/chains_controller.go b/core/web/chains_controller.go index 4caa3460857..61c8d1dc84d 100644 --- a/core/web/chains_controller.go +++ b/core/web/chains_controller.go @@ -45,7 +45,7 @@ func newChainsController[R jsonapi.EntityNamer](network relay.Network, chainStat newResource func(types.ChainStatus) R, lggr logger.Logger, auditLogger audit.AuditLogger) *chainsController[R] { return &chainsController[R]{ network: network, - resourceName: string(network) + "_chain", + resourceName: network + "_chain", chainStats: chainStats, errNotEnabled: errNotEnabled, newResource: newResource, diff --git a/core/web/presenters/user.go b/core/web/presenters/user.go index 19ccff960ac..7598c8864be 100644 --- a/core/web/presenters/user.go +++ b/core/web/presenters/user.go @@ -32,7 +32,7 @@ func NewUserResource(u sessions.User) *UserResource { return &UserResource{ JAID: NewJAID(u.Email), Email: u.Email, - Role: sessions.UserRole(u.Role), + Role: u.Role, HasActiveApiToken: hasToken, CreatedAt: u.CreatedAt, UpdatedAt: u.UpdatedAt, diff --git a/core/web/resolver/spec.go b/core/web/resolver/spec.go index 5e8937dbb96..b1cb32783f9 100644 --- a/core/web/resolver/spec.go +++ b/core/web/resolver/spec.go @@ -521,7 +521,7 @@ func (r *OCR2SpecResolver) P2PV2Bootstrappers() *[]string { // Relay resolves the spec's relay func (r *OCR2SpecResolver) Relay() string { - return string(r.spec.Relay) + return r.spec.Relay } // RelayConfig resolves the spec's relay config @@ -899,7 +899,7 @@ func (r *BootstrapSpecResolver) ContractID() string { // Relay resolves the spec's relay func (r *BootstrapSpecResolver) Relay() string { - return string(r.spec.Relay) + return r.spec.Relay } // RelayConfig resolves the spec's relay config diff --git a/core/web/resolver/spec_test.go b/core/web/resolver/spec_test.go index a4fb9cdb338..828e8538071 100644 --- a/core/web/resolver/spec_test.go +++ b/core/web/resolver/spec_test.go @@ -163,10 +163,10 @@ func TestResolver_FluxMonitorSpec(t *testing.T) { EVMChainID: ubig.NewI(42), DrumbeatEnabled: false, IdleTimerDisabled: false, - IdleTimerPeriod: time.Duration(1 * time.Hour), + IdleTimerPeriod: 1 * time.Hour, MinPayment: commonassets.NewLinkFromJuels(1000), PollTimerDisabled: false, - PollTimerPeriod: time.Duration(1 * time.Minute), + PollTimerPeriod: 1 * time.Minute, }, }, nil) }, @@ -229,13 +229,13 @@ func TestResolver_FluxMonitorSpec(t *testing.T) { CreatedAt: f.Timestamp(), EVMChainID: ubig.NewI(42), DrumbeatEnabled: true, - DrumbeatRandomDelay: time.Duration(1 * time.Second), + DrumbeatRandomDelay: 1 * time.Second, DrumbeatSchedule: "CRON_TZ=UTC 0 0 1 1 *", IdleTimerDisabled: true, - IdleTimerPeriod: time.Duration(1 * time.Hour), + IdleTimerPeriod: 1 * time.Hour, MinPayment: commonassets.NewLinkFromJuels(1000), PollTimerDisabled: true, - PollTimerPeriod: time.Duration(1 * time.Minute), + PollTimerPeriod: 1 * time.Minute, }, }, nil) },