Skip to content

Fix slicer owner issue #1173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/layer/multipart_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,18 @@ func (n *layer) uploadZeroPart(ctx context.Context, multipartInfo *data.Multipar
}

attrs := make([]object.Attribute, 0, len(multipartInfo.Meta)+1)
attrs = append(attrs, *object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(creationTime.Unix(), 10)))
attrs = append(attrs, object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(creationTime.Unix(), 10)))

for key, val := range multipartInfo.Meta {
if strings.HasPrefix(key, metaPrefix) {
attrs = append(attrs, *object.NewAttribute(strings.TrimPrefix(key, metaPrefix), val))
attrs = append(attrs, object.NewAttribute(strings.TrimPrefix(key, metaPrefix), val))
}
}

if encInfo.Enabled {
attrs = append(attrs, *object.NewAttribute(s3headers.AttributeEncryptionAlgorithm, encInfo.Algorithm))
attrs = append(attrs, *object.NewAttribute(s3headers.AttributeHMACKey, encInfo.HMACKey))
attrs = append(attrs, *object.NewAttribute(s3headers.AttributeHMACSalt, encInfo.HMACSalt))
attrs = append(attrs, object.NewAttribute(s3headers.AttributeEncryptionAlgorithm, encInfo.Algorithm))
attrs = append(attrs, object.NewAttribute(s3headers.AttributeHMACKey, encInfo.HMACKey))
attrs = append(attrs, object.NewAttribute(s3headers.AttributeHMACSalt, encInfo.HMACSalt))
}

var hashlessHeaderObject object.Object
Expand Down
11 changes: 5 additions & 6 deletions api/layer/neofs_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,27 +279,26 @@ func (t *TestNeoFS) CreateObject(_ context.Context, prm PrmObjectCreate) (oid.ID
// Deliberately ignore `prm.CreationTime` here, it's based on time.Now()
// which leads to duplicate timestamps in different object versions and
// this breaks many tests.
var a *object.Attribute
a = object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(t.currentTime, 10))
attrs = append(attrs, *a)
var a = object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(t.currentTime, 10))
attrs = append(attrs, a)
t.currentTime++

if prm.Filepath != "" {
a = object.NewAttribute(object.AttributeFilePath, prm.Filepath)
attrs = append(attrs, *a)
attrs = append(attrs, a)
}

for k, v := range prm.Attributes {
a = object.NewAttribute(k, v)
attrs = append(attrs, *a)
attrs = append(attrs, a)
}

nonce := make([]byte, objectNonceSize)
if _, err := rand.Read(nonce); err != nil {
return oid.ID{}, fmt.Errorf("object nonce: %w", err)
}
objectNonceAttr := object.NewAttribute(s3headers.AttributeObjectNonce, base64.StdEncoding.EncodeToString(nonce))
attrs = append(attrs, *objectNonceAttr)
attrs = append(attrs, objectNonceAttr)

obj := object.New()
obj.SetContainerID(prm.Container)
Expand Down
8 changes: 4 additions & 4 deletions api/layer/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,21 @@ func (n *layer) prepareMultipartHeadObject(ctx context.Context, p *PutObjectPara
return nil, ErrMetaEmptyParameterValue
}

attributes = append(attributes, *object.NewAttribute(k, v))
attributes = append(attributes, object.NewAttribute(k, v))
}

creationTime := TimeNow(ctx)
if creationTime.IsZero() {
creationTime = time.Now()
}
attributes = append(attributes, *object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(creationTime.Unix(), 10)))
attributes = append(attributes, object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(creationTime.Unix(), 10)))

if p.Object != "" {
attributes = append(attributes, *object.NewAttribute(object.AttributeFilePath, p.Object))
attributes = append(attributes, object.NewAttribute(object.AttributeFilePath, p.Object))
}

if versioningEnabled {
attributes = append(attributes, *object.NewAttribute(s3headers.AttributeVersioningState, data.VersioningEnabled))
attributes = append(attributes, object.NewAttribute(s3headers.AttributeVersioningState, data.VersioningEnabled))
}

headerObject.SetAttributes(attributes...)
Expand Down
7 changes: 4 additions & 3 deletions cmd/s3-gw/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func newApp(ctx context.Context, log *Logger, v *viper.Viper) *App {
log.logger.Fatal("newApp: couldn't generate random key", zap.Error(err))
}
anonSigner := user.NewAutoIDSignerRFC6979(anonKey.PrivateKey)
log.logger.Info("anonymous signer", zap.String("userID", anonSigner.UserID().String()))
log.logger.Info("anonymous signer", zap.String("pub key", hex.EncodeToString(anonKey.PublicKey().Bytes())), zap.String("userID", anonSigner.UserID().String()))

ni, err := conns.NetworkInfo(ctx, client.PrmNetworkInfo{})
if err != nil {
Expand Down Expand Up @@ -340,8 +340,9 @@ func getPool(ctx context.Context, logger *zap.Logger, cfg *viper.Viper) (*pool.P
logger.Fatal("could not load NeoFS private key", zap.Error(err))
}

prm.SetSigner(user.NewAutoIDSignerRFC6979(key.PrivateKey))
logger.Info("using credentials", zap.String("NeoFS", hex.EncodeToString(key.PublicKey().Bytes())))
signer := user.NewAutoIDSignerRFC6979(key.PrivateKey)
prm.SetSigner(signer)
logger.Info("using credentials", zap.String("pub key", hex.EncodeToString(key.PublicKey().Bytes())), zap.Stringer("userID", signer.UserID()))

for _, peer := range fetchPeers(logger, cfg) {
prm.AddNode(peer)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/nats-io/nats.go v1.37.0
github.com/nspcc-dev/neo-go v0.108.1
github.com/nspcc-dev/neofs-contract v0.21.0
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13.0.20250516065036-cd732ce85922
github.com/nspcc-dev/tzhash v1.8.2
github.com/prometheus/client_golang v1.21.1
github.com/spf13/pflag v1.0.6
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/gnark-crypto v0.14.0 h1:DDBdl4HaBtdQsq/wfMwJvZNE80sHidrK3Nfrefatm0E=
github.com/consensys/gnark-crypto v0.14.0/go.mod h1:CU4UijNPsHawiVGNxe9co07FkzCeWHHrb1li/n1XoU0=
github.com/containerd/containerd v1.7.18 h1:jqjZTQNfXGoEaZdW1WwPU0RqSn1Bm2Ay/KJPUuO8nao=
github.com/containerd/containerd v1.7.18/go.mod h1:IYEk9/IO6wAPUz2bCMVUbsfXjzw5UNP5fLz4PsUygQ4=
github.com/containerd/containerd v1.7.27 h1:yFyEyojddO3MIGVER2xJLWoCIn+Up4GaHFquP7hsFII=
github.com/containerd/containerd v1.7.27/go.mod h1:xZmPnl75Vc+BLGt4MIfu6bp+fy03gdHAn9bz+FreFR0=
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/containerd/platforms v0.2.1 h1:zvwtM3rz2YHPQsF2CHYM8+KtB5dvhISiXh5ZpSBQv6A=
Expand Down Expand Up @@ -124,8 +124,10 @@ github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkV
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc=
github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo=
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU=
github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo=
github.com/moby/sys/user v0.3.0/go.mod h1:bG+tYYYJgaMtRKgEmuueC0hJEAZWwtIbZTB+85uoHjs=
github.com/moby/sys/userns v0.1.0 h1:tVLXkFOxVu9A64/yh59slHVv9ahO9UIev4JZusOLG/g=
github.com/moby/sys/userns v0.1.0/go.mod h1:IHUYgu/kao6N8YZlp9Cf444ySSvCmDlmzUcYfDHOl28=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
Expand All @@ -150,8 +152,8 @@ github.com/nspcc-dev/neo-go v0.108.1 h1:XbtNtDL7O8G1B70WmlPcFXA3fsBGOgXzHxQVfBh6
github.com/nspcc-dev/neo-go v0.108.1/go.mod h1:DlISaevW5zhfzg2KgCxtR/m8wQObPuht03kEXSf0g2w=
github.com/nspcc-dev/neofs-contract v0.21.0 h1:dJkrZr7C8ngMiShwdUl27nbLCGez1KD7W1l7RRXFoN8=
github.com/nspcc-dev/neofs-contract v0.21.0/go.mod h1:TKR2DJiZCdzq9CPljI101c9S3uK5CsVK5WQrX4C+Y7A=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13 h1:q1ne/4d10NuHSqs+fA5XVVBRJ9jSap4cjrsxYzNvYZA=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13/go.mod h1:ycdDlPq8Wy+w5ePCmCfbHuEWQXbP7ZjBL5rj3QDiiM0=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13.0.20250516065036-cd732ce85922 h1:y3KeePiFlcE9jPCXJCrHAIBGIkBFAwr0RzVTi/kh0mo=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.13.0.20250516065036-cd732ce85922/go.mod h1:j/NUu5iOGFkOVYM42XoC1X9DZD0/y89Pws++w5vxtQk=
github.com/nspcc-dev/rfc6979 v0.2.3 h1:QNVykGZ3XjFwM/88rGfV3oj4rKNBy+nYI6jM7q19hDI=
github.com/nspcc-dev/rfc6979 v0.2.3/go.mod h1:q3sCL1Ed7homjqYK8KmFSzEmm+7Ngyo7PePbZanhaDE=
github.com/nspcc-dev/tzhash v1.8.2 h1:ebRCbPoEuoqrhC6sSZmrT/jI3h1SzCWakxxV6gp5QAg=
Expand Down
2 changes: 1 addition & 1 deletion internal/neofs/neofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (x *NeoFS) CreateObject(ctx context.Context, prm layer.PrmObjectCreate) (oi
attrs := make([]object.Attribute, 0, len(uniqAttributes))
for k, v := range uniqAttributes {
attr := object.NewAttribute(k, v)
attrs = append(attrs, *attr)
attrs = append(attrs, attr)
}

var obj object.Object
Expand Down
2 changes: 1 addition & 1 deletion internal/neofs/neofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func TestObjectNonce(t *testing.T) {

var (
attr = object.NewAttribute(s3headers.AttributeObjectNonce, base64.StdEncoding.EncodeToString(nonce))
attrs = []object.Attribute{*attrTS, *attr}
attrs = []object.Attribute{attrTS, attr}
)

obj.SetAttributes(attrs...)
Expand Down
Loading