The fee variable is declared as uint24, which has a maximum value of 16_,777,_215. When the fee calculation is corrected to use this variable directly (rather than the current inline calculation), large sell transactions will cause the function to revert due to integer overflow.
Likelihood: Medium
The current inline calculation prevents this issue from manifesting, but any code refactor that assigns the calculated fee directly to the fee variable will trigger reverts on transactions exceeding 16_777_215 tokens. Assuming the fee variable type remains the same.
Impact: High
Large swap transactions will fail, effectively preventing whale trades and limiting protocol scalability. This could result in loss of user trust and trading volume.
Run the following test with forge test --mt test_FeeType -vvv:
Change the fee variable type from uint24 to uint256 to accommodate large transactions:
Alternatively, if the return type must remain uint24 for protocol compatibility, validate the fee before returning:
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.