Pieces Protocol

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

Double access modifier in `divideNft`

Summary:

The divideNft function contains two identical access modifiers, which is unnecessary and results in increased gas consumption.

Vulnerability Details:

The divideNft function has two identical onlyNftOwner access modifiers for the same nftAddress and tokenId parameters. This redundancy not only makes the code harder to read but also unnecessarily increases gas consumption during contract execution.

Impact

While this issue does not pose an immediate security risk, it can lead to increased gas costs for users interacting with the contract. This can be a concern for users who frequently use the divideNft function, as they will have to pay more gas fees than necessary.

Tools Used

Solidity programming language, and a local blockchain environment for testing.

Recommendations

To address this issue, remove the duplicate access modifier in the divideNft function. Keep only one onlyNftOwner modifier for the given nftAddress and tokenId parameters. This will improve the readability of the code and reduce gas consumption during contract execution.

Example:

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.