sherlock-audit / 2023-02-gmx-judging

17 stars 11 forks source link

hack3r-0m - unsatisfiable condition in `getAdjustedLongAndShortTokenAmounts` #230

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

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