foundry
foundry copied to clipboard
`cast --from-rlp` bad deserialization on empty list elements
Component
Cast
Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
What version of Foundry are you on?
cast 0.2.0 (64fe4ac 2022-08-05T17:02:41.636625562Z)
What command(s) is the bug in?
cast --from-rlp
Operating System
Linux
Describe the bug
cast seems to improperly format an RLP string when it contains empty list elements, it does not join the elements together with commas. I noticed this when trying to pipe the output to jq and getting an error. The following is a repro case - you can see "0x""0x""0x283... where they should be joined with a comma in between
$ echo "0xf8b1a02b5df5f0757397573e8ff34a8b987b21680357de1f6c8d10273aa528a851eaca8080a02838ac1d2d2721ba883169179b48480b2ba4f43d70fcf806956746bd9e83f90380a0e46fff283b0ab96a32a7cc375cecc3ed7b6303a43d64e0a12eceb0bc6bd8754980a01d818c1c414c665a9c9a0e0c0ef1ef87cacb380b8c1f6223cb2a68a4b2d023f5808080a0236e8f61ecde6abfebc6c529441f782f62469d8a2cc47b7aace2c136bd3b1ff08080808080" | cast --from-rlp
["0x2b5df5f0757397573e8ff34a8b987b21680357de1f6c8d10273aa528a851eaca","0x""0x""0x2838ac1d2d2721ba883169179b48480b2ba4f43d70fcf806956746bd9e83f903","0x""0xe46fff283b0ab96a32a7cc375cecc3ed7b6303a43d64e0a12eceb0bc6bd87549","0x""0x1d818c1c414c665a9c9a0e0c0ef1ef87cacb380b8c1f6223cb2a68a4b2d023f5","0x""0x""0x""0x236e8f61ecde6abfebc6c529441f782f62469d8a2cc47b7aace2c136bd3b1ff0","0x""0x""0x""0x""0x"]
``