In the bid
function, the NewHighestBid
event emits an incorrect bid amount. Specifically, the event emits the previous highest bid instead of the current bid amount:
The self.highest_bid.read()
function reads the highest bid before it is updated with the new bid amount. This means the amount emitted in the NewHighestBid
event in the bid
function refers to the previous highest bid, not the bid just placed by the user.
This issue is low severity because it does not affect the functionality of the auction, nor does it result in any loss of funds or security risks. However, it impacts the accuracy of emitted events, which are critical for external systems or users monitoring contract activity.
Manual Code Review, VSCode
To ensure that the correct bid amount is emitted in the NewHighestBid
event, the event should be emitted after the highest_bid
is updated with the new bid amount in the bid
function.
Consider moving the event emission after the bid amount is updated in bid
:
The `bid` function emits `NewHighestBid` event with wrong parameter. The `amount` parameter is `self.highest_bid.read()` that is called before the update of the `highest_bid` variable.
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.