Assessment reports>Orderly Network>Discussion>The `changeFeeCollector` does not revert

The changeFeeCollector does not revert if type is incorrect

The function changeFeeCollector allows to set the ID of withdrawFeeCollector, and futuresFeeCollector depends on passed feeCollectorType. But even if the feeCollectorType is not WithdrawFeeCollector or FuturesFeeCollector, the function will still be executed successfully. We recommend adding the else state to this function to return in case feeCollectorType is invalid.

function changeFeeCollector(FeeCollectorType feeCollectorType, bytes32 _newCollector) public override onlyOwner {
    if (feeCollectorType == FeeCollectorType.WithdrawFeeCollector) {
        emit ChangeFeeCollector(feeCollectorType, withdrawFeeCollector, _newCollector);
        withdrawFeeCollector = _newCollector;
    } else if (feeCollectorType == FeeCollectorType.FuturesFeeCollector) {
        emit ChangeFeeCollector(feeCollectorType, futuresFeeCollector, _newCollector);
        futuresFeeCollector = _newCollector;
    }
}

Remediation

This issue has been acknowledged by Orderly Network, and a fix was implemented in commit 6becad39.

Zellic © 2024Back to top ↑