-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix division precision loss #64
Comments
For now, my analysis favors #66 to be approved over #67. OpenZeppelin mulDiv function uses a smart trick to perform these operations with reduced gas cost, and seems a more safe approch overall. I'll try to dig more into these solutions to see if I can break one or other in certain scenarios, or if I can improve #67 formulas. |
Duplicate of #24 |
I think going with #66 is a good decision here. It's a battle-tested solution to the problem, this also makes it potentially easier to audit. |
We ended up using OpenZeppelin Math library (#66). Advantages:
Disadvantage:
|
In StakeManager, there are some divisions, but solidity does not support any type of real numbers, so we are using integers where division always rounds down.
For the MP logic, this would break the minting, as it usually would get something like .1, .01, and try to multiply that by the balance to find how much to increase. This will always return zero in current code.
Possible solutions:
Read more:
The text was updated successfully, but these errors were encountered: