From e3f8e350f9d9a25e41803d9f8fd5fb4036643666 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 7 Oct 2020 19:27:07 +0300 Subject: [PATCH] [#82] Fix conversion of container id values from smart-contract Smart-contract stores container ids as a raw bytes, not marshaled protobuf structures. Signed-off-by: Alex Vanin --- pkg/morph/client/container/wrapper/container.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/pkg/morph/client/container/wrapper/container.go b/pkg/morph/client/container/wrapper/container.go index 3f467027..87b168c4 100644 --- a/pkg/morph/client/container/wrapper/container.go +++ b/pkg/morph/client/container/wrapper/container.go @@ -8,7 +8,6 @@ import ( v2container "github.com/nspcc-dev/neofs-api-go/v2/container" msgContainer "github.com/nspcc-dev/neofs-api-go/v2/container/grpc" v2refs "github.com/nspcc-dev/neofs-api-go/v2/refs" - msgRefs "github.com/nspcc-dev/neofs-api-go/v2/refs/grpc" core "github.com/nspcc-dev/neofs-node/pkg/core/container" client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container" "github.com/pkg/errors" @@ -144,16 +143,9 @@ func (w *Wrapper) List(ownerID *owner.ID) ([]*container.ID, error) { result := make([]*container.ID, 0, len(rawIDs)) for i := range rawIDs { - // convert serialized bytes into GRPC structure - grpcMsg := new(msgRefs.ContainerID) - err = grpcMsg.Unmarshal(rawIDs[i]) - if err != nil { - // use other major version if there any - return nil, errors.Wrap(err, "can't unmarshal container id") - } + v2 := new(v2refs.ContainerID) + v2.SetValue(rawIDs[i]) - // convert GRPC structure into SDK structure, used in the code - v2 := v2refs.ContainerIDFromGRPCMessage(grpcMsg) cid := container.NewIDFromV2(v2) result = append(result, cid)