#  Earlier bidders get cut out of future NFT holdings by bidders specifying the same price.

In Tessera GroupBuy, equal-priced bids evict earlier bidders from the priority queue, cutting them out of future NFT holdings.

- Payout: Contest reward
- Severity: medium
- Program: Tessera
- Credited: Trust
- Disclosed: 2023-04-18
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2022-12-tessera-findings/issues/45
- Library page: https://bugbountylibrary.com/r/c4%3A2022-12-tessera%3AM-08
- Tags: domain:web3 impact:funds-loss kind:contest platform:code4rena sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** GroupBuy.sol contribute / processBidsInQueue priority queue
**Root cause:** processBidsInQueue only breaks when _price < lowestBid.price, so an equal-priced bid falls into the else branch and deletes the existing lowest bid, replacing it with the new bidder.
**Steps:**
1. Call `contribute(poolId, quantity, price)` to fill supply at a given price, inserting bid into bidPriorityQueues.
2. Second bidder calls `contribute` with the same `_price` and a quantity exceeding remaining supply.
3. In `processBidsInQueue`, `_price < lowestBid.price` is false for equal price, so the else branch runs `bidPriorityQueues.delMin()` and inserts the new bidder.
4. Earlier bidder's contribution is refunded to pendingBalances and they lose their position in future NFT holdings.
**How found:** Code review of the queue-trimming loop in processBidsInQueue; noticed the strict `<` comparison lets equal-priced bids fall through to the eviction branch, contradicting documented behavior.
**Exploitation:** A later bidder submits a bid at the same price as an existing bidder; the queue evicts the earlier bid, refunding them and reassigning their share of the NFT to the new bidder.
**Insight:** When auditing priority-queue bid logic, check tie-breaking comparisons: a strict `<` break condition lets equal-priced entries be evicted, so verify the docs' stated tie behavior against the actual branch taken.
