diff --git a/pkg/morph/event/container/put.go b/pkg/morph/event/container/put.go index 9bf7ee35..8f6d6c09 100644 --- a/pkg/morph/event/container/put.go +++ b/pkg/morph/event/container/put.go @@ -15,6 +15,8 @@ type Put struct { publicKey []byte } +const expectedItemNumPut = 4 + // MorphEvent implements Neo:Morph Event interface. func (Put) MorphEvent() {} @@ -34,8 +36,8 @@ func ParsePut(params []stackitem.Item) (event.Event, error) { err error ) - if ln := len(params); ln != 3 { - return nil, event.WrongNumberOfParameters(3, ln) + if ln := len(params); ln != expectedItemNumPut { + return nil, event.WrongNumberOfParameters(expectedItemNumPut, ln) } // parse container diff --git a/pkg/morph/event/container/put_test.go b/pkg/morph/event/container/put_test.go index 75bce11e..bdc9a4bd 100644 --- a/pkg/morph/event/container/put_test.go +++ b/pkg/morph/event/container/put_test.go @@ -22,7 +22,7 @@ func TestParsePut(t *testing.T) { } _, err := ParsePut(prms) - require.EqualError(t, err, event.WrongNumberOfParameters(3, len(prms)).Error()) + require.EqualError(t, err, event.WrongNumberOfParameters(expectedItemNumPut, len(prms)).Error()) }) t.Run("wrong container parameter", func(t *testing.T) { @@ -57,6 +57,7 @@ func TestParsePut(t *testing.T) { stackitem.NewByteArray(containerData), stackitem.NewByteArray(signature), stackitem.NewByteArray(publicKey), + stackitem.NewMap(), }) require.NoError(t, err)