The sqrt()
function designed by the protocol, is not handling all possible values. it uses Babylonian method, but it don't take into consideration the maximum value type(uint256).max
.
Making the addition first x + 1
will make the function revert because of overflow, if the x is max.
Although this can be ignored, but for libraries and Mathematical functions we believe the mathematical function should result in correct results what ever the value is.
You can modify The function, to handle all possible values, using this new implementation.
And you can use Soloday implementation for the function, which saves some Gas.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.