Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: low
Valid

Event Emitting Error

Root + Impact

Description

  • In the Buy Now Logic branch

    AuctionSettled is already emitted within _executeSale , so no additional emission is needed

    The current code emits AuctionSettled after require(msg.sender != previousBidder, ...) , which is logically incorrect because the auction has not yet ended and the NFT has not yet been transferred.

function placeBid(uint256 tokenId) external payable isListed(tokenId) {
Listing storage listing = listings[tokenId];
address previousBidder = bids[tokenId].bidder;
uint256 previousBidAmount = bids[tokenId].amount;
require(listing.seller != msg.sender, "Seller cannot bid");
require(listing.auctionEnd == 0 || block.timestamp < listing.auctionEnd, "Auction ended");
if (listing.buyNowPrice > 0 && msg.value >= listing.buyNowPrice) {
uint256 salePrice = listing.buyNowPrice;
uint256 overpay = msg.value - salePrice;
bids[tokenId] = Bid(msg.sender, salePrice);
listing.listed = false;
if (previousBidder != address(0)) {
_payout(previousBidder, previousBidAmount);
}
// @Notice: AuctionSettled is already emitted within _executeSale , so there's no need to emit it again..
_executeSale(tokenId);
if (overpay > 0) {
_payout(msg.sender, overpay);
}
return;
}
require(msg.sender != previousBidder, "Already highest bidder");
// @Notice: The current code emits AuctionSettled after require(msg.sender != previousBidder, ...) , which is logically incorrect because the auction hasn't ended yet and the NFT hasn't been transferred
emit AuctionSettled(tokenId, msg.sender, listing.seller, msg.value);

Risk

Likelihood:

  • The Regular Bidding Logic branch will directly trigger AuctionSettled, which will make people mistakenly think that the auction has been completed

Impact:

  • The monitoring program misjudged the transaction, and others would stop bidding.

Proof of Concept

Recommended Mitigation

Delete emit AuctionSettled(tokenId, msg.sender, listing.seller, msg.value); on line 143 and let the _executeSale function handle all settlement-related event emissions
Updates

Lead Judging Commences

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Validated
Assigned finding tags:

BidBeasts Marketplace: Incorrect Event Emission

placeBid emits AuctionSettled even though the auction hasn’t ended, causing misleading event logs.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!