GMXV2_Module withdrawal functionality is broken due to missing callback implementation
Strategy registers for the GMX V2 withdrawal callback but never implements the matching interface function, so any withdrawal that GMX cancels reverts at the strategy side and the GM tokens (and underlying assets) become permanently locked.
Description
The GMXV2_Module integrates D2's Strategy with GMX V2 by exposing gmxv2_create_deposit, gmxv2_create_withdrawal and related entry points. Both deposits and withdrawals are asynchronous on GMX V2: the user creates an order, and the protocol later calls back into the strategy with the outcome (success, cancellation, or execution).
The strategy correctly handles deposit callbacks (afterDepositExecution, afterDepositCancellation) but is missing the cancellation handler on the withdrawal side. The contract declares its support for afterWithdrawalCancellation (the selector is registered as a facet entry) but the function body itself is never implemented.
function gmxv2_create_withdrawal(...) external onlyRole(EXECUTOR_ROLE) {// creates a withdrawal order through GMX ExchangeRouter// strategy is registered as the callbackContract}// afterWithdrawalExecution is implementedfunction afterWithdrawalExecution(...) external onlyKeeper { ... }// afterWithdrawalCancellation is NOT implemented
When GMX cancels a withdrawal (which can happen for several legitimate reasons: insufficient liquidity, price guard rejections, or simply if the keeper does not pick it up in time) it calls back into Strategy with afterWithdrawalCancellation. The call lands on the fallback path, which has no facet selector registered for that function and therefore reverts.
Because the cancellation revert prevents GMX from re-crediting the user's GM token position, the GM shares are dragged into a state where they are neither held by the user nor returnable through the strategy. The strategy holds the GM tokens but its withdrawal flow is the only path to unwind them, and that flow is now permanently broken.
Impact
- Any cancelled withdrawal on GMX V2 reverts inside the strategy callback.
- GMX V2 cannot complete the cancellation, so the underlying GM tokens stay stuck.
- Users cannot redeem their share of the GMX V2 position through any other strategy entry point.
- Funds are permanently locked once a withdrawal is created and cancelled on the GMX side.
Recommendation
Implement the afterWithdrawalCancellation handler on GMXV2_Module and register its selector so it can be reached through the strategy fallback. The handler should mirror the existing deposit cancellation pattern: clear the pending withdrawal accounting, return the GM tokens to the strategy balance, and emit a cancellation event.
Resolution
D2: Fixed in 9f0f0a.
Cyfrin: Verified.