Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: low

Dangerous Strict Equality

Summary

Use of strict equalities that can be easily manipulated by an attacker.

Vulnerability Details

Distributor.sol Line #142

if (totalAmount == 0) revert Distributor__NoTokenToDistribute();

https://github.com/Cyfrin/2023-08-sparkn/blob/104b227e7a1b60eff8124980e63aee93bdd12a38/src/Distributor.sol#L142

Impact

Using strict checks like totalAmount == 0 might not work well because balances might not be precisely zero due to these small errors.
In simple terms, tokens on Ethereum can have tiny errors in their numbers, so it's better to be a bit lenient when checking balances to avoid surprises caused by these errors.

Tools Used

Manual

Recommendations

To address this concern, use:

if (totalAmount <= 0) revert Distributor__NoTokenToDistribute();

you can use less strict equality so that there will be very less chances of error.

Support

FAQs

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