The PreMarktes::createOffer
contains validation checks for the eachTradeTax
and collateralRate
parameters. The NatSpec comments indicate that eachTradeTax must be less than 100% and collateralRate must be more than 100%, with a decimal scaler of 10000 (link: https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L42-L43).
However, the actual implementation uses >
and <
operators, which do not align with the specified requirements.
The current implementation uses the following conditions (https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/PreMarkets.sol#L49C8-L55C10):
These conditions allow eachTradeTax
to be exactly 100% and collateralRate
to be exactly 100%, which contradicts the NatSpec comments.
This discrepancy can lead to unintended behavior where offers with eachTradeTax
equal to 100% and collateralRate
equal to 100% are accepted, causing financial losses within the marketplace.
Manual review
Update the validation conditions:
I believe this is borderline informational/low. Despite this off-by-one error of the intended check, the difference between 100% and 101% is minimal, so I believe whether or not 100% is allowed has minimal impact. Ultimately, it still comes down to the risk level that users are willing to take
Similar to issue #1323, Despite this off-by-one error of the intended check, the difference between 99% and 100% is minimal, so I believe whether or not 100% is allowed has minimal impact. Ultimately, takers should not be realistically creating offer with such tradeTax
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.