The smart contracts exhibit inconsistent rounding practices when calculating financial amounts such as collateral deposits and refunds. This inconsistency arises from using both Math.Rounding.Ceil
and Math.Rounding.Floor
in different parts of the code, potentially leading to discrepancies in financial transactions and impacting accuracy.
The PreMarkets
contract exhibits variability in rounding methods used for financial calculations:
Some functions use Math.Rounding.Ceil
(rounding up), while others use Math.Rounding.Floor
(rounding down).
This inconsistency is particularly evident in functions like createOffer
, listOffer
, and abortAskOffer
, where both rounding methods are applied interchangeably.
In contrast, the DeliveryPlace
contract predominantly uses Math.Rounding.Floor
for calculations such as collateral fees and refunds.
For example:
These discrepancies can lead to differences in the expected and actual amounts processed, affecting the accuracy of financial transactions and potentially leading to unintended financial losses or operational issues.
Financial Discrepancies: Users may experience discrepancies between the expected and actual amounts processed due to inconsistent rounding methods, potentially leading to overpayments or underpayments.
Operational Issues: Inaccurate financial processing can lead to operational challenges, including disputes and financial imbalances.
Manual Code Review
Ensure that all financial calculations use a consistent rounding method throughout all contracts to avoid discrepancies.
Duplicate of #456, however, for issues noting rounding directions, will be low severity given the impact is not proven sufficiently with a PoC/numerical example and most rounding will not result in significant losses e.g. most examples only proved at most a 1 wei difference when computing `depositAmount/platFormFees` and involves lower amount offers
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.