Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: low
Valid

Inaccurate Emit Statement

Summary

The contract contains an inconsistency between the NatSpec comment and the emit statement within the code logic. While the NatSpec comment indicates one behavior (random <= defenderRapperSkill), the emit statement suggests a different behavior (random < defenderRapperSkill). This discrepancy could lead to confusion for developers and users regarding the contract's intended behavior. To address this issue, it's recommended to ensure alignment between the NatSpec comment and the emit statement to provide clarity and avoid potential misunderstandings.

Vulnerability Details

The emit statement emit Battle(msg.sender, _tokenId, random < defenderRapperSkill ? _defender : msg.sender); in the function contradicts the comment // If random <= defenderRapperSkill -> defenderRapperSkill wins, otherwise they lose.

emit Battle(msg.sender, _tokenId, random < defenderRapperSkill ? _defender : msg.sender);

Impact

This discrepancy could potentially mislead developers or users who rely on the NatSpec documentation for understanding the contract behavior. It might lead to misunderstanding or misinterpretation of the intended logic, which could result in incorrect assumptions or decisions.

Tools Used

Manual review

Recommendations

Update NatSpec Comment: Revise the NatSpec comment to accurately reflect the logic implemented in the contract. For example, if the emit statement is correct, update the comment to // If random < defenderRapperSkill -> defenderRapperSkill wins, otherwise they lose.
Review and Test: Ensure that all comments, NatSpec, and code logic align with each other to avoid confusion and ensure clarity for developers and users

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

Contradictory battle result event

Support

FAQs

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