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 on the same function. This redundancy does not provide any additional security or functionality.

Vulnerability Details:

`TokenDivider::divideNft` function.

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

Impact: The redundant use of the onlyNftOwner(nftAddress, tokenId) modifier twice can lead to:

Unnecessary Gas Consumption: Since the modifier is evaluated twice, it unnecessarily consumes more gas, even though the second evaluation doesn't provide any additional functionality.

Tools Used: Foundry

Recommendations: Apply the onlyNftOwner(nftAddress, tokenId) modifier just once** **to ensure efficiency and maintain readability in the code.

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

Lead Judging Commences

juan_pedro_ventu 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.