Pieces Protocol

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

Duplicate Modifier in divideNft Function

Summary

The divideNft function in the TokenDivider contract has the onlyNftOwner modifier applied twice, which is redundant and wastes gas.

Vulnerability Details

In the divideNft function declaration, the onlyNftOwner modifier is used twice with the same parameters:

function divideNft(address nftAddress, uint256 tokenId, uint256 amount)
onlyNftOwner(nftAddress, tokenId)
onlyNftOwner(nftAddress ,tokenId)
external {

This causes the ownership check to be performed twice unnecessarily.

Impact

  • Increased gas costs due to redundant checks

  • Code readability issues

  • No security impact as the duplicate check doesn't change the function's behavior

Tools Used

  • Manual code review

Recommendations

Remove one instance of the modifier:

function divideNft(address nftAddress, uint256 tokenId, uint256 amount)
onlyNftOwner(nftAddress, tokenId)
external {
Updates

Lead Judging Commences

fishy Lead Judge 5 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.