Incorrect condition check in setMinLimitOrderAmountInBase
Description
The setMinLimitOrderAmountInBase function contains an incorrect conditional check. The condition compares the newLimitOrderAmountInBase parameter with the MIN_MIN_LIMIT_ORDER_AMOUNT_BASE constant using the == operator. It should instead use the < operator.
function setMinLimitOrderAmountInBase(PerpBook storage self, uint256 newLimitOrderAmountInBase) internal {
if (newLimitOrderAmountInBase == MIN_MIN_LIMIT_ORDER_AMOUNT_BASE) revert InvalidMinLimitOrderAmountInBase();
self.settings.minLimitOrderAmountInBase = newLimitOrderAmountInBase;
}Impact
The incorrect check has two primary consequences:
It prevents a valid value, specifically
MIN_MIN_LIMIT_ORDER_AMOUNT_BASE, from being set as theminLimitOrderAmountInBasefor a market.It allows invalid values — those less than
MIN_MIN_LIMIT_ORDER_AMOUNT_BASE— to be set forminLimitOrderAmountInBase.
Recommendations
We recommend correcting the conditional check in the setMinLimitOrderAmountInBase function as follows:
- if (newLimitOrderAmountInBase == MIN_MIN_LIMIT_ORDER_AMOUNT_BASE) revert InvalidMinLimitOrderAmountInBase();
+ if (newLimitOrderAmountInBase < MIN_MIN_LIMIT_ORDER_AMOUNT_BASE) revert InvalidMinLimitOrderAmountInBase();Remediation
This issue has been acknowledged by Liquid Labs, Inc., and a fix was implemented in commit 05a84a34↗.