rlp icon indicating copy to clipboard operation
rlp copied to clipboard

Issues with 0x00... prefixed addresses

Open slawomir-pryczek opened this issue 2 years ago • 6 comments

Whe using to 0x00 prefixed addresses it'll return following error from GETH.

rlp: input string too short for common.Address, decoding into (types.DynamicFeeTx).To

I think that's the reason of recently introduced patch to remove leading 0's from strings. Seems that geth client can't decode addresses with 0's removed. So this seems to be in accordance with specification, but geth still can't read the data encoded according to specs when address is shorter than "normal".

slawomir-pryczek avatar Feb 08 '23 10:02 slawomir-pryczek

patch to remove leading 0's from strings.

An address is not a string, it's a fixed-length (20) byte array.

holiman avatar Feb 08 '23 10:02 holiman

So you say if the library im using is stripping 0-bytes from addresses it's not following the standard?

slawomir-pryczek avatar Feb 08 '23 14:02 slawomir-pryczek

switch ($encoding) { case 'hex': if (strpos($input, '0x') === 0) { $input = str_replace('0x', '', $input); }

This code gets triggered for address

slawomir-pryczek avatar Feb 08 '23 14:02 slawomir-pryczek

Actually found your other comment, thanks

slawomir-pryczek avatar Feb 08 '23 14:02 slawomir-pryczek

Thanks @slawomir-pryczek, I'll fix this asap.

sc0Vu avatar Sep 06 '23 04:09 sc0Vu

I am currently facing this issue as well and am hopeful for a resolution. Could the merging of the following PR potentially address this problem? If there is anything I can do to assist or expedite the process, I am more than willing to help. https://github.com/web3p/rlp/pull/28

yamadashy avatar Nov 13 '23 08:11 yamadashy