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

Wrong emit of Battle event

Summary

Emitting the wrong winner in an edge case

Vulnerability Details

emit Battle(msg.sender, _tokenId, random < defenderRapperSkill ? _defender : msg.sender);
// If random <= defenderRapperSkill -> defenderRapperSkill wins, otherwise they lose
if (random <= defenderRapperSkill) {
console.log("DEFENDERS WINS");

If random equals defenderRapperSkill, the defender will be the winner, however, the Battle event will emit that the challenger has won.

Impact

This is low likelihood and has low impact, except if something else is listening for this event.

Tools Used

Recommendations

- emit Battle(msg.sender, _tokenId, random < defenderRapperSkill ? _defender : msg.sender);
+ emit Battle(msg.sender, _tokenId, random <= defenderRapperSkill ? _defender : msg.sender);
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.