The event generated to publish the results of a battle and the actual result of said battle can differ, leading to events and actual results not matching.
In rapBattle.sol::_battle
, the outcome of a battle is determined twice:
once to generate an event
once to determine who should receive the prize of the battle
These two checks, however, differ, as one uses an inclusive comparison (<=), and the other a strict one (<).
The check to generate the event is
while the check to determine who receives the prize is
There is a clear, edge-case scenario where random
is equal to defenderRapperSkill
and these two checks end up returning opposite outcomes.
If the events are used for logging the outcomes of battles, there is a potential mismatch between the published results, via the event mechanism, and the actual winner, represented by the NFT owner that receives the prize.
Manual review, VSCode
The two checks should be equal, either both inclusive or both strict.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.