sherlock-audit / 2023-12-dodo-gsp-judging

6 stars 5 forks source link

XDZIBEC - a ceiling division in reserve updates could lead to an imbalance in share value #83

Closed sherlock-admin2 closed 9 months ago

sherlock-admin2 commented 9 months ago

XDZIBEC

medium

a ceiling division in reserve updates could lead to an imbalance in share value

Summary

Vulnerability Detail

 function _divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 quotient = a / b;
        uint256 remainder = a - quotient * b;
        if (remainder > 0) {
            return quotient + 1;
        } else {
            return quotient;
        }
    }
}
        // The target will be updated
        _BASE_TARGET_ = uint112(uint256(_BASE_TARGET_) - DecimalMath._divCeil((uint256(_BASE_TARGET_) * (shareAmount)), totalShares));
        _QUOTE_TARGET_ = uint112(uint256(_QUOTE_TARGET_) - DecimalMath._divCeil((uint256(_QUOTE_TARGET_) * (shareAmount)), totalShares));

Manual Review

Recommendation

nevillehuang commented 9 months ago

Invalid, difference shown in example is so small (1) that it is hard to justify any severity other than low/informational