diff --git a/api/layer/multipart_upload.go b/api/layer/multipart_upload.go index 05199344..dfc407ae 100644 --- a/api/layer/multipart_upload.go +++ b/api/layer/multipart_upload.go @@ -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 diff --git a/api/layer/neofs_mock.go b/api/layer/neofs_mock.go index 220499bc..09fd15a8 100644 --- a/api/layer/neofs_mock.go +++ b/api/layer/neofs_mock.go @@ -279,19 +279,18 @@ 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) @@ -299,7 +298,7 @@ func (t *TestNeoFS) CreateObject(_ context.Context, prm PrmObjectCreate) (oid.ID 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) diff --git a/api/layer/object.go b/api/layer/object.go index 77958610..c95fa590 100644 --- a/api/layer/object.go +++ b/api/layer/object.go @@ -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...) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index 25d5ce44..d9e409bb 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -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 { @@ -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) diff --git a/go.mod b/go.mod index 5f33f3a9..78885644 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 7df39247..3cb4a903 100644 --- a/go.sum +++ b/go.sum @@ -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= @@ -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= @@ -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= diff --git a/internal/neofs/neofs.go b/internal/neofs/neofs.go index b0cdb8c6..79b9b8b9 100644 --- a/internal/neofs/neofs.go +++ b/internal/neofs/neofs.go @@ -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 diff --git a/internal/neofs/neofs_test.go b/internal/neofs/neofs_test.go index 31264f07..28071c90 100644 --- a/internal/neofs/neofs_test.go +++ b/internal/neofs/neofs_test.go @@ -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...)