aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

(!) BigInteger should specify range explicitly #408

Open fulldecent opened 4 years ago

fulldecent commented 4 years ago

BigIntegers are limited in the AVM ABI at:

https://github.com/aionnetwork/AVM/blob/master/org.aion.avm.userlib/src/org/aion/avm/userlib/abi/ABIStreamingEncoder.java#L480

a) This limitation is not specified in documentation. https://github.com/aionnetwork/docs/issues/64 b) The actual limits of the BigIntegers should be mentioned in code for clarity. I think it will be [-2^255, 2^255 - 1]. But the exact number is useful to document.

fulldecent commented 4 years ago

Requesting assistance @jeff-aion

fulldecent commented 4 years ago

Experiments done here https://github.com/fulldecent/aion-aip040/commit/53b77b9f37fd18046db83cf6efa95c101c93e771

Found that BigInteger can exceed 2^255 but not when encoding to ABI.