Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Precision Loss

Summary

The contract calculates a protocol fee as a percentage of the total pot. However, since both totalPot and PROTOCOL_FEE_PERCENT are integers and Solidity does not support floating-point arithmetic, the fee calculation might lose precision — especially with small totalPot values or low percentages.

Vulnerability Details

uint256 fee = (totalPot * PROTOCOL_FEE_PERCENT) / 100;

Solidity performs integer division, which truncates any decimal values.

if totalPot = 5 and PROTOCOL_FEE_PERCENT = 2, the actual fee should be 0.1, but the result will be 0 due to truncation.

Impact Low / Likelyhood - High

Tools Used

Manual review

Recommendations

Add minimum fee threshold

Updates

Appeal created

m3dython Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Rounding Error

The tie-handling logic loses one wei due to integer division

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.