Redundant Conditional Logic in Order Status Evaluation
The getOrderDetailsString
function includes a block of logic responsible for generating a human-readable order status (Active
, Expired
, Inactive
, etc.). However, the current implementation contains redundant and potentially conflicting conditional logic that can lead to confusion, code bloat, and inconsistent behavior if modified in the future.
Initially, the status
string is assigned using a nested ternary expression:
This makes the original ternary assignment useless, and results in redundant computation and hard-to-read logic flow.
Likelihood:
This code will always execute, and developers or auditors will encounter this redundancy on review.
Impact:
No direct impact on contract behavior or user funds.
Risk is limited to code maintainability, developer confusion, and technical debt accumulation.
For any order, the status
variable is first initialized based on active and deadline conditions, then immediately overwritten, for example:
For an active order with an expired deadline, the first line assigns:
But the next block immediately replaces it with:
For an inactive order, the value is assigned twice with no added benefit:
This behavior adds unnecessary complexity without improving clarity or functionality.
Recommended Mitigation
Refactor the status
logic to use only one clear and unambiguous conditional block:
Benefits:
Simplifies code
Easier to maintain and audit
Eliminates logical duplication
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.