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

Incorrect Battle emit information when random = defenderRapperSkill

Summary

Incorrect Battle emit information when random = defenderRapperSkill

Vulnerability Details

In one battle, contract will generate one random number. When random <= defenderRapperSkill, defender wins. However in Battle emit calculation, when random == defenderRapperSkill, will emit one event that challenger wins. This will be very confusing if someone monitors this event.

emit Battle(msg.sender, _tokenId, random < defenderRapperSkill ? _defender : msg.sender);
// If random <= defenderRapperSkill -> defenderRapperSkill wins, otherwise they lose
if (random <= defenderRapperSkill) {
// We give them the money the defender deposited, and the challenger's bet
credToken.transfer(_defender, defenderBet);
//@johnson [H], chanllenger do not approve, once lose, always fail [Done]
credToken.transferFrom(msg.sender, _defender, _credBet);
} else {
// Otherwise, since the challenger never sent us the money, we just give the money in the contract
credToken.transfer(msg.sender, _credBet);
}

Impact

Incorrect event information

Tools Used

Manual

Recommendations

Keep the alignment about the result.

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.