The buyOrder(), createSellOrder(), amendSellOrder(), cancelSellOrder(), getOrder(), getOrderDetailsString() function is marked public but is never called internally within the OrderBook contract.
When a public function is called externally, Solidity copies arguments from calldata to memory, which increases gas cost — especially with dynamic types.
In contrast, external functions access arguments directly from calldata, making them more gas-efficient and reducing bytecode size.
Likelihood:
Developers often default to public
, even for functions never called internally.
Solidity allows this without error or warning.
This inefficiency is common in many contracts, especially when not optimized for gas.
Impact:
Increased gas cost on every external call to buyOrder().
Slightly larger bytecode due to the internal callable "interface" that public functions generate.
Reduces overall protocol efficiency in high-frequency trading systems like an on-chain order book.
For prove this we mimic an function
Update the visibility of the buyOrder() function from public to external:
Also apply the same change to other externally-only functions like:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
View preliminary resultsAppeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.