hack3r-0m - unsatisfiable condition in `getAdjustedLongAndShortTokenAmounts`
Closed this issue · 0 comments
sherlock-admin commented
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
- https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/deposit/ExecuteDepositUtils.sol#L392
- https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/deposit/ExecuteDepositUtils.sol#L392
Tool used
z3 SMT checker
Recommendation
reverse the conditions
Duplicate of #165