diff --git a/.github/workflows/juno-lint.yml b/.github/workflows/juno-lint.yml index c3455f1b4b..4656de7414 100644 --- a/.github/workflows/juno-lint.yml +++ b/.github/workflows/juno-lint.yml @@ -25,4 +25,4 @@ jobs: uses: golangci/golangci-lint-action@v3 with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: v1.56.2 \ No newline at end of file + version: v1.59.1 diff --git a/.golangci.yaml b/.golangci.yaml index 41570fb51a..8838350c20 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -31,7 +31,7 @@ linters-settings: min-complexity: 15 goimports: local-prefixes: github.com/golangci/golangci-lint - gomnd: + mnd: # don't include the "operation" and "assign" checks: - argument @@ -39,15 +39,15 @@ linters-settings: - condition - return ignored-numbers: - - '0' - - '1' - - '2' - - '3' + - "0" + - "1" + - "2" + - "3" ignored-functions: - strings.SplitN govet: - check-shadowing: true + shadow: true settings: printf: funcs: @@ -82,7 +82,7 @@ linters: - gocritic - gocyclo - gofumpt - - gomnd + - mnd - goprintffuncname - gosec - gosimple @@ -127,7 +127,7 @@ issues: exclude-rules: - path: _test\.go linters: - - gomnd + - mnd - funlen - lll - gosec @@ -156,11 +156,11 @@ issues: text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - path: pkg/golinters/unused.go text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - -run: - timeout: 5m - skip-dirs: + exclude-dirs: - test/testdata_etc # test files - internal/cache # extracted from Go code - internal/renameio # extracted from Go code - internal/robustio # extracted from Go code + +run: + timeout: 5m diff --git a/Makefile b/Makefile index d7ea372b18..645e0d2c83 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ install-mockgen: go install go.uber.org/mock/mockgen@latest install-golangci-lint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.56.2 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 lint: @which golangci-lint || make install-golangci-lint diff --git a/core/transaction.go b/core/transaction.go index ac0b8cdffb..bb7f2d8661 100644 --- a/core/transaction.go +++ b/core/transaction.go @@ -64,7 +64,7 @@ type ResourceBounds struct { } func (rb ResourceBounds) Bytes(resource Resource) []byte { - maxAmountBytes := make([]byte, 8) //nolint:gomnd + maxAmountBytes := make([]byte, 8) //nolint:mnd binary.BigEndian.PutUint64(maxAmountBytes, rb.MaxAmount) maxPriceBytes := rb.MaxPricePerUnit.Bytes() return slices.Concat( diff --git a/core/trie/key.go b/core/trie/key.go index db60754fb7..7f0e6af609 100644 --- a/core/trie/key.go +++ b/core/trie/key.go @@ -30,7 +30,7 @@ func (k *Key) SubKey(n uint8) (*Key, error) { } newKey := &Key{len: n} - copy(newKey.bitset[:], k.bitset[len(k.bitset)-int((k.len+7)/8):]) //nolint:gomnd + copy(newKey.bitset[:], k.bitset[len(k.bitset)-int((k.len+7)/8):]) //nolint:mnd // Shift right by the number of bits that are not needed shift := k.len - n diff --git a/core/trie/proof.go b/core/trie/proof.go index 6a9d7eb099..f8f0e325ad 100644 --- a/core/trie/proof.go +++ b/core/trie/proof.go @@ -201,7 +201,7 @@ func VerifyProof(root *felt.Felt, key *Key, value *felt.Felt, proofs []ProofNode return false } expectedHash = proofNode.Edge.Child - remainingPath.Truncate(251 - proofNode.Edge.Path.Len()) //nolint:gomnd + remainingPath.Truncate(251 - proofNode.Edge.Path.Len()) //nolint:mnd } } @@ -369,7 +369,7 @@ func ProofToPath(proofNodes []ProofNode, leafKey *Key, hashF hashFunc) ([]Storag } // Don't store leafs along proof paths - if parentKey.len == 251 { //nolint:gomnd + if parentKey.len == 251 { //nolint:mnd break } @@ -458,7 +458,7 @@ func getChildKey(childIdx int, crntKey, leafKey, nilKey *Key, proofNodes []Proof return nil, err } - if crntKey.len+uint8(compressChild)+compressChildOffset == 251 { //nolint:gomnd + if crntKey.len+uint8(compressChild)+compressChildOffset == 251 { //nolint:mnd return nilKey, nil } @@ -467,7 +467,7 @@ func getChildKey(childIdx int, crntKey, leafKey, nilKey *Key, proofNodes []Proof // BuildTrie builds a trie using the proof paths (including inner nodes), and then sets all the keys-values (leaves) func BuildTrie(leftProofPath, rightProofPath []StorageNode, keys, values []*felt.Felt) (*Trie, error) { //nolint:gocyclo - tempTrie, err := NewTriePedersen(newMemStorage(), 251) //nolint:gomnd + tempTrie, err := NewTriePedersen(newMemStorage(), 251) //nolint:mnd if err != nil { return nil, err } diff --git a/migration/migration.go b/migration/migration.go index 11e00c9c34..3c75bdd575 100644 --- a/migration/migration.go +++ b/migration/migration.go @@ -63,8 +63,8 @@ var defaultMigrations = []Migration{ NewBucketMigrator(db.ContractStorage, migrateTrieNodesFromBitsetToTrieKey(db.ContractStorage)). WithKeyFilter(nodesFilter(db.ContractStorage)), NewBucketMover(db.Temporary, db.ContractStorage), - NewBucketMigrator(db.StateUpdatesByBlockNumber, changeStateDiffStruct).WithBatchSize(100), //nolint:gomnd - NewBucketMigrator(db.Class, migrateCairo1CompiledClass).WithBatchSize(1_000), //nolint:gomnd + NewBucketMigrator(db.StateUpdatesByBlockNumber, changeStateDiffStruct).WithBatchSize(100), //nolint:mnd + NewBucketMigrator(db.Class, migrateCairo1CompiledClass).WithBatchSize(1_000), //nolint:mnd } var ErrCallWithNewTransaction = errors.New("call with new transaction") diff --git a/utils/log_test.go b/utils/log_test.go index 5f77b2735d..8a5954b872 100644 --- a/utils/log_test.go +++ b/utils/log_test.go @@ -20,7 +20,7 @@ var levelStrings = map[utils.LogLevel]string{ func TestLogLevelString(t *testing.T) { for level, str := range levelStrings { - t.Run("level "+str, func(t *testing.T) { //nolint:goconst + t.Run("level "+str, func(t *testing.T) { assert.Equal(t, str, level.String()) }) } diff --git a/utils/network.go b/utils/network.go index 430510e6fb..c0988c82f6 100644 --- a/utils/network.go +++ b/utils/network.go @@ -59,7 +59,7 @@ var ( FeederURL: "https://alpha4.starknet.io/feeder_gateway/", GatewayURL: "https://alpha4.starknet.io/gateway/", L2ChainID: "SN_GOERLI", - //nolint:gomnd + //nolint:mnd L1ChainID: big.NewInt(5), CoreContractAddress: common.HexToAddress("0xde29d060D45901Fb19ED6C6e959EB22d8626708e"), BlockHashMetaInfo: &BlockHashMetaInfo{ @@ -73,7 +73,7 @@ var ( FeederURL: "https://alpha4-2.starknet.io/feeder_gateway/", GatewayURL: "https://alpha4-2.starknet.io/gateway/", L2ChainID: "SN_GOERLI2", - //nolint:gomnd + //nolint:mnd L1ChainID: big.NewInt(5), CoreContractAddress: common.HexToAddress("0xa4eD3aD27c294565cB0DCc993BDdCC75432D498c"), BlockHashMetaInfo: &BlockHashMetaInfo{ @@ -86,7 +86,7 @@ var ( FeederURL: "https://external.integration.starknet.io/feeder_gateway/", GatewayURL: "https://external.integration.starknet.io/gateway/", L2ChainID: "SN_GOERLI", - //nolint:gomnd + //nolint:mnd L1ChainID: big.NewInt(5), CoreContractAddress: common.HexToAddress("0xd5c325D183C592C94998000C5e0EED9e6655c020"), BlockHashMetaInfo: &BlockHashMetaInfo{ @@ -100,7 +100,7 @@ var ( FeederURL: "https://alpha-sepolia.starknet.io/feeder_gateway/", GatewayURL: "https://alpha-sepolia.starknet.io/gateway/", L2ChainID: "SN_SEPOLIA", - //nolint:gomnd + //nolint:mnd L1ChainID: big.NewInt(11155111), CoreContractAddress: common.HexToAddress("0xE2Bb56ee936fd6433DC0F6e7e3b8365C906AA057"), BlockHashMetaInfo: &BlockHashMetaInfo{ @@ -113,7 +113,7 @@ var ( FeederURL: "https://integration-sepolia.starknet.io/feeder_gateway/", GatewayURL: "https://integration-sepolia.starknet.io/gateway/", L2ChainID: "SN_INTEGRATION_SEPOLIA", - //nolint:gomnd + //nolint:mnd L1ChainID: big.NewInt(11155111), CoreContractAddress: common.HexToAddress("0x4737c0c1B4D5b1A687B42610DdabEE781152359c"), BlockHashMetaInfo: &BlockHashMetaInfo{ diff --git a/utils/network_test.go b/utils/network_test.go index 6922969858..778f66545b 100644 --- a/utils/network_test.go +++ b/utils/network_test.go @@ -86,7 +86,7 @@ func TestNetwork(t *testing.T) { //nolint:dupl // see comment in utils/log_test.go func TestNetworkSet(t *testing.T) { for network, str := range networkStrings { - t.Run("network "+str, func(t *testing.T) { //nolint:goconst + t.Run("network "+str, func(t *testing.T) { n := new(utils.Network) require.NoError(t, n.Set(str)) assert.Equal(t, network, *n)