Pieces Protocol

First Flight #32
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Invalid

Redundant Ether Validation in buyOrder Function

Summary

In the buyOrder function, the check for msg.value < order.price + sellerFee is redundant because the earlier validation msg.value < order.price already ensures that the buyer has sent enough Ether to cover the cost of the order. The additional check for msg.value < order.price + sellerFee introduces unnecessary complexity without adding any meaningful validation. This redundancy does not affect the functionality, but it could lead to confusion or minor inefficiencies in the code.

Vulnerability Details

The code includes redundant validation checks, where msg.value < order.price and msg.value < order.price + sellerFee essentially perform overlapping checks, causing unnecessary complexity.

Tools Used

Manuel review

Recommendations

Remove the redundant validation for msg.value < order.price + sellerFee and rely solely on msg.value < order.price to validate that the buyer has sent enough Ether for the order price.

if(msg.value < order.price + sellerFee) {
revert TokenDivider__InsuficientEtherForFees();
}
Updates

Lead Judging Commences

fishy Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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