Skip to content

Commit

Permalink
go.mod: upgrade to post-api-go SDK
Browse files Browse the repository at this point in the history
This does the bare minimum to make it work. Conversions are simplified,
signatures are handled a bit differently. The expectation is that the
behaviour is the same. Notice that we still have api-go in go.mod for
control and tree services that use autogenerated code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
  • Loading branch information
roman-khimov committed Jan 30, 2025
1 parent 81da735 commit 2528406
Show file tree
Hide file tree
Showing 41 changed files with 515 additions and 910 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changelog for NeoFS Node
- Drop creating new eacl tables with public keys (#3096)

### Updated
- SDK to the post-api-go version (#3103)

### Updating from v0.44.2
Using public keys as a rule target in eACL tables was deprecated, and
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/accounting.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package main

import (
accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance"
accountingService "github.com/nspcc-dev/neofs-node/pkg/services/accounting"
protoaccounting "github.com/nspcc-dev/neofs-sdk-go/proto/accounting"
)

func initAccountingService(c *cfg) {
Expand All @@ -17,6 +17,6 @@ func initAccountingService(c *cfg) {
server := accountingService.New(&c.key.PrivateKey, c.networkState, balanceMorphWrapper)

for _, srv := range c.cfgGRPC.servers {
accountingGRPC.RegisterAccountingServiceServer(srv, server)
protoaccounting.RegisterAccountingServiceServer(srv, server)

Check warning on line 20 in cmd/neofs-node/accounting.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/accounting.go#L20

Added line #L20 was not covered by tests
}
}
31 changes: 9 additions & 22 deletions cmd/neofs-node/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import (
"errors"
"fmt"

apicontainer "github.com/nspcc-dev/neofs-api-go/v2/container"
protocontainer "github.com/nspcc-dev/neofs-api-go/v2/container/grpc"
apirefs "github.com/nspcc-dev/neofs-api-go/v2/refs"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
protosession "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/signature"
protostatus "github.com/nspcc-dev/neofs-api-go/v2/status/grpc"
containerrpc "github.com/nspcc-dev/neofs-contract/rpc/container"
"github.com/nspcc-dev/neofs-node/pkg/core/client"
containerCore "github.com/nspcc-dev/neofs-node/pkg/core/container"
Expand All @@ -33,9 +26,13 @@ import (
apiClient "github.com/nspcc-dev/neofs-sdk-go/client"
containerSDK "github.com/nspcc-dev/neofs-sdk-go/container"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
"github.com/nspcc-dev/neofs-sdk-go/eacl"
"github.com/nspcc-dev/neofs-sdk-go/netmap"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
protocontainer "github.com/nspcc-dev/neofs-sdk-go/proto/container"
protosession "github.com/nspcc-dev/neofs-sdk-go/proto/session"
protostatus "github.com/nspcc-dev/neofs-sdk-go/proto/status"
"github.com/nspcc-dev/neofs-sdk-go/session"
"github.com/nspcc-dev/neofs-sdk-go/user"
"github.com/nspcc-dev/neofs-sdk-go/version"
Expand Down Expand Up @@ -517,30 +514,24 @@ func (c *usedSpaceService) ExternalAddresses() []string {
}

func (c *usedSpaceService) makeResponse(body *protocontainer.AnnounceUsedSpaceResponse_Body, st *protostatus.Status) (*protocontainer.AnnounceUsedSpaceResponse, error) {
v := version.Current()
var v2 apirefs.Version
v.WriteToV2(&v2)
resp := &protocontainer.AnnounceUsedSpaceResponse{
Body: body,
MetaHeader: &protosession.ResponseMetaHeader{
Version: v2.ToGRPCMessage().(*refs.Version),
Version: version.Current().ProtoMessage(),

Check warning on line 520 in cmd/neofs-node/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/container.go#L520

Added line #L520 was not covered by tests
Epoch: c.cfg.networkState.CurrentEpoch(),
Status: st,
},
}
return util.SignResponse(&c.cfg.key.PrivateKey, resp, apicontainer.AnnounceUsedSpaceResponse{}), nil
resp.VerifyHeader = util.SignResponse(&c.cfg.key.PrivateKey, resp)
return resp, nil

Check warning on line 526 in cmd/neofs-node/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/container.go#L525-L526

Added lines #L525 - L526 were not covered by tests
}

func (c *usedSpaceService) makeStatusResponse(err error) (*protocontainer.AnnounceUsedSpaceResponse, error) {
return c.makeResponse(nil, util.ToStatus(err))
}

func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *protocontainer.AnnounceUsedSpaceRequest) (*protocontainer.AnnounceUsedSpaceResponse, error) {
putReq := new(apicontainer.AnnounceUsedSpaceRequest)
if err := putReq.FromGRPCMessage(req); err != nil {
return nil, err
}
if err := signature.VerifyServiceMessage(putReq); err != nil {
if err := neofscrypto.VerifyRequestWithBuffer(req, nil); err != nil {

Check warning on line 534 in cmd/neofs-node/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/container.go#L534

Added line #L534 was not covered by tests
return c.makeStatusResponse(util.ToRequestSignatureVerificationError(err))
}

Expand All @@ -566,11 +557,7 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *protocont
var est containerSDK.SizeEstimation

for _, a := range req.GetBody().GetAnnouncements() {
var a2 apicontainer.UsedSpaceAnnouncement
if err := a2.FromGRPCMessage(a); err != nil {
panic(err)
}
err = est.ReadFromV2(a2)
err = est.FromProtoMessage(a)

Check warning on line 560 in cmd/neofs-node/container.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/container.go#L560

Added line #L560 was not covered by tests
if err != nil {
return c.makeStatusResponse(fmt.Errorf("invalid size announcement: %w", err))
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"sync/atomic"

netmapGRPC "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc"
"github.com/nspcc-dev/neofs-node/pkg/metrics"
nmClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
Expand All @@ -15,6 +14,7 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/services/control"
netmapService "github.com/nspcc-dev/neofs-node/pkg/services/netmap"
netmapSDK "github.com/nspcc-dev/neofs-sdk-go/netmap"
protonetmap "github.com/nspcc-dev/neofs-sdk-go/proto/netmap"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -171,7 +171,7 @@ func initNetmapService(c *cfg) {
server := netmapService.New(&c.key.PrivateKey, c)

for _, srv := range c.cfgGRPC.servers {
netmapGRPC.RegisterNetmapServiceServer(srv, server)
protonetmap.RegisterNetmapServiceServer(srv, server)

Check warning on line 174 in cmd/neofs-node/netmap.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/netmap.go#L174

Added line #L174 was not covered by tests
}

addNewEpochNotificationHandler(c, func(ev event.Event) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/google/uuid"
lru "github.com/hashicorp/golang-lru/v2"
objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
replicatorconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/replicator"
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
containercore "github.com/nspcc-dev/neofs-node/pkg/core/container"
Expand Down Expand Up @@ -39,6 +38,7 @@ import (
netmapsdk "github.com/nspcc-dev/neofs-sdk-go/netmap"
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
protoobject "github.com/nspcc-dev/neofs-sdk-go/proto/object"
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
"github.com/nspcc-dev/neofs-sdk-go/user"
"go.uber.org/zap"
Expand Down Expand Up @@ -309,7 +309,7 @@ func initObjectService(c *cfg) {
server := objectService.New(objSvc, mNumber, fsChain, storage, c.shared.basics.key.PrivateKey, c.metricsCollector, aclChecker, aclSvc)

for _, srv := range c.cfgGRPC.servers {
objectGRPC.RegisterObjectServiceServer(srv, server)
protoobject.RegisterObjectServiceServer(srv, server)

Check warning on line 312 in cmd/neofs-node/object.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/object.go#L312

Added line #L312 was not covered by tests
}
}

Expand Down
34 changes: 11 additions & 23 deletions cmd/neofs-node/reputation.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import (
"context"
"fmt"

apirefs "github.com/nspcc-dev/neofs-api-go/v2/refs"
refs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc"
v2reputation "github.com/nspcc-dev/neofs-api-go/v2/reputation"
protoreputation "github.com/nspcc-dev/neofs-api-go/v2/reputation/grpc"
protosession "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/signature"
protostatus "github.com/nspcc-dev/neofs-api-go/v2/status/grpc"
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/common"
intermediatereputation "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/intermediate"
localreputation "github.com/nspcc-dev/neofs-node/cmd/neofs-node/reputation/local"
Expand All @@ -31,6 +24,10 @@ import (
localroutes "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/routes"
truststorage "github.com/nspcc-dev/neofs-node/pkg/services/reputation/local/storage"
"github.com/nspcc-dev/neofs-node/pkg/services/util"
neofscrypto "github.com/nspcc-dev/neofs-sdk-go/crypto"
protoreputation "github.com/nspcc-dev/neofs-sdk-go/proto/reputation"
protosession "github.com/nspcc-dev/neofs-sdk-go/proto/session"
protostatus "github.com/nspcc-dev/neofs-sdk-go/proto/status"
apireputation "github.com/nspcc-dev/neofs-sdk-go/reputation"
"github.com/nspcc-dev/neofs-sdk-go/version"
"go.uber.org/zap"
Expand Down Expand Up @@ -259,11 +256,8 @@ type reputationServer struct {
}

func (s *reputationServer) makeResponseMetaHeader(st *protostatus.Status) *protosession.ResponseMetaHeader {
v := version.Current()
var v2 apirefs.Version
v.WriteToV2(&v2)
return &protosession.ResponseMetaHeader{
Version: v2.ToGRPCMessage().(*refs.Version),
Version: version.Current().ProtoMessage(),

Check warning on line 260 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L260

Added line #L260 was not covered by tests
Epoch: s.networkState.CurrentEpoch(),
Status: st,
}
Expand All @@ -273,15 +267,12 @@ func (s *reputationServer) makeLocalResponse(err error) (*protoreputation.Announ
resp := &protoreputation.AnnounceLocalTrustResponse{
MetaHeader: s.makeResponseMetaHeader(util.ToStatus(err)),
}
return util.SignResponse(&s.key.PrivateKey, resp, v2reputation.AnnounceLocalTrustResponse{}), nil
resp.VerifyHeader = util.SignResponse(&s.key.PrivateKey, resp)
return resp, nil

Check warning on line 271 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L270-L271

Added lines #L270 - L271 were not covered by tests
}

func (s *reputationServer) AnnounceLocalTrust(ctx context.Context, req *protoreputation.AnnounceLocalTrustRequest) (*protoreputation.AnnounceLocalTrustResponse, error) {
req2 := new(v2reputation.AnnounceLocalTrustRequest)
if err := req2.FromGRPCMessage(req); err != nil {
return nil, err
}
if err := signature.VerifyServiceMessage(req2); err != nil {
if err := neofscrypto.VerifyRequestWithBuffer(req, nil); err != nil {

Check warning on line 275 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L275

Added line #L275 was not covered by tests
return s.makeLocalResponse(util.ToRequestSignatureVerificationError(err))
}

Expand Down Expand Up @@ -314,15 +305,12 @@ func (s *reputationServer) makeIntermediateResponse(err error) (*protoreputation
resp := &protoreputation.AnnounceIntermediateResultResponse{
MetaHeader: s.makeResponseMetaHeader(util.ToStatus(err)),
}
return util.SignResponse(&s.key.PrivateKey, resp, v2reputation.AnnounceIntermediateResultResponse{}), nil
resp.VerifyHeader = util.SignResponse(&s.key.PrivateKey, resp)
return resp, nil

Check warning on line 309 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L308-L309

Added lines #L308 - L309 were not covered by tests
}

func (s *reputationServer) AnnounceIntermediateResult(ctx context.Context, req *protoreputation.AnnounceIntermediateResultRequest) (*protoreputation.AnnounceIntermediateResultResponse, error) {
req2 := new(v2reputation.AnnounceIntermediateResultRequest)
if err := req2.FromGRPCMessage(req); err != nil {
return nil, err
}
if err := signature.VerifyServiceMessage(req2); err != nil {
if err := neofscrypto.VerifyRequestWithBuffer(req, nil); err != nil {

Check warning on line 313 in cmd/neofs-node/reputation.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/reputation.go#L313

Added line #L313 was not covered by tests
return s.makeIntermediateResponse(util.ToRequestSignatureVerificationError(err))
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import (
"fmt"
"time"

sessionGRPC "github.com/nspcc-dev/neofs-api-go/v2/session/grpc"
nodeconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/node"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/morph/event/netmap"
sessionSvc "github.com/nspcc-dev/neofs-node/pkg/services/session"
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage"
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage/persistent"
"github.com/nspcc-dev/neofs-node/pkg/services/session/storage/temporary"
protosession "github.com/nspcc-dev/neofs-sdk-go/proto/session"
"github.com/nspcc-dev/neofs-sdk-go/user"
)

Expand Down Expand Up @@ -50,6 +50,6 @@ func initSessionService(c *cfg) {
server := sessionSvc.New(&c.key.PrivateKey, c, c.privateTokenStore)

for _, srv := range c.cfgGRPC.servers {
sessionGRPC.RegisterSessionServiceServer(srv, server)
protosession.RegisterSessionServiceServer(srv, server)

Check warning on line 53 in cmd/neofs-node/session.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/session.go#L53

Added line #L53 was not covered by tests
}
}
37 changes: 13 additions & 24 deletions cmd/neofs-node/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package main

import (
"context"
"errors"
"fmt"

objectGRPC "github.com/nspcc-dev/neofs-api-go/v2/object/grpc"
"github.com/nspcc-dev/neofs-api-go/v2/status"
coreclient "github.com/nspcc-dev/neofs-node/pkg/core/client"
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
protoobject "github.com/nspcc-dev/neofs-sdk-go/proto/object"
"google.golang.org/grpc"
"google.golang.org/grpc/encoding"
"google.golang.org/grpc/encoding/proto"
Expand All @@ -25,18 +25,16 @@ func (x *transport) SendReplicationRequestToNode(ctx context.Context, req []byte
return nil, fmt.Errorf("connect to remote node: %w", err)
}

var resp objectGRPC.ReplicateResponse
err = c.ExecRaw(func(conn *grpc.ClientConn) error {
// this will be changed during NeoFS API Go deprecation. Code most likely be
// placed in SDK
err = conn.Invoke(ctx, objectGRPC.ObjectService_Replicate_FullMethodName, req, &resp, binaryMessageOnly)
if err != nil {
return fmt.Errorf("API transport (op=%s): %w", objectGRPC.ObjectService_Replicate_FullMethodName, err)
}
return err
})
var resp protoobject.ReplicateResponse
conn := c.Conn()
if conn == nil {
return nil, errors.New("can't get grpc connection to node")
}

Check warning on line 32 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L28-L32

Added lines #L28 - L32 were not covered by tests
// this will be changed during NeoFS API Go deprecation. Code most likely be
// placed in SDK
err = conn.Invoke(ctx, protoobject.ObjectService_Replicate_FullMethodName, req, &resp, binaryMessageOnly)

Check warning on line 35 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L35

Added line #L35 was not covered by tests
if err != nil {
return nil, err
return nil, fmt.Errorf("API transport (op=%s): %w", protoobject.ObjectService_Replicate_FullMethodName, err)

Check warning on line 37 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L37

Added line #L37 was not covered by tests
}

return replicationResultFromResponse(&resp)
Expand Down Expand Up @@ -65,17 +63,8 @@ func (protoCodecBinaryRequestOnly) Unmarshal(raw []byte, msg any) error {
return encoding.GetCodec(proto.Name).Unmarshal(raw, msg)
}

func replicationResultFromResponse(m *objectGRPC.ReplicateResponse) ([]byte, error) {
var st *status.Status
if mst := m.GetStatus(); mst != nil {
st = new(status.Status)
err := st.FromGRPCMessage(mst)
if err != nil {
return nil, fmt.Errorf("decode response status: %w", err)
}
}

err := apistatus.ErrorFromV2(st)
func replicationResultFromResponse(m *protoobject.ReplicateResponse) ([]byte, error) {
err := apistatus.ToError(m.GetStatus())

Check warning on line 67 in cmd/neofs-node/transport.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/transport.go#L66-L67

Added lines #L66 - L67 were not covered by tests
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/nspcc-dev/neo-go v0.107.1
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20241115192314-2da6182d23f5
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20250130151303-051c6238eaea
github.com/nspcc-dev/tzhash v1.8.2
github.com/olekukonko/tablewriter v0.0.5
github.com/panjf2000/ants/v2 v2.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea h1:mK
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20240827150555-5ce597aa14ea/go.mod h1:YzhD4EZmC9Z/PNyd7ysC7WXgIgURc9uCG1UWDeV027Y=
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65 h1:SruyrmzfmaIK+rx3EyLsG3hb9Ooh+cTkObucl0yTVxY=
github.com/nspcc-dev/neofs-contract v0.20.1-0.20241220193924-4da43dfb5a65/go.mod h1:fwM6QoYPnsIuUQ4/GOwgzfQ9qoDKknqYgf4XWOqEdJw=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20241115192314-2da6182d23f5 h1:hJvvhZDkU3I180TsJaEwGVOFvTbzBr8l9m2KZdAwv1k=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20241115192314-2da6182d23f5/go.mod h1:INZZXiTr9L7gWFeg3RBuB1laH2h9+vnomvg1XE42zQU=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20250130151303-051c6238eaea h1:la9jMy0nzHs+j7qkgvgiL8DmePSyRYXlQa6XqmMR5qo=
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.12.0.20250130151303-051c6238eaea/go.mod h1:Hd0zRo7mfGDf/S+yGPnRi9eWipxJNhec2Oik1w7lwQo=
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 pkg/core/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Client interface {
ObjectHash(ctx context.Context, containerID cid.ID, objectID oid.ID, signer user.Signer, prm client.PrmObjectHash) ([][]byte, error)
AnnounceLocalTrust(ctx context.Context, epoch uint64, trusts []reputationSDK.Trust, prm client.PrmAnnounceLocalTrust) error
AnnounceIntermediateTrust(ctx context.Context, epoch uint64, trust reputationSDK.PeerToPeerTrust, prm client.PrmAnnounceIntermediateTrust) error
ExecRaw(f func(*grpc.ClientConn) error) error
Conn() *grpc.ClientConn
Close() error
}

Expand Down
7 changes: 1 addition & 6 deletions pkg/core/object/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,7 @@ func (v *FormatValidator) Validate(obj *object.Object, unprepared bool) error {
} else {
// V2 split

if !firstSet {
// first part only
if obj.Parent() == nil {
return errors.New("v2 split: first object part does not have parent header")
}
} else {
if firstSet {
// 2nd+ parts

typ := obj.Type()
Expand Down
7 changes: 0 additions & 7 deletions pkg/core/object/fmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,6 @@ func TestLinkObjectSplitV2(t *testing.T) {
})

t.Run("V2 split", func(t *testing.T) {
obj.ResetRelations()
obj.SetParent(object.New())

t.Run("first object is not set", func(t *testing.T) {
require.ErrorContains(t, v.Validate(obj, true), "first object part does not have parent header")
})

t.Run("link object without finished parent", func(t *testing.T) {
obj.ResetRelations()
obj.SetParent(object.New())
Expand Down
4 changes: 2 additions & 2 deletions pkg/innerring/processors/netmap/process_cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package netmap

import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
v2netmap "github.com/nspcc-dev/neofs-api-go/v2/netmap"
protonetmap "github.com/nspcc-dev/neofs-sdk-go/proto/netmap"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -35,7 +35,7 @@ func (np *Processor) processNetmapCleanupTick(ev netmapCleanupTick) {
uint32(ev.epoch),
nil,
methodUpdateStateNotary,
int64(v2netmap.Offline), key.Bytes(),
int64(protonetmap.NodeInfo_OFFLINE), key.Bytes(),

Check warning on line 38 in pkg/innerring/processors/netmap/process_cleanup.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/processors/netmap/process_cleanup.go#L38

Added line #L38 was not covered by tests
)
if err != nil {
np.log.Error("can't invoke netmap.UpdateState", zap.Error(err))
Expand Down
1 change: 0 additions & 1 deletion pkg/local_object_storage/metabase/select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func TestDB_SelectRootPhyParent(t *testing.T) {
firstChild := oidtest.ID()

leftChild := generateObjectWithCID(t, cnr)
leftChild.InitRelations()
leftChild.SetFirstID(firstChild)
err = putBig(db, leftChild)
require.NoError(t, err)
Expand Down
Loading

0 comments on commit 2528406

Please sign in to comment.