From 70f800eb76a7e281b632f435e86dba415a74d89d Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 25 May 2021 17:41:20 +0300 Subject: [PATCH] [#505] event/container: Change number of items in SetEACL event Change expected event items to 4 in order to support new binary session token item. Parsing of the session token will be implemented later. Signed-off-by: Leonard Lyubich --- pkg/morph/event/container/eacl.go | 8 ++++++-- pkg/morph/event/container/eacl_test.go | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/morph/event/container/eacl.go b/pkg/morph/event/container/eacl.go index 561ae7c621..5b3e64e9c8 100644 --- a/pkg/morph/event/container/eacl.go +++ b/pkg/morph/event/container/eacl.go @@ -38,14 +38,18 @@ func (x SetEACL) PublicKey() []byte { } // ParseSetEACL parses SetEACL notification event from list of stack items. +// +// Expects 4 stack items. func ParseSetEACL(items []stackitem.Item) (event.Event, error) { var ( ev SetEACL err error ) - if ln := len(items); ln != 3 { - return nil, event.WrongNumberOfParameters(3, ln) + const expectedItemNumEACL = 4 + + if ln := len(items); ln != expectedItemNumEACL { + return nil, event.WrongNumberOfParameters(expectedItemNumEACL, ln) } // parse table diff --git a/pkg/morph/event/container/eacl_test.go b/pkg/morph/event/container/eacl_test.go index 6cb62a93c0..679494967b 100644 --- a/pkg/morph/event/container/eacl_test.go +++ b/pkg/morph/event/container/eacl_test.go @@ -23,7 +23,7 @@ func TestParseEACL(t *testing.T) { } _, err := container.ParseSetEACL(items) - require.EqualError(t, err, event.WrongNumberOfParameters(3, len(items)).Error()) + require.EqualError(t, err, event.WrongNumberOfParameters(4, len(items)).Error()) }) t.Run("wrong container parameter", func(t *testing.T) { @@ -60,6 +60,7 @@ func TestParseEACL(t *testing.T) { stackitem.NewByteArray(binaryTable), stackitem.NewByteArray(signature), stackitem.NewByteArray(publicKey), + stackitem.NewMap(), }) require.NoError(t, err)