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
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:
Expected: This should raise an exception because \x00 is not a valid RLP encoding for any integer and therefore the transaction has been improperly encoded.
Actual: The code interprets \x00 as 0 and no exception is raised.
This is a problem wherever RLP is decoded and so ideally there would be a method (like deserialize_rlp_int described above) to fix this across the board.
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: