lido-dao icon indicating copy to clipboard operation
lido-dao copied to clipboard

Account's `stETH` balance getting lower on 1 or 2 wei due to rounding down integer math

Open TheDZhon opened this issue 2 years ago • 5 comments

We had been got already familiar with the 1 wei corner case before a protocol-wide regression test coverage was introduced. Since the integration tests adoption moment we have been discovering the possibility to face the 2 wei corner case. It happens due to the fact that stETH balance calculation depends on two integer divisions (each one has 1 wei "loss" at most).

It should be addressed somehow in the future to prevent dealing with such peculiarities, especially for the upcoming Withdrawals support (Capella hardfork). Thus, I mark the issue with the "next-upgade" label here to catch up during a development stage.

TheDZhon avatar Jul 07 '22 21:07 TheDZhon