The function getOrderDetailsString
returns a user-readable string representing the state of a given order. The status field is intended to reflect whether an order is active, inactive, or expired.
The logic for computing the status
string is both redundant and inconsistent. The status is initially assigned using a ternary operator, then completely overwritten by an if-else
block, making the initial computation unnecessary. This can lead to confusion for maintainers, and could result in misleading or inconsistent outputs if not properly maintained.
Likelihood:
This code is always executed when someone calls getOrderDetailsString
, especially via UI or external API display integrations.
The redundant logic is unlikely to break functionality but introduces the risk of future bugs if someone updates only one part of the logic.
Impact:
Inconsistent or confusing status outputs to users, especially if the ternary and conditional logic are not kept in sync.
Wasted gas during execution due to unused string concatenation and unnecessary computation if performed on-chain (unlikely nevertheless).
Increase the code size uncessary and therefore the deployment code
Risk of future bug example:
A frontend integrates with getOrderDetailsString to show order status.
A developer later modifies only the ternary part to introduce a new label (e.g., "Soon to Expire") but forgets to update the if-else block, causing a mismatch and misleading output.
Remove the useless first assignement
Improve the if block
Starts with the most definitive check — if the order is inactive — reducing nested condition complexity.
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.