vm: adjust MaxByteArrayComparableSize value

https://github.com/neo-project/neo-vm/pull/454#discussion_r857533800.
This commit is contained in:
Anna Shaleva 2022-05-06 13:29:00 +03:00
parent 23b78b0be2
commit 8af043520d
2 changed files with 4 additions and 4 deletions

View file

@ -27,8 +27,8 @@ const (
// MaxClonableNumOfItems is the maximum number of items that can be cloned in structs. // MaxClonableNumOfItems is the maximum number of items that can be cloned in structs.
MaxClonableNumOfItems = MaxDeserialized MaxClonableNumOfItems = MaxDeserialized
// MaxByteArrayComparableSize is the maximum allowed length of a ByteArray for Equals method. // MaxByteArrayComparableSize is the maximum allowed length of a ByteArray for Equals method.
// It is set to be the maximum uint16 value. // It is set to be the maximum uint16 value + 1.
MaxByteArrayComparableSize = math.MaxUint16 MaxByteArrayComparableSize = math.MaxUint16 + 1
// MaxKeySize is the maximum size of a map key. // MaxKeySize is the maximum size of a map key.
MaxKeySize = 64 MaxKeySize = 64
) )

View file

@ -816,7 +816,7 @@ func TestEQUALByteArrayWithLimit(t *testing.T) {
for i := range args { for i := range args {
args[i] = stackitem.NewStruct([]stackitem.Item{ args[i] = stackitem.NewStruct([]stackitem.Item{
stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2)), 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) getTestFuncForVM(prog, true, args[0], args[1])(t)
@ -825,7 +825,7 @@ func TestEQUALByteArrayWithLimit(t *testing.T) {
args := make([]stackitem.Item, 2) args := make([]stackitem.Item, 2)
for i := range args { for i := range args {
args[i] = stackitem.NewStruct([]stackitem.Item{ 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)), stackitem.NewByteArray(make([]byte, stackitem.MaxByteArrayComparableSize/2)),
}) })
} }