Submitted by cmichel
Its unclear why the binary search algorithm stops after 128 iterations.
It might not return the actual epoch id (although very unlikely as 128 iterations should be sufficient.)
Use a while (max > min) loop instead of the for loop with a fixed number of iterations.
uint256 mid = (min + max + 1) / 2; is also not using safe math.
C2tP-C2tP (BadgerDAO) acknowledged
