Pieces Protocol

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

Redundant Modifier Usage in divideNft Function

Summary

In the divideNft function, the modifier onlyNftOwner(nftAddress, tokenId) is applied twice:

function divideNft(address nftAddress, uint256 tokenId, uint256 amount)
@> onlyNftOwner(nftAddress, tokenId)
@> onlyNftOwner(nftAddress, tokenId)
external {
...
}

Impact

This redundancy leads to the same ownership check being executed twice during function execution, which is unnecessary and inefficient.

The repetitive use of the modifier increases gas consumption for every execution of the function since the same logic is run twice.

Tools Used

Manual review

Recommendations

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.