diff --git a/pkg/vm/stackitem/item.go b/pkg/vm/stackitem/item.go index d7c92a5fe..18afb7349 100644 --- a/pkg/vm/stackitem/item.go +++ b/pkg/vm/stackitem/item.go @@ -27,8 +27,8 @@ const ( // MaxClonableNumOfItems is the maximum number of items that can be cloned in structs. MaxClonableNumOfItems = MaxDeserialized // MaxByteArrayComparableSize is the maximum allowed length of a ByteArray for Equals method. - // It is set to be the maximum uint16 value. - MaxByteArrayComparableSize = math.MaxUint16 + // It is set to be the maximum uint16 value + 1. + MaxByteArrayComparableSize = math.MaxUint16 + 1 // MaxKeySize is the maximum size of a map key. MaxKeySize = 64 ) diff --git a/pkg/vm/vm_test.go b/pkg/vm/vm_test.go index e342434f4..ce2d9375e 100644 --- a/pkg/vm/vm_test.go +++ b/pkg/vm/vm_test.go @@ -816,7 +816,7 @@ func TestEQUALByteArrayWithLimit(t *testing.T) { for i := range args { args[i] = stackitem.NewStruct([]stackitem.Item{ stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2)), - stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2+1)), // MaxByteArrayComparableSize is even, thus use +1 + stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2)), }) } getTestFuncForVM(prog, true, args[0], args[1])(t) @@ -825,7 +825,7 @@ func TestEQUALByteArrayWithLimit(t *testing.T) { args := make([]stackitem.Item, 2) for i := range args { args[i] = stackitem.NewStruct([]stackitem.Item{ - stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2+2)), + stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2+1)), stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2)), }) }