OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Low: Lack of indexed fields in events reduces indexer efficiency

Description

The contract emits events like OrderCreated to record key state changes. However, these events do not index critical parameters such as orderId and seller, making it difficult for off-chain systems to efficiently filter and process data.


Root + Impact

Normal Behavior:
Events provide a historical log that off-chain indexers (like TheGraph, Dune Analytics, custom bots) use to track protocol state and user-specific actions.

Issue:
Without indexed keywords on key parameters, these systems must scan and decode every single log to find relevant events. This drastically increases indexing time and computational costs.

event OrderCreated(uint256 orderId, address seller, uint256 amount, uint256 price);
// @> Root cause: lacks `indexed` on orderId and seller, forcing full scans by external services

Example scenario:
A wallet trying to display all orders for seller must fetch all OrderCreated logs from block 0, decode them, then check seller manually. This results in slower UIs, higher RPC costs, and potential missed orders due to timeouts.


Risk

Likelihood

  • Always occurs — every off-chain tool reading order data faces this inefficiency.

Impact

  • Low — does not affect funds, but negatively impacts user experience, dApp performance, and long-term ecosystem costs.


Proof of Concept

A typical TheGraph subgraph handler for unindexed events has to process every event:

function watchOrders() external {
// @> Must scan all logs and manually decode, cannot use direct topic filter
}

This increases sync time and may cause delayed user balances or dashboards.


Recommended Mitigation

- event OrderCreated(uint256 orderId, address seller, uint256 amount, uint256 price);
+ event OrderCreated(uint256 indexed orderId, address indexed seller, uint256 amount, uint256 price);
// @> Allows off-chain systems to use topic filters, drastically improving performance

By indexing orderId and seller, off-chain systems can use native eth_getLogs filtering to instantly find relevant events, reducing RPC load and improving dashboard responsiveness. This makes the protocol more scalable and cheaper for integrators.

Updates

Lead Judging Commences

yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

Poor event indexing and asset token symbol not displayed

Events not properly indexed. Filtering and querying from analytic tools will be very in-efficient

Support

FAQs

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