diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3366e437a..46bf7fc9e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,27 +13,36 @@ concurrency: jobs: golangci: - name: golangci-lint - runs-on: ubuntu-latest - timeout-minutes: 6 + name: Run golangci-lint + runs-on: macos-latest + timeout-minutes: 120 steps: - uses: actions/setup-go@v3 with: - go-version: 1.22 - - uses: actions/checkout@v4 + go-version: '1.22.7' + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v23 with: - submodules: true + nix_path: nixpkgs=channel:nixos-22.11 + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - id: changed-files uses: tj-actions/changed-files@v41 with: files: | **/*.go - go.mod - go.sum - - uses: golangci/golangci-lint-action@v3 - with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.55 - args: --timeout 10m - github-token: ${{ secrets.github_token }} + *.mod + *.sum + - name: run golangci-lint + run: | + nix profile install -f ./nix golangci-lint + nix profile install -f ./nix rocksdb + export PKG_CONFIG_PATH=$HOME/.nix-profile/lib/pkgconfig + export CGO_CFLAGS="$(pkg-config --cflags rocksdb)" CGO_LDFLAGS="$(pkg-config --libs rocksdb)" + golangci-lint version + + BUILD_TAGS=rocksdb,grocksdb_clean_link + go build -tags $BUILD_TAGS ./cmd/chain-maind + golangci-lint run --out-format=github-actions --path-prefix=./ --timeout 30m --build-tags $BUILD_TAGS + # Check only if there are differences in the source code if: steps.changed-files.outputs.any_changed == 'true' diff --git a/x/chainmain/client/cli/genaccounts.go b/x/chainmain/client/cli/genaccounts.go index fabe8345b..999584710 100644 --- a/x/chainmain/client/cli/genaccounts.go +++ b/x/chainmain/client/cli/genaccounts.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "math" "strconv" "time" @@ -92,9 +91,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa return fmt.Errorf("failed to parse vesting start: %w", errstart) } } else { - if vestingStartUint > math.MaxInt64 { - return fmt.Errorf("vestingStartUint: %d exceeds int64 maximum value", vestingStartUint) - } vestingStart = int64(vestingStartUint) } @@ -110,9 +106,6 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa return fmt.Errorf("failed to parse vesting end: %w", errend) } } else { - if vestingEndUint > math.MaxInt64 { - return fmt.Errorf("vestingEndUint: %d exceeds int64 maximum value", vestingEndUint) - } vestingEnd = int64(vestingEndUint) } diff --git a/x/chainmain/client/cli/testnet.go b/x/chainmain/client/cli/testnet.go index 4992f8a5e..96c33f680 100644 --- a/x/chainmain/client/cli/testnet.go +++ b/x/chainmain/client/cli/testnet.go @@ -8,7 +8,6 @@ import ( "encoding/json" "errors" "fmt" - "math" "net" "os" "path/filepath" @@ -106,9 +105,6 @@ Example: if numValidatorsErr != nil { return fmt.Errorf("failed to parse %v: %w", flagNumValidators, numValidatorsErr) } - if numValidators > uint(math.MaxInt64) { - return fmt.Errorf("numValidators %v cannot exceed %v", numValidators, math.MaxInt64) - } algo, algoErr := cmd.Flags().GetString(flags.FlagKeyType) if algoErr != nil { return fmt.Errorf("failed to parse %v: %w", flags.FlagKeyType, algoErr) diff --git a/x/nft/keeper/grpc_query_test.go b/x/nft/keeper/grpc_query_test.go index 9bb60e64b..3b57c76ed 100644 --- a/x/nft/keeper/grpc_query_test.go +++ b/x/nft/keeper/grpc_query_test.go @@ -18,7 +18,7 @@ func (suite *KeeperSuite) TestSupply() { }) suite.NoError(err) - suite.Equal(1, int(response.Amount)) //nolint:gosec // test only + suite.Equal(1, int(response.Amount)) } func (suite *KeeperSuite) TestOwner() { diff --git a/x/nft/keeper/invariants.go b/x/nft/keeper/invariants.go index 9e9cdaf17..ead966442 100644 --- a/x/nft/keeper/invariants.go +++ b/x/nft/keeper/invariants.go @@ -38,11 +38,7 @@ func SupplyInvariant(k Keeper) sdk.Invariant { for _, owner := range owners { for _, idCollection := range owner.IDCollections { - supply := idCollection.Supply() - if supply < 0 { - return sdk.FormatInvariant(types.ModuleName, "supply", fmt.Sprintf("invalid supply: %d", supply)), true - } - ownersCollectionsSupply[idCollection.DenomId] += uint64(supply) + ownersCollectionsSupply[idCollection.DenomId] += uint64(idCollection.Supply()) } }