You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VIP: 728
Title: Allow list of byte arrays
Author: Samuel Troper, [email protected]
Type: Standard Track
Status: Draft
Created: 2018-03-29
Simple Summary
Allow list of byte arrays.
Abstract
Currently, lists are not allowed for byte arrays. Say you wanted to represent 3 two byte pieces of data, you could use aByteArray: bytes <= 6 and use bytes 1 & 2, 3 & 4, and 5 & 6 as pairs to represent each of these pieces of data, but this is less intuitive to code, less readable, and requires good documentation to allow contracts to be easily readable.
Motivation
This is a limitation of the language, particularly in a space where storage limitations are important, that could easily be addressed. It would also greatly enhance audibility.
bytes[2][3] does seem ambiguous. The first [] sets the byte length and the second [] set the number of items in the list, but this is a rarer case, and therefore I am OK with it ;)
Preamble
Simple Summary
Allow list of byte arrays.
Abstract
Currently, lists are not allowed for byte arrays. Say you wanted to represent 3 two byte pieces of data, you could use
aByteArray: bytes <= 6
and use bytes 1 & 2, 3 & 4, and 5 & 6 as pairs to represent each of these pieces of data, but this is less intuitive to code, less readable, and requires good documentation to allow contracts to be easily readable.Motivation
This is a limitation of the language, particularly in a space where storage limitations are important, that could easily be addressed. It would also greatly enhance audibility.
Specification
With #714:
someBytes: bytes[2][3]
Backwards Compatibility
Backwards compatible. The old workaround would continue to function, the new implementation would be new.
Copyright
Copyright and related rights waived via CC0
The text was updated successfully, but these errors were encountered: