From b8a978d191ca0936706037c47460dd0018fa846e Mon Sep 17 00:00:00 2001 From: Ljubisa Gacevic Date: Mon, 2 Dec 2024 14:53:56 +0100 Subject: [PATCH] chore: bump golangci-lint to v1.61.0 --- .github/workflows/lint.yml | 2 +- .golangci.yml | 3 +-- Makefile | 2 +- pkg/funder/export_test.go | 4 ++-- pkg/funder/funder.go | 5 +++-- pkg/funder/node_lister.go | 1 + pkg/funder/staker.go | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0fcd6e8..9f45f35 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,4 +13,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.56.2 + version: v1.61.0 diff --git a/.golangci.yml b/.golangci.yml index 64bb190..b163c4f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,13 +4,12 @@ linters: enable: - asciicheck - bidichk - # - depguard + - copyloopvar - dogsled - durationcheck - errcheck - errname - errorlint - - exportloopref - forbidigo - gochecknoinits - goconst diff --git a/Makefile b/Makefile index 3007bba..735223e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ GO ?= go GOBIN ?= $$($(GO) env GOPATH)/bin GOLANGCI_LINT ?= $(GOBIN)/golangci-lint -GOLANGCI_LINT_VERSION ?= v1.51.0 +GOLANGCI_LINT_VERSION ?= v1.61.0 .PHONY: get-golangcilint get-golangcilint: diff --git a/pkg/funder/export_test.go b/pkg/funder/export_test.go index 9448de0..65c2439 100644 --- a/pkg/funder/export_test.go +++ b/pkg/funder/export_test.go @@ -6,8 +6,8 @@ package funder import "math/big" -func CalcTopUpAmount(min float64, currAmount *big.Int, decimals int) *big.Int { - return calcTopUpAmount(min, currAmount, decimals) +func CalcTopUpAmount(minVal float64, currAmount *big.Int, decimals int) *big.Int { + return calcTopUpAmount(minVal, currAmount, decimals) } func FormatAmount(amount *big.Int, decimals int) string { diff --git a/pkg/funder/funder.go b/pkg/funder/funder.go index dbcec62..fea4e97 100644 --- a/pkg/funder/funder.go +++ b/pkg/funder/funder.go @@ -95,6 +95,7 @@ func fundNamespace( if err != nil { return fmt.Errorf("failed to fetch chainID from ChainNodeEndpoint: %w", err) } + log.Infof("using specified ChainNodeEndpoint to retrieve funding chainID: %d", chainID) } @@ -325,10 +326,10 @@ func topUpWallet( return topUpAmount, nil } -func calcTopUpAmount(min float64, currAmount *big.Int, decimals int) *big.Int { +func calcTopUpAmount(minVal float64, currAmount *big.Int, decimals int) *big.Int { exp := big.NewInt(0).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) - minAmount := big.NewFloat(min) + minAmount := big.NewFloat(minVal) minAmount = minAmount.Mul( minAmount, big.NewFloat(0).SetInt(exp), diff --git a/pkg/funder/node_lister.go b/pkg/funder/node_lister.go index 5c92d79..905b85a 100644 --- a/pkg/funder/node_lister.go +++ b/pkg/funder/node_lister.go @@ -99,6 +99,7 @@ func fetchNamespaceNodeInfo(ctx context.Context, namespace string, chainID int64 } walletInfoResponseC := make(chan walletInfoResponse, len(nodes)) + for _, nodeInfo := range nodes { go func(nodeInfo NodeInfo) { if chainID == 0 { diff --git a/pkg/funder/staker.go b/pkg/funder/staker.go index 184c2a0..c29274d 100644 --- a/pkg/funder/staker.go +++ b/pkg/funder/staker.go @@ -54,7 +54,7 @@ func Stake(ctx context.Context, cfg Config, nl NodeLister, options ...FunderOpti return nil } -func stakeAllNodes(ctx context.Context, nodes []NodeInfo, min float64, log logging.Logger) { +func stakeAllNodes(ctx context.Context, nodes []NodeInfo, minVal float64, log logging.Logger) { wg := sync.WaitGroup{} wg.Add(len(nodes)) @@ -70,7 +70,7 @@ func stakeAllNodes(ctx context.Context, nodes []NodeInfo, min float64, log loggi return } - amount := calcTopUpAmount(min, si.StakedAmount, wallet.SwarmTokenDecimals) + amount := calcTopUpAmount(minVal, si.StakedAmount, wallet.SwarmTokenDecimals) if amount.Cmp(big.NewInt(0)) <= 0 { skipped.Add(1) log.Infof("node[%s] - already staked", node.Name)