The functions setQuantAMMSwapFeeTake and setQuantAMMUpliftFeeTake both update the same state variable, quantAMMSwapFeeTake. This causes the UpliftFee and SwapFee to always have identical values, even though the naming of the functions implies they are meant to be independent.
This creates a logic vulnerability where the intended separation of fees is violated, leading to potential confusion and unintended side effects in contract behavior.
Justification:
This vulnerability is classified as medium severity because:
There is no direct loss of funds or immediate security risk.
It breaks the intended business logic and fee management system.
It could lead to incorrect fee applications and financial discrepancies.
It affects administrative control but does not compromise the core protocol security.
The vulnerability arises due to both setQuantAMMSwapFeeTake and setQuantAMMUpliftFeeTake modifying the same state variable, quantAMMSwapFeeTake. As a result, setting one fee inadvertently overwrites the value of the other, even though they are intended to represent distinct parameters.
This behavior is demonstrated in the test case below, where setting the SwapFee also changes the UpliftFee.
Affected code:
UpdateWeightRunner.sol#L126-L153
Paste the following code into the UpdateWeightRunner.t.sol file:
This test passes, confirming that the UpliftFee is being set when setQuantAMMSwapFeeTake is called. This violates the expected independence of the two fees.
Misrepresentation of Logic:
Users or developers interacting with the contract may incorrectly assume that UpliftFee and SwapFee are independently configurable.
Unexpected Behavior:
Modifying one fee unintentionally alters the other, potentially disrupting calculations or business logic relying on distinct fee values.
Increased Risk of Errors:
Future updates to the contract or dependent systems may introduce further bugs due to this conflation of two seemingly separate variables.
Manual code review.
Foundry for testing the testSwapFeeSetsUpliftFee behavior.
Separate State Variables:
Introduce a dedicated state variable for UpliftFee to ensure it is distinct from SwapFee. For example:
Update setQuantAMMUpliftFeeTake Implementation:
Modify the setQuantAMMUpliftFeeTake function to manage the new quantAMMUpliftFeeTake variable independently:
Remove Redundancy if Fees Are Intended to Be Identical:
If the fees are intended to be the same, merge the functions and use a single variable. Update the function names and documentation to reflect this behavior clearly.
Likelyhood: High, calling setters or getters Impact: Low/Medium, both getters return `quantAMMSwapFeeTake` and `setQuantAMMUpliftFeeTake` modify `quantAMMUplfitFeeTake`. Real impact: those 2 values will be always the same.
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.