[#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 <leonard@nspcc.ru>
remotes/KirillovDenis/release/v0.21.1
Leonard Lyubich 2021-05-25 18:27:12 +03:00 committed by Leonard Lyubich
parent 32828d2b90
commit 1deb3f3d01
2 changed files with 8 additions and 4 deletions

View File

@ -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())
}

View File

@ -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
}