Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

[L-02] Inaccurate Comment in `getPassword` Function of PasswordStore Contract

Summary

The getPassword function in the provided PasswordStore contract has a comment that inaccurately mentions a parameter newPassword. However, the function signature does not include this parameter. This discrepancy could lead to confusion for developers or auditors reviewing the code.


Vulnerability Details

In the comment preceding the getPassword function, there's a mention of a parameter newPassword in the @param tag. However, the function getPassword does not take any parameters as per its definition. This inaccurate documentation may mislead someone reviewing the contract into thinking there's a missing parameter or some other issue with the function signature.

/*
* @notice This allows only the owner to retrieve the password.
* @param newPassword The new password to set.
*/
function getPassword() external view returns (string memory) {
if (msg.sender != s_owner) {
revert PasswordStore__NotOwner();
}
return s_password;
}

Impact

The impact of this issue is low. It does not have any effect on the contract's functionality or security. However, accurate and clear comments are crucial for understanding the contract, especially for those who might interact with or audit the contract in the future. Misleading comments can cause confusion and potentially lead to misunderstandings about how the contract functions.


Tools Used

Manual Code Review


Recommendations

It's recommended to correct the comment to accurately reflect the function's behavior and remove the incorrect @param tag. The corrected comment might look something like:

Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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