The bid
function overwrites previous bids instead of accumulating them, potentially leading to loss of funds for users who bid multiple times.
https://github.com/Cyfrin/2024-10-starknet-auction/blob/main/src/starknet_auction.cairo#L97-L114
In the current implementation, when a user places a bid, the contract overwrites the previous bid amount instead of adding to it. This is due to the line:
This directly sets the bid value for the sender to the new amount, discarding any previous bids they may have made.
Users who bid multiple times will lose the value of their previous bids, potentially resulting in significant financial loss.
Manual Review
Modify the bid
function to accumulate bids for each user instead of overwriting them.
In the `bid` function the bid values are stored using `self.bid_values.entry(sender).write(amount)` directly, but this overwrites any previous bids made by the same bidder. Therefore if a participant makes 2 or more bids, the participant can then withdraw only the last value of the last bid. That is incorrect, the protocol should save all bids and a participant should withdraw the value of the all unsuccessful bids.
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.