ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.18k stars 1.1k forks source link

No distinction between uint and int in SolidityType #1184

Closed jondoe1337 closed 5 years ago

jondoe1337 commented 5 years ago

I was investigating a strange decoding behavior as i discovered that in SolidityType#decodeInt (l. 404) is no distincted case for an unsigned int. Shouldn't the BigInteger constructor call use the signum = 1 param in that case?

Currently byte[] b = [-13, -75, 19, 86, -119, 67, 112, -4, 118, -86, 98, -46, 103, -42, -126, 63, -60, -15, -87, 57, 43, 11, -17, -52, 0, 3, -65, 14, -67, -40, 65, 119] will get parsed to -5560134246666045367803923210000275923246569538997228521514361932073667116681 instead of 110231954990650150055767061798687631930023415126643335517943222075839462523255.

I can provide a testcase and PR if appreciated.

mkalinin commented 5 years ago

I can provide a testcase and PR if appreciated.

That would be much appreciated! Nice catch, btw! 👍

zilm13 commented 5 years ago

Resolved with #1187