Game::GameEnded
emit a wrong data, make it send a wrong data to frontEnd or blockchain explorerThe pot will be reset after Game::declareWinner
is called. This is good but it will give a wrong data when it emit the event.
Not just that, pot = 0;
is called again on Game::resetGame
. It is redundant and bad practices
Likelihood:
Very likely to give a wrong data when emit when everytime Game::declareWinner
called.
Impact:
Front end will get wrong data if they use it
Player use Game::declareWinner
to get the winner
The contract send an Emit to the blockchain with the pot = 0
Frontend will get the wrong value because its only 0
Please consider between this two suggestion:
Please remove the first pot = 0;
on Game::declareWinner
because when the game reset, pot = 0
will be called on Game::resetGame
which is mandatory to continue the game
If the protocol insist to use it on Game::declareWinner
, consider to use a ghost variable to cache the data before it goes to pot = 0;
and use the variable to emit the data.
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.