diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index 86943fe88..ce2d64dd9 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_versions: [ '1.21', '1.22' ] + go_versions: [ '1.22', '1.23' ] steps: - uses: actions/checkout@v3 diff --git a/.forgejo/workflows/pre-commit.yml b/.forgejo/workflows/pre-commit.yml index 117cda93b..8b06a2fdf 100644 --- a/.forgejo/workflows/pre-commit.yml +++ b/.forgejo/workflows/pre-commit.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.22 + go-version: 1.23 - name: Set up Python run: | apt update diff --git a/.forgejo/workflows/tests.yml b/.forgejo/workflows/tests.yml index 5d64d7bc4..a908c6278 100644 --- a/.forgejo/workflows/tests.yml +++ b/.forgejo/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.22' + go-version: '1.23' cache: true - name: Install linters @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_versions: [ '1.21', '1.22' ] + go_versions: [ '1.22', '1.23' ] fail-fast: false steps: - uses: actions/checkout@v3 @@ -48,7 +48,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.21' + go-version: '1.22' cache: true - name: Run tests @@ -63,7 +63,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.22' + go-version: '1.23' cache: true - name: Install staticcheck @@ -81,7 +81,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.21' + go-version: '1.22' cache: true - name: Install gopls @@ -99,7 +99,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.22' + go-version: '1.23' cache: true - name: Install gofumpt diff --git a/.forgejo/workflows/vulncheck.yml b/.forgejo/workflows/vulncheck.yml index 3af564c4b..2951a8059 100644 --- a/.forgejo/workflows/vulncheck.yml +++ b/.forgejo/workflows/vulncheck.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: '1.22' + go-version: '1.23' - name: Install govulncheck run: go install golang.org/x/vuln/cmd/govulncheck@latest diff --git a/.golangci.yml b/.golangci.yml index d209693aa..2e9e78fc3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -12,7 +12,8 @@ run: # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" - format: tab + formats: + - format: tab # all available settings of specific linters linters-settings: diff --git a/Makefile b/Makefile index 11111d9a7..8d1238b6f 100755 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ HUB_IMAGE ?= truecloudlab/frostfs HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" GO_VERSION ?= 1.22 -LINT_VERSION ?= 1.56.1 -TRUECLOUDLAB_LINT_VERSION ?= 0.0.5 +LINT_VERSION ?= 1.60.1 +TRUECLOUDLAB_LINT_VERSION ?= 0.0.6 PROTOC_VERSION ?= 25.0 PROTOC_GEN_GO_VERSION ?= $(shell go list -f '{{.Version}}' -m google.golang.org/protobuf) PROTOGEN_FROSTFS_VERSION ?= $(shell go list -f '{{.Version}}' -m git.frostfs.info/TrueCloudLab/frostfs-api-go/v2) @@ -17,7 +17,7 @@ PROTOC_OS_VERSION=osx-x86_64 ifeq ($(shell uname), Linux) PROTOC_OS_VERSION=linux-x86_64 endif -STATICCHECK_VERSION ?= 2023.1.6 +STATICCHECK_VERSION ?= 2024.1.1 ARCH = amd64 BIN = bin @@ -46,7 +46,7 @@ STATICCHECK_VERSION_DIR ?= $(STATICCHECK_DIR)/$(STATICCHECK_VERSION) SOURCES = $(shell find . -type f -name "*.go" -print) -GOFUMPT_VERSION ?= v0.6.0 +GOFUMPT_VERSION ?= v0.7.0 GOFUMPT_DIR ?= $(abspath $(BIN))/gofumpt GOFUMPT_VERSION_DIR ?= $(GOFUMPT_DIR)/$(GOFUMPT_VERSION) diff --git a/README.md b/README.md index 413010372..8225f56c5 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ The latest version of frostfs-node works with frostfs-contract # Building -To make all binaries you need Go 1.21+ and `make`: +To make all binaries you need Go 1.22+ and `make`: ``` make all ``` diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go index 1af27d733..110281418 100644 --- a/cmd/frostfs-node/config.go +++ b/cmd/frostfs-node/config.go @@ -1073,7 +1073,7 @@ func initLocalStorage(ctx context.Context, c *cfg) { c.onShutdown(func() { c.log.Info(logs.FrostFSNodeClosingComponentsOfTheStorageEngine) - err := ls.Close(context.Background()) + err := ls.Close(context.WithoutCancel(ctx)) if err != nil { c.log.Info(logs.FrostFSNodeStorageEngineClosingFailure, zap.String("error", err.Error()), diff --git a/cmd/frostfs-node/tracing.go b/cmd/frostfs-node/tracing.go index 312adfb8d..675c31374 100644 --- a/cmd/frostfs-node/tracing.go +++ b/cmd/frostfs-node/tracing.go @@ -21,7 +21,7 @@ func initTracing(ctx context.Context, c *cfg) { c.closers = append(c.closers, closer{ name: "tracing", fn: func() { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + ctx, cancel := context.WithTimeout(context.WithoutCancel(ctx), time.Second*5) defer cancel() err := tracing.Shutdown(ctx) // cfg context cancels before close if err != nil { diff --git a/go.mod b/go.mod index 93ed7d750..79dcc9553 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.frostfs.info/TrueCloudLab/frostfs-node -go 1.21 +go 1.22 require ( code.gitea.io/sdk/gitea v0.17.1 diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go index c08e39bf1..5d14a9a3a 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go @@ -27,21 +27,21 @@ type objectDesc struct { storageID []byte } -func TestAll(t *testing.T, cons Constructor, min, max uint64) { +func TestAll(t *testing.T, cons Constructor, minSize, maxSize uint64) { t.Run("get", func(t *testing.T) { - TestGet(t, cons, min, max) + TestGet(t, cons, minSize, maxSize) }) t.Run("get range", func(t *testing.T) { - TestGetRange(t, cons, min, max) + TestGetRange(t, cons, minSize, maxSize) }) t.Run("delete", func(t *testing.T) { - TestDelete(t, cons, min, max) + TestDelete(t, cons, minSize, maxSize) }) t.Run("exists", func(t *testing.T) { - TestExists(t, cons, min, max) + TestExists(t, cons, minSize, maxSize) }) t.Run("iterate", func(t *testing.T) { - TestIterate(t, cons, min, max) + TestIterate(t, cons, minSize, maxSize) }) } @@ -51,12 +51,12 @@ func TestInfo(t *testing.T, cons Constructor, expectedType string, expectedPath require.Equal(t, expectedPath, s.Path()) } -func prepare(t *testing.T, count int, s common.Storage, min, max uint64) []objectDesc { +func prepare(t *testing.T, count int, s common.Storage, minSize, maxSize uint64) []objectDesc { objects := make([]objectDesc, count) r := mrand.New(mrand.NewSource(0)) for i := range objects { - objects[i].obj = NewObject(min + uint64(r.Intn(int(max-min+1)))) // not too large + objects[i].obj = NewObject(minSize + uint64(r.Intn(int(maxSize-minSize+1)))) // not too large objects[i].addr = objectCore.AddressOf(objects[i].obj) raw, err := objects[i].obj.Marshal() diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/control.go b/pkg/local_object_storage/blobstor/internal/blobstortest/control.go index a3bbc021d..21c80b089 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/control.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/control.go @@ -13,12 +13,12 @@ import ( // TestControl checks correctness of a read-only mode. // cons must return a storage which is NOT opened. -func TestControl(t *testing.T, cons Constructor, min, max uint64) { +func TestControl(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) - objects := prepare(t, 10, s, min, max) + objects := prepare(t, 10, s, minSize, maxSize) require.NoError(t, s.Close()) require.NoError(t, s.Open(mode.ComponentReadOnly)) @@ -34,7 +34,7 @@ func TestControl(t *testing.T, cons Constructor, min, max uint64) { t.Run("put fails", func(t *testing.T) { var prm common.PutPrm - prm.Object = NewObject(min + uint64(rand.Intn(int(max-min+1)))) + prm.Object = NewObject(minSize + uint64(rand.Intn(int(maxSize-minSize+1)))) prm.Address = objectCore.AddressOf(prm.Object) _, err := s.Put(context.Background(), prm) diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go b/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go index 750619a30..cf4e76513 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/require" ) -func TestDelete(t *testing.T, cons Constructor, min, max uint64) { +func TestDelete(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) defer func() { require.NoError(t, s.Close()) }() - objects := prepare(t, 4, s, min, max) + objects := prepare(t, 4, s, minSize, maxSize) t.Run("delete non-existent", func(t *testing.T) { var prm common.DeletePrm diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go b/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go index 33b50b12f..08465ed5e 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/require" ) -func TestExists(t *testing.T, cons Constructor, min, max uint64) { +func TestExists(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) defer func() { require.NoError(t, s.Close()) }() - objects := prepare(t, 1, s, min, max) + objects := prepare(t, 1, s, minSize, maxSize) t.Run("missing object", func(t *testing.T) { prm := common.ExistsPrm{Address: oidtest.Address()} diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/get.go b/pkg/local_object_storage/blobstor/internal/blobstortest/get.go index 12f73c3e9..d1f709b0c 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/get.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/get.go @@ -11,13 +11,13 @@ import ( "github.com/stretchr/testify/require" ) -func TestGet(t *testing.T, cons Constructor, min, max uint64) { +func TestGet(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) defer func() { require.NoError(t, s.Close()) }() - objects := prepare(t, 2, s, min, max) + objects := prepare(t, 2, s, minSize, maxSize) t.Run("missing object", func(t *testing.T) { gPrm := common.GetPrm{Address: oidtest.Address()} diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go b/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go index 93de683c2..fcbeddac7 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go @@ -13,13 +13,13 @@ import ( "github.com/stretchr/testify/require" ) -func TestGetRange(t *testing.T, cons Constructor, min, max uint64) { +func TestGetRange(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) defer func() { require.NoError(t, s.Close()) }() - objects := prepare(t, 1, s, min, max) + objects := prepare(t, 1, s, minSize, maxSize) t.Run("missing object", func(t *testing.T) { gPrm := common.GetRangePrm{Address: oidtest.Address()} diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go b/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go index e66fe87b6..3a6c8b699 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/require" ) -func TestIterate(t *testing.T, cons Constructor, min, max uint64) { +func TestIterate(t *testing.T, cons Constructor, minSize, maxSize uint64) { s := cons(t) require.NoError(t, s.Open(mode.ComponentReadWrite)) require.NoError(t, s.Init()) defer func() { require.NoError(t, s.Close()) }() - objects := prepare(t, 10, s, min, max) + objects := prepare(t, 10, s, minSize, maxSize) // Delete random object to ensure it is not iterated over. const delID = 2 diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 4865b43ef..616b3b5c3 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -641,8 +641,8 @@ func (c *Client) notaryTxValidationLimit() (uint32, error) { return 0, fmt.Errorf("can't get current blockchain height: %w", err) } - min := bc + c.notary.txValidTime - rounded := (min/c.notary.roundTime + 1) * c.notary.roundTime + minTime := bc + c.notary.txValidTime + rounded := (minTime/c.notary.roundTime + 1) * c.notary.roundTime return rounded, nil }