code4rena-2023-12-shell-protocol-l05

[L-05] NATSPEC on OceanAdapter._convertDecimals should be revised

보고서

Summary

함수 주석이 잘못된 정보를 제공한다.

Keyword

clean conde

Vulnerability

NatSpec 주석 내용이 잘못되었다. OceanAdapter._convertDecimals 함수는 Ocean._convertDecimals 함수의 복사본이다. 하지만 원본과는 다르게, OceanAdapter._convertDecimals 에서는 truncatedAmount 값을 리턴하지 않는다. 하지만 주석에서는 이 값을 리턴할 것처럼 안내한다.

     * @dev convert a uint256 from one fixed point decimal basis to another,
@>   *   returning the truncated amount if a truncation occurs.
     * @dev fn(from, to, a) => b
     * @dev a = (x * 10**from) => b = (x * 10**to), where x is constant.
     * @param amountToConvert the amount being converted
     * @param decimalsFrom the fixed decimal basis of amountToConvert
     * @param decimalsTo the fixed decimal basis of the returned convertedAmount
     * @return convertedAmount the amount after conversion
     */
    function _convertDecimals(
        uint8 decimalsFrom,
        uint8 decimalsTo,
        uint256 amountToConvert
    )
        internal
        pure
        returns (uint256 convertedAmount)

Impact

주석이 잘못된 정보를 제공한다.

Mitigation

잘못된 주석을 삭제한다.


tags: bughunting, shell protocol, smart contract, solidity, clean code, severity low