You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In minime, the function balanceOfAt, or totalSupplyAt, uses a binary search to look for history of value in a certain block height.
The implementation uses a binary search calculation that could overflow when searching in very large data sets.
However, this is unlikely due the size of uint256, and we dont report bugs for when the size of this arrays gets filled up.
Anyway, I think this should be fixed because the code for binary search for sake of correctness, as any smart contract, no bugs should be allowed, and also this could be copied to use in another contract where this might not be the case.
Currently this is the implementation: uint256 mid = (high + low + 1) / 2;
The correct way should be: uint256 mid = low + ((high - low + 1) / 2);
The text was updated successfully, but these errors were encountered:
In minime, the function balanceOfAt, or totalSupplyAt, uses a binary search to look for history of value in a certain block height.
The implementation uses a binary search calculation that could overflow when searching in very large data sets.
https://github.com/vacp2p/minime/blob/1f6820c2450553a4c9a600a51c727619e68f0c02/contracts/MiniMeBase.sol#L424C28-L424C42
However, this is unlikely due the size of uint256, and we dont report bugs for when the size of this arrays gets filled up.
Anyway, I think this should be fixed because the code for binary search for sake of correctness, as any smart contract, no bugs should be allowed, and also this could be copied to use in another contract where this might not be the case.
Currently this is the implementation:
uint256 mid = (high + low + 1) / 2;
The correct way should be:
uint256 mid = low + ((high - low + 1) / 2);
The text was updated successfully, but these errors were encountered: