Bid Beasts

First Flight #49
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Impact: low
Likelihood: low
Invalid

[L-2] - Missing indexed event.

Root + Impact

[L-2] - Missing indexed event.

Description

Indexed event fields make the data more quickly accessible to off-chain tools that parse events, and adds them to a special data structure known as “topics” instead of the data part of the log. A topic can only hold a single word (32 bytes) so if you use a reference type for an indexed argument, the Keccak-256 hash of the value is stored as a topic instead.

Each event can use up to three indexed fields. If there are fewer than three fields, all of the fields can be indexed. It is important to note that each index field costs extra gas during emission, so it's not necessarily best to index the maximum allowed fields per event (three indexed fields).

This is specially recommended when gas usage is not particularly of concern for the emission of the events in question, and the benefits of querying those fields in an easier and straight-forward manner surpasses the downsides of gas usage increase.

Risk

Likelihood: Low.

Impact: Low.

Proof of Concept

The following events on the BidBeastsNFTMarket contract are missing an indexed field:

  • NFtListed:

event NftListed(uint256 tokenId, address seller, uint256 minPrice, uint256 buyNowPrice);
  • BidPlaced:

event BidPlaced(uint256 tokenId, address bidder, uint256 amount);
  • AuctionSettled:

event AuctionSettled(uint256 tokenId, address winner, address seller, uint256 price);

Recommended Mitigation

Modify the declared events, attributing the indexed keyword for the important fields. This action will allow easier fetching of on-chain data through events.

Here is a simple example on how to modify these events:

- event NftListed(uint256 tokenId, address seller, uint256 minPrice, uint256 buyNowPrice);
+ event NftListed(uint256 tokenId, address indexed seller, uint256 minPrice, uint256 buyNowPrice);
Updates

Lead Judging Commences

cryptoghost Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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

Give us feedback!