The _bytes_to_num()
function used in conversion assumes that any bytestring types are in memory. If they are declared from within the expression, it will try to load them from memory and panic.
When converting a bytestring to a number, we perform the following:
The get_bytearray_length()
function correctly handles the case when an empty bytestring is passed directly to the conversion. However, the bytes_data_ptr()
function panics if the argument doesn't have a location
specified:
The following Vyper contract should compile:
However, it instead returns the following:
Contracts that include a conversion where an empty bytestring is declared within the expression will fail to compile.
Manual Review
Use something like the ensure_in_memory()
function used elsewhere in the compiler to move empty bytestrings to memory before converting them, or create a manual override for empty strings to return the appropriate value.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.