The RapBattle::Battle
event is triggered with wrong data (wrong winner) if the random value is equal to the defenderRapperSkill. The event is emitted with it's third field indicating the winner to be the challenger, however, the contract picks the defender as the winner.
The RapBattle::_battle
function emits the RapBattle::Battle
event with it's third field calculated using the less than relational operator (<).
However, in the next few lines, we see the usage of less than or equal to relational operator (<=) to pick the winner:
Thus, if the random value evaluates to be equal to defenderRapperSkill, the data in the event emitted and the actual winner picked will be different. The winner indicated by the event will be the challenger, but the winner picked by the contract will be the defender.
Events capture important information, allowing external observers to react to them and obtain relevant data. Dapps use events to display and update data in their UIs. An event emitted with wrong data may confuse or mislead people.
Foundry, VSCodium.
Make the following changes in the RapBattle::_battle
function:
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.