From 584fc4ab354f00f661ba9178baf4b70d862e501b Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 20 Aug 2024 13:29:32 +0300 Subject: [PATCH 1/4] *: don't use min/max for vars They're special since Go 1.22, so linter isn't happy about their use: Error: param min has same name as predeclared identifier (predeclared) Error: param max has same name as predeclared identifier (predeclared) Error: variable min has same name as predeclared identifier (predeclared) Error: variable max has same name as predeclared identifier (predeclared) Signed-off-by: Roman Khimov --- pkg/innerring/config.go | 10 +++++----- .../blobstor/internal/blobstortest/common.go | 16 ++++++++-------- .../blobstor/internal/blobstortest/control.go | 6 +++--- .../blobstor/internal/blobstortest/delete.go | 4 ++-- .../blobstor/internal/blobstortest/exists.go | 4 ++-- .../blobstor/internal/blobstortest/get.go | 4 ++-- .../blobstor/internal/blobstortest/get_range.go | 4 ++-- .../blobstor/internal/blobstortest/iterate.go | 4 ++-- pkg/local_object_storage/engine/evacuate_test.go | 4 ++-- pkg/morph/client/notary.go | 4 ++-- pkg/services/audit/auditor/pdp.go | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pkg/innerring/config.go b/pkg/innerring/config.go index d0e8ba18f7..9e44c279ac 100644 --- a/pkg/innerring/config.go +++ b/pkg/innerring/config.go @@ -305,17 +305,17 @@ func parseConfigUint64Condition(v *viper.Viper, key, desc string, cond func(uint return res, nil } -func parseConfigUint64Range(v *viper.Viper, key, desc string, min, max uint64) (uint64, error) { +func parseConfigUint64Range(v *viper.Viper, key, desc string, minV, maxV uint64) (uint64, error) { return parseConfigUint64Condition(v, key, desc, func(val uint64) error { - if val < min || val > max { - return fmt.Errorf("out of allowable range [%d:%d]", min, max) + if val < minV || val > maxV { + return fmt.Errorf("out of allowable range [%d:%d]", minV, maxV) } return nil }) } -func parseConfigUint64Max(v *viper.Viper, key, desc string, max uint64) (uint64, error) { - return parseConfigUint64Range(v, key, desc, 0, max) +func parseConfigUint64Max(v *viper.Viper, key, desc string, maxV uint64) (uint64, error) { + return parseConfigUint64Range(v, key, desc, 0, maxV) } func parseConfigDurationCondition(v *viper.Viper, key, desc string, cond func(time.Duration) error) (time.Duration, error) { diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go index bcb8f92ac3..165fad1de7 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/common.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/common.go @@ -25,21 +25,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) }) } @@ -49,11 +49,11 @@ 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) for i := range objects { - objects[i].obj = NewObject(min + uint64(rand.Intn(int(max-min+1)))) // not too large + objects[i].obj = NewObject(minSize + uint64(rand.Intn(int(maxSize-minSize+1)))) // not too large objects[i].addr = objectCore.AddressOf(objects[i].obj) objects[i].raw = 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 2ab5d5bd7c..88fe2ca960 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/control.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/control.go @@ -11,12 +11,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(false)) 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(true)) @@ -32,7 +32,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(prm) diff --git a/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go b/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go index 026f9e80a1..d87596ffa6 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/delete.go @@ -9,13 +9,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(false)) require.NoError(t, s.Init()) t.Cleanup(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 de20dc0dac..aaccbb68b6 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/exists.go @@ -8,13 +8,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(false)) require.NoError(t, s.Init()) t.Cleanup(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 a2b613375a..82f416e6fb 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/get.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/get.go @@ -9,13 +9,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(false)) require.NoError(t, s.Init()) t.Cleanup(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 2254fe2bf0..0e368780d9 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/get_range.go @@ -10,13 +10,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(false)) require.NoError(t, s.Init()) t.Cleanup(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 663ccbbac9..ef9456e8bb 100644 --- a/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go +++ b/pkg/local_object_storage/blobstor/internal/blobstortest/iterate.go @@ -9,13 +9,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(false)) require.NoError(t, s.Init()) t.Cleanup(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/local_object_storage/engine/evacuate_test.go b/pkg/local_object_storage/engine/evacuate_test.go index 8bd45879a0..d59e4a65a5 100644 --- a/pkg/local_object_storage/engine/evacuate_test.go +++ b/pkg/local_object_storage/engine/evacuate_test.go @@ -128,10 +128,10 @@ func TestEvacuateShard(t *testing.T) { func TestEvacuateNetwork(t *testing.T) { var errReplication = errors.New("handler error") - acceptOneOf := func(objects []*objectSDK.Object, max int) func(oid.Address, *objectSDK.Object) error { + acceptOneOf := func(objects []*objectSDK.Object, maxIter int) func(oid.Address, *objectSDK.Object) error { var n int return func(addr oid.Address, obj *objectSDK.Object) error { - if n == max { + if n == maxIter { return errReplication } diff --git a/pkg/morph/client/notary.go b/pkg/morph/client/notary.go index 5aa1439c52..6d4c8942c0 100644 --- a/pkg/morph/client/notary.go +++ b/pkg/morph/client/notary.go @@ -637,8 +637,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 + minIndex := bc + c.notary.txValidTime + rounded := (minIndex/c.notary.roundTime + 1) * c.notary.roundTime return rounded, nil } diff --git a/pkg/services/audit/auditor/pdp.go b/pkg/services/audit/auditor/pdp.go index 04b996f450..e6b918b303 100644 --- a/pkg/services/audit/auditor/pdp.go +++ b/pkg/services/audit/auditor/pdp.go @@ -90,11 +90,11 @@ func (c *Context) splitPayload(id oid.ID) []uint64 { for i := uint64(0); i < hashRangeNumber; i++ { if i < hashRangeNumber-1 { - max := size - prev - (hashRangeNumber - i) - if max == 0 { + maxL := size - prev - (hashRangeNumber - i) + if maxL == 0 { prev++ } else { - prev += rand.Uint64()%max + 1 + prev += rand.Uint64()%maxL + 1 } } else { prev = size From 42dce70591fbd76e3aacb019c87739d0c34324f6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 9 Aug 2024 20:08:00 +0400 Subject: [PATCH 2/4] CHANGELOG: Fix mistake in unreleased change Signed-off-by: Leonard Lyubich --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b730b3bd11..71c7593025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ Changelog for NeoFS Node ### Changed - neofs-cli allows several objects deletion at a time (#2774) - `ObjectService.Put` server of in-container node places objects using new `ObjectService.Replicate` RPC (#2802) -- `ObjectService`'s `Put` and `Replicate` RPC handlers cache up to 1000 lists of container nodes (#2892) +- `ObjectService`'s `Search` and `Replicate` RPC handlers cache up to 1000 lists of container nodes (#2892) - Default max_traceable_blocks Morph setting lowered to 17280 from 2102400 (#2897) - `ObjectService`'s `Get`/`Head`/`GetRange` RPC handlers cache up to 10K lists of per-object sorted container nodes (#2896) From 4bbbd74473665476d96332015a638927f4a3890c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 20 Aug 2024 13:11:59 +0300 Subject: [PATCH 3/4] CHANGELOG: fix whitespace error Signed-off-by: Roman Khimov --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c7593025..5469b3dc03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ Changelog for NeoFS Node - Control service's Drop call does not clean metabase (#2822) - It was impossible to specify memory amount as "1b" (one byte) in config, default was used instead (#2899) - Container session token's lifetime was not checked (#2898) -- ACL checks for split objects could be forced by a node than might lack access (#2909) +- ACL checks for split objects could be forced by a node than might lack access (#2909) ### Changed - neofs-cli allows several objects deletion at a time (#2774) From 80fe6f93d19fc12d5153edd216f14414fd6857a7 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 20 Aug 2024 13:12:49 +0300 Subject: [PATCH 4/4] Release v0.43.0 Signed-off-by: Roman Khimov --- CHANGELOG.md | 21 ++++++++++++++++----- VERSION | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5469b3dc03..0bf0697479 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ Changelog for NeoFS Node ## [Unreleased] +### Added + +### Fixed + +### Changed + +### Removed + +### Updated + +### Updating from v0.43.0 + +## [0.43.0] - 2024-08-20 - Jukdo + ### Added - Indexes inspection command to neofs-lens (#2882) - Add objects sanity checker to neofs-lens (#2506) @@ -24,14 +38,10 @@ Changelog for NeoFS Node - Default max_traceable_blocks Morph setting lowered to 17280 from 2102400 (#2897) - `ObjectService`'s `Get`/`Head`/`GetRange` RPC handlers cache up to 10K lists of per-object sorted container nodes (#2896) -### Removed - ### Updated - neofs-contract dependency to 0.20.0 (#2872) - NeoGo dependency to 0.106.3 (#2872) -### Updating from v0.42.1 - ## [0.42.1] - 2024-06-13 A tiny update that adds compatibility with the Neo N3 Domovoi hardfork. @@ -2059,7 +2069,8 @@ NeoFS-API v2.0 support and updated brand-new storage node application. First public review release. -[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.42.1...master +[Unreleased]: https://github.com/nspcc-dev/neofs-node/compare/v0.43.0...master +[0.43.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.42.1...v0.43.0 [0.42.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.42.0...v0.42.1 [0.42.0]: https://github.com/nspcc-dev/neofs-node/compare/v0.41.1...v0.42.0 [0.41.1]: https://github.com/nspcc-dev/neofs-node/compare/v0.41.0...v0.41.1 diff --git a/VERSION b/VERSION index 339fd080af..8298bb08b2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.42.1 +0.43.0