makerdao / lockstake

GNU Affero General Public License v3.0
7 stars 3 forks source link

(3) "wad-overflow" not likely for lockNgt and freeNgt #10

Open oldchili opened 7 months ago

oldchili commented 7 months ago

lockNgt and freeNgt minor optimization - I think as long as mkrNgtRate is larger than 2 then "wad-overflow" can never happen for these. We should consider adding that check to the constructor and moving the check to only lock and free.

sunbreak1211 commented 6 months ago
echo "(2^256-1) / 3 < 2^255-1" | bc
1
echo "(2^256-1) / 2 < 2^255-1" | bc
0

If the rate of NGT/MKR is >= 3 then it is safe to remove the require for NGT. However not sure if I feel comfortable leaving that to a variable that comes from an external contract. The only exception would be if we put a require in the constructor to verify that.

oldchili commented 6 months ago
echo "(2^256-1) / 3 < 2^255-1" | bc
1
echo "(2^256-1) / 2 < 2^255-1" | bc
0

If the rate of NGT/MKR is >= 3 then it is safe to remove the require for NGT. However not sure if I feel comfortable leaving that to a variable that comes from an external contract. The only exception would be if we put a require in the constructor to verify that.

Yes, was thinking of a constructor check as well. Not super critical, so feel free to ignore this issue.

sunbreak1211 commented 6 months ago

Let's leave it open for now and we can take a decision later.