sherlock-audit/2023-02-gmx-judging

hack3r-0m - unsatisfiable condition in `getAdjustedLongAndShortTokenAmounts`

Closed this issue · 0 comments

hack3r-0m

high

unsatisfiable condition in getAdjustedLongAndShortTokenAmounts

Summary

unsatisfiable condition in getAdjustedLongAndShortTokenAmounts

Vulnerability Detail

        if (poolLongTokenAmount < poolShortTokenAmount) {
            uint256 diff = poolLongTokenAmount - poolShortTokenAmount;

always reverts

        } else {
            uint256 diff = poolShortTokenAmount - poolLongTokenAmount;

always reverts

Impact

any market which has same long and short token will never work

Code Snippet

Tool used

z3 SMT checker

Recommendation

reverse the conditions

Duplicate of #165