You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 24, 2023. It is now read-only.
Global position-fee-related state not updated until after liquidation checks are done
Summary
Global position-fee-related state not updated until after liquidation checks are done
Vulnerability Detail
Checking whether a position is liquidatable occurs before the global state is updated.
Impact
A position that should be liquidated in the current block, won't be liquidated until the next block, when the correct fee multipliers/factors are applied. A delayed liquidation means that a position that should have been liquidated will not be, likely causing a larger loss than should have been incurred.
IllIllI
medium
Global position-fee-related state not updated until after liquidation checks are done
Summary
Global position-fee-related state not updated until after liquidation checks are done
Vulnerability Detail
Checking whether a position is liquidatable occurs before the global state is updated.
Impact
A position that should be liquidated in the current block, won't be liquidated until the next block, when the correct fee multipliers/factors are applied. A delayed liquidation means that a position that should have been liquidated will not be, likely causing a larger loss than should have been incurred.
Code Snippet
State is updated after the liquidation checks:
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/position/DecreasePositionUtils.sol#L152-L179
Tool used
Manual Review
Recommendation
Call
PositionUtils.updateFundingAndBorrowingState()
before all checksThe text was updated successfully, but these errors were encountered: