kopanitsa / web3-arduino

an Arduino (or ESP32) library to use web3 on Ethereum platform.
MIT License
105 stars 45 forks source link

RLP - wrong length prefix #11

Open TbLtzk opened 5 years ago

TbLtzk commented 5 years ago

There is a wrong length calculation in the RlpEncodeWholeHeaderWithVector method:

consider this payload: "0xa9059cbb00000000000000000000000081aed945a46f8542d72cd207b1a2d2934eda71b50000000000000000000000000000000000000000000000000000065dd0837000"

This should give b8 44 a9 05 9c bb 00 00 00 00 00 00 00 00 00 00 00 00 81 ae d9 45 a4 6f 85 42 d7 2c d2 07 b1 a2 d2 93 4e da 71 b5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 5d d0 83 70 00

but currently returns b9 44 a9 05 9c bb 00 00 00 00 00 00 00 00 00 00 00 00 81 ae d9 45 a4 6f 85 42 d7 2c d2 07 b1 a2 d2 93 4e da 71 b5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 5d d0 83 70 00

with everything correct except the first byte b9 where it should be b8