Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Invalid

Wrong local variable in getHost() function

Summary

The getHost() function has a minor issue with the naming convention of the _host variable, which can lead to confusion as the function simply returns the host state variable.

Vulnerability Details

The function getHost() defines a local variable named _host, but it doesn't actually need to define this local variable. Instead, it could directly return the host state variable without introducing a new variable. The naming convention suggests that _host might be a function argument, but it's unnecessary since the function only returns the host state variable.

function getHost() public view returns (address _host) { // wrongly local and unnecessary variable
return host;
}

Impact

No impact, only confusing for the auditors.

Tools Used

Manual code review

Recommendations

It is recommended to remove the unnecessary _host variable in the function definition to avoid confusion and align with better coding practices.

function getHost() public view returns (address) { // corrected version
return host;
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!