The `getOrderDetailsString()` function in the OrderBook contract contains logically redundant code for computing the status of the order, resulting in unnecessary gas usage during view calls. This broke the readme statement of maintaining a "gas-efficient architecture".
The function assigns a value to the status variable using a ternary operator :
However, this value is immediately overwritten by the following if-else block :
As a result, the initial ternary assignment serves no purpose and introduces unnecessary operations.
Impact:
Increased bytecode size: Redundant logic increases contract complexity and deployment size.
Unnecessary gas consumption: Although this is a view function, excessive logic may still incur higher execution cost during off-chain calls.
Reduced maintainability: The code is harder to read and reason about, increasing the risk of errors in future updates.
Misleading claim: The README states that the architecture is "gas-efficient", which is not fully accurate given this inefficiency.
Delete the redundant logic to use only a single conditional block
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.