Adding abi.Bytes alias
Problem
Currently, for dynamic byte arrays byte[] we need to write abi.DynamicArray(abi.Byte), which is quite long.
Same for static array.
Solution
Add some type aliases. Propositions:
abi.Bytesandabi.Bytes[32]for dynamic and 32-byte static array.abi.DynamicByteArrayandabi.StaticByteArray[32]
Dependencies
n/a
Urgency
nice to have
I believe the abi.DynamicByteArray can be solved by using abi.String.
For fixed length byte array, if you want 32 byte array, we can try abi.Address.
If we want other fixed length byte array, we can try to create a abi.ByteArray for fixed length byte array.
I believe the
abi.DynamicByteArraycan be solved by usingabi.String.For fixed length byte array, if you want 32 byte array, we can try
abi.Address.
This would technically work, but the problem is that abi.String and abi.Address have type-specific meanings. An abi.Address would not be appropriate for storing a non-address 32-byte array, such as a hash output or random seed.
Same thing for abi.String -- if you use this type, observers of the blockchain will assume that its value is valid UTF-8 and can be shown as a user-friendly string. goal app method will attempt to show a string if your method returns this type. So I would not recommend storing arbitrary bytes in it.
I think PR #500 takes a good approach to addressing this issue.