From 1deb3f3d014dd97d48b2cbb0df29ac5546222cb1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 25 May 2021 18:27:12 +0300 Subject: [PATCH] [#525] morph/container: Do not accept signature in PutEACL function In previous implementation wrapper over the Container contract's client accepted the signature of the eACL table in addition to itself. After recent changes in API Go lib table carries its signature. Thus, it is redundant to pass the eACL table signature separately. Make `wrapper.PutEACL` method to accept `eacl.Table` only. Signed-off-by: Leonard Lyubich --- pkg/morph/client/container/wrapper/eacl.go | 8 +++++--- pkg/services/container/morph/executor.go | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/morph/client/container/wrapper/eacl.go b/pkg/morph/client/container/wrapper/eacl.go index 6b0001ed77..84c817f5b2 100644 --- a/pkg/morph/client/container/wrapper/eacl.go +++ b/pkg/morph/client/container/wrapper/eacl.go @@ -5,14 +5,14 @@ import ( "github.com/nspcc-dev/neofs-api-go/pkg" "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl" - containerSDK "github.com/nspcc-dev/neofs-api-go/pkg/container" + cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id" "github.com/nspcc-dev/neofs-node/pkg/core/container" client "github.com/nspcc-dev/neofs-node/pkg/morph/client/container" ) // GetEACL reads the extended ACL table from NeoFS system // through Container contract call. -func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, error) { +func (w *Wrapper) GetEACL(cid *cid.ID) (*eacl.Table, error) { if cid == nil { return nil, errNilArgument } @@ -60,7 +60,7 @@ func (w *Wrapper) GetEACL(cid *containerSDK.ID) (*eacl.Table, error) { // Returns error if table is nil. // // If TryNotary is provided, calls notary contract. -func PutEACL(w *Wrapper, table *eacl.Table, sig *pkg.Signature) error { +func PutEACL(w *Wrapper, table *eacl.Table) error { if table == nil { return errNilArgument } @@ -70,6 +70,8 @@ func PutEACL(w *Wrapper, table *eacl.Table, sig *pkg.Signature) error { return fmt.Errorf("can't marshal eacl table: %w", err) } + sig := table.Signature() + return w.PutEACL(data, sig.Key(), sig.Sign()) } diff --git a/pkg/services/container/morph/executor.go b/pkg/services/container/morph/executor.go index bda49b173b..bf082ebad5 100644 --- a/pkg/services/container/morph/executor.go +++ b/pkg/services/container/morph/executor.go @@ -96,7 +96,9 @@ func (s *morphExecutor) SetExtendedACL(ctx context.Context, body *container.SetE table := eaclSDK.NewTableFromV2(body.GetEACL()) sign := pkg.NewSignatureFromV2(body.GetSignature()) - err := wrapper.PutEACL(s.wrapper, table, sign) + table.SetSignature(sign) + + err := wrapper.PutEACL(s.wrapper, table) return new(container.SetExtendedACLResponseBody), err }