Description: Because the contract computes the protocol fee via pure integer division:
with FEE = 3 and PRECISION = 100. Since order.priceInUSDC is denominated in USDC’s smallest units (1 USDC = 10⁶ micro-USDC), any order priced below ⌈100/3⌉ = 34 micro-USDC (0.000034 USDC) results in protocolFee == 0. In practice, orders of 1–33 micro-USDC incur no fee.
Impact: By listing orders for 1–33 micro-USDC, users can completely avoid paying protocol fees. Although each trade is tiny, this “zero-fee” window is surprising and could be abused in bulk or in derivative contracts, leading to revenue loss and skewed fee expectations.
Proof of Concept: Include the following test in the TestOrderBook.t.sol file:
Mitigation: Ceiling Division: compute fees as
guaranteeing protocolFee ≥ 1 whenever order.priceInUSDC > 0.
Minimum-Size Enforcement: require
Protocol Suffers Potential Revenue Leakage due to Precision Loss in Fee Calculation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.