CityOfZion / neo-python

Python Node and SDK for the NEO 2.x blockchain. For NEO 3.x go to our successor project neo-mamba
https://neo-python.readthedocs.io/en/latest/
MIT License
313 stars 189 forks source link

fix BigInteger divide #980

Closed ixje closed 5 years ago

ixje commented 5 years ago

What current issue(s) does this address, or what feature is it adding? audit of testnet block 1473972 showed a deviation in storage due to a different rounding used for C# compared to neo-python when dividing 2 BigIntegers where the dividend is negative. Specifically -11001000000 / 86400 should result in -127326 but resulted in -127327.

How did you solve this problem? change divide logic

How did you make sure your solution works? audit for the block passes, other tests still pass, added a couple more tests for which I took the expected values from a C# program.

Are there any special changes in the code that we should be aware of?

Please check the following, if applicable:

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.01%) to 85.295% when pulling 3573d596e8f44e6b5c16c8203d93c16afa03bdd9 on ixje:fix-bigint-div into 6931bd0c978a7ff5df3069253411255b3ffe1545 on CityOfZion:development.