-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Milestone
Description
In the Griefing contract, the function getPunishment exists to show the amount of punishment that is achievable for a given amount of cost.
The function returns incorrect values for two reasons:
- The punishment amount is not limited by the maximum amount staked.
- The
getPunishmentfunction uses multiplication but the actualgetCostfunction which is used employes division. Due to quantization effects, division is not the inverse of multiplication. (e.g. 1÷3×3 ≠ 1)
Recommendation: remove the getPunishment function entirely because it can never be accurate.
References:
function getPunishment(uint256 ratio, uint256 cost, RatioType ratioType) public pure returns(uint256 punishment) {
Metadata
Metadata
Assignees
Labels
No labels