Open mr-zwets opened 9 months ago
Mathieu and I were talking about this and we think it could make sense to disallow bytesX
as function parameters, since these types are not runtime enforced. We could alternatively also add an option to enforce these types by injecting require(x.length === y)
statements. This is something we should consider in more detail later.
Good to note that there would be no way to runtime enforce constructor parameter types, because at "construction" time, no script gets executed because of the way P2SH works.
We should fix the length of bytes types when using split:
bytes2 firstTwoBytes = test.split(2)[0];
The above does not work, when it should always be possible to type the length of the first element of the tuple. It should only be possible to type the length of the second element when the length of the original bytes element is typed.
The typing when getting both elements of the tuple is also wrong:
firstHalf can only be bytes2 here, and secondHalf can also only be bytes2, because the original length of the bytes element is typed