OrderBook

First Flight #43
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Impact: low
Likelihood: high
Invalid

Low: No minimum order size allows dust spam

Description

  • Normal behavior: In DeFi protocols, changes to key economic parameters (like trading fees) are expected to emit events. This ensures indexers, analytics dashboards, and automated bots can immediately detect and propagate updates. It’s a foundational transparency mechanism that keeps off-chain systems aligned with on-chain state.

  • Issue: In this contract, the setFee function directly updates the internal fee state variable without emitting any event. This means off-chain services relying on event streams for efficiency (rather than constant storage polling) remain unaware of fee changes until they explicitly query storage, often on delayed intervals.

function setFee(uint256 _fee) external onlyOwner {
@> fee = _fee; // updates silently without emitting an event
}

Risk

Likelihood:

  • Occurs every single time the owner changes the fee, because there is no event mechanism implemented.

  • Practically guaranteed on every governance or admin update.

Impact:

  • Dashboards and trading bots will continue displaying stale fee data, potentially misleading traders about the actual cost of transactions.

  • Erodes trust in the protocol’s transparency standards, possibly deterring professional integrations or partnerships that depend on reliable off-chain data streams.

Proof of Concept

orderBook.setFee(500);
// no FeeChanged event is emitted; indexers see outdated fee until next manual storage query

This shows how, when the owner updates the fee to 5% (500 basis points), the absence of an event means external tools (DEX aggregators, user dashboards, risk analyzers) have no way to detect the change in real-time. They continue to display the old fee rate, misleading users into executing trades under incorrect assumptions.

Recommended Mitigation

event FeeChanged(uint256 newFee);
function setFee(uint256 _fee) external onlyOwner {
fee = _fee;
+ emit FeeChanged(_fee); // broadcast new fee
}

By emitting a FeeChanged event, every fee update becomes immediately observable by indexers, explorers, bots, and front-end dashboards. This aligns the contract with DeFi standards for transparent governance and reduces user exposure to stale UI data, maintaining the integrity of the trading experience.

Updates

Lead Judging Commences

yeahchibyke Lead Judge
about 1 month ago
yeahchibyke Lead Judge about 1 month ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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