Assessment reports>GTE -- Perp>Low findings>Incorrect condition check in ,setMinLimitOrderAmountInBase
Category: Coding Mistakes

Incorrect condition check in setMinLimitOrderAmountInBase

Low Severity
Low Impact
Low Likelihood

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:

  1. It prevents a valid value, specifically MIN_MIN_LIMIT_ORDER_AMOUNT_BASE, from being set as the minLimitOrderAmountInBase for a market.

  2. It allows invalid values — those less than MIN_MIN_LIMIT_ORDER_AMOUNT_BASE — to be set for minLimitOrderAmountInBase.

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.

Zellic © 2025Back to top ↑