-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow conversion from bytes to bytesNN #9170
Comments
Among the main reasons for this: #9167 |
invalid opcode if the byte array is too short? |
I'm wondering if we shouldn't just allow conversions from too long (truncating) as well as from too short (padding) EDIT: (I'm for example not yet sure if I won't argue against checks on conversions in 0.9 and for a notion of explicit |
We discussed new casting/conversion syntax here and here:
On the meeting we also mentioned perhaps we should not name them |
Allow conversions from the dynamic
bytes
type to the fixed bytesbytesNN
types.Probably best to start with
calldata
to support e.g.bytes4 sig = bytes4(msg.data[:4]);
(resp.bytes4 sig = bytes4(bytes(msg.data[:4]));
, i.e. for proper calldata arrays first and then directly on calldata slices).But this also makes sense for
memory
andstorage
.There may very well be an existing issue for that, but I didn't find any on a quick search.
The text was updated successfully, but these errors were encountered: