Should transaction decoding permit leading \x00
?
#291
Labels
question
Further information is requested
\x00
?
#291
Currently
Eth::Tx::Eip1559.decode
has this:value = Util.deserialize_big_endian_to_int tx[6]
And
deserialize_big_endian_to_int
strips leading\x00
from the string before converting to an integerThis behavior means that when we RLP-decode the transaction we end up interpreting
\x00
as 0 because:Eth::Util.deserialize_big_endian_to_int("\x00") == 0
But I don't think this is correct because the RLP-encoding for 0 is the empty string, which
Eth::Util.serialize_int_to_big_endian
handles correctly:Eth::Util.serialize_int_to_big_endian(0) == ''
This means we can't "round trip":
Eth::Util.serialize_int_to_big_endian(Eth::Util.deserialize_big_endian_to_int(bytes)) != bytes
.I don't think this is necessarily an issue with
deserialize_big_endian_to_int
but rather that RLP decoding should use a different method for converting integers. Something like:What do you think?
The text was updated successfully, but these errors were encountered: