Severity: High
Description: The current implementation overwrites previous bids from the same user instead of accumulating them. This leads to a loss of bid history and potential loss of funds for users who place multiple bids.
Impact:
Users who place multiple bids lose their previous bid amounts.
The contract fails to accurately track the total amount bid by each user.
There's no mechanism to refund previous bids if a user is outbid or the auction ends without them winning.
This creates confusion and potential financial loss for users who incrementally increase their bids.
Code Part:
Recommendation: Modify the bid
function to accumulate bids and implement a refund mechanism for previous bids. Here's a proposed fix:
These changes ensure that:
Multiple bids from the same user are accumulated rather than overwritten.
Users can incrementally increase their bids without losing previous amounts.
The contract accurately tracks the total amount bid by each user.
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.