The audit has identified inconsistencies in the conditional storage checks within the SystemConfig.sol contract. Specifically, the same storage variable baseReferralRate is checked multiple times, but the conditionals are inconsistent. This could lead to off-by-one errors or logical inconsistencies, potentially causing unintended behaviors in the contract's functioning.
Inconsistent Conditional Check
Location: src/core/SystemConfig.sol, Line 54
Code:
Issue: This conditional checks if _referrerRate is less than baseReferralRate and reverts if true. However, there is no context provided for the rationale behind why being less than baseReferralRate should be considered invalid, potentially leading to confusion about this rule.
Inconsistent Conditional Check for Total Rate
Location: src/core/SystemConfig.sol, Line 203
Code:
Issue: This conditional adds _extraRate to baseReferralRate and checks if the sum exceeds the REFERRAL_RATE_DECIMAL_SCALER constant, and if so, it reverts. The inconsistency in how baseReferralRate is handled and checked across different functions can lead to confusion about its allowed ranges and dependencies.
The identified inconsistencies in conditional checks can cause:
Logical errors in contract behavior, leading to potential misconfigurations or unintended rejections.
Increased difficulty in reasoning about contract logic and ensuring correctness, potentially opening up the contract to further inadvertent vulnerabilities.
Risk of off-by-one errors or other boundary-related issues that may create edge cases, leading to unexpected contract behavior.
Manual Code Review
To mitigate the identified issue, the conditions used to check storage values should be standardized and consistently applied across the contract. This will prevent off-by-one errors and maintain uniform logic.
The following issues and its duplicates are invalid as admin errors/input validation/malicious intents are1 generally considered invalid based on [codehawks guidelines](https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity#findings-that-may-be-invalid). If they deploy/set inputs of the contracts appropriately, there will be no issue. Additionally admins are trusted as noted in READ.ME they can break certain assumption of the code based on their actions, and
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.