Skip to content

fix(deposit): track multi-tx deposit routes as one deposit and raise IBC timeout - #2133

Closed
mintae-clk wants to merge 1 commit into
dydxprotocol:mainfrom
mintae-clk:fix/deposit-multi-tx-tracking
Closed

mintae-clk wants to merge 1 commit into
dydxprotocol:mainfrom
mintae-clk:fix/deposit-multi-tx-tracking

Conversation

@mintae-clk

@mintae-clk mintae-clk commented Nov 19, 2026 •

Copy link
Copy Markdown

Changes

Addresses two follow-ups listed in #2131: raise the deposit timeout for multi-tx routes, and stop tracking a deposit twice when its route has two broadcasts.

Deposit IBC timeout: 10 minutes -> 24 hours (depositHooks.ts)

  • On Base -> Injective -> dYdX, /msgs sets the Injective -> dYdX IBC timeout when the route is built. That tx is only broadcast after the CCTP leg lands, and a CCTP V2 standard-finality transfer takes about 15-20 minutes. With 10 minutes the timeout had already passed, so the tx failed on chain with timeout elapsed (code 40) and the funds stayed on Injective.
  • 24 hours leaves room for slow CCTP finality while still expiring stuck transfers.

One deposit record per route (state/transfers.ts, depositHooks.ts)

  • onTransactionBroadcast fires once per tx. Each call used to add a new deposit, so a 2-tx route showed up as two deposits.
  • The first broadcast now creates the deposit with txsRequired and transactions[]. Later broadcasts are appended through a new onDepositBroadcast reducer, the same pattern withdraws use.
  • txHash / chainId on the deposit stay the origin tx, so updateDeposit, selectDeposit and the status dialog are unchanged.

Status tracking (useUpdateTransfers.tsx)

  • Multi-tx deposits track the latest pending tx. The deposit is success only when the last required tx succeeds. Before, the CCTP leg landing on Injective already showed "deposit complete".
  • The deposit is set to error when:
    • Skip reports a terminal failure (STATE_COMPLETED_ERROR / STATE_ABANDONED). Before, it stayed pending forever. This also applies to single-tx deposits.
    • The route throws before every tx was broadcast, for example when the user rejects the next signature.
    • After a reload, a deposit whose next tx was never broadcast can no longer progress. This is detected with an in-memory inFlightDepositIds.
  • A late result for an earlier leg never reopens a finished deposit.
  • A non-terminal polling error, such as a network failure, clears the dedupe key so the tx can be tracked again.
  • The deposit-level explorerLink stays the origin tx. Later txs keep their own link in transactions[].
  • Status is read from response.state, the same field waitForTransaction checks. status is deprecated.

Compatibility

  • Deposits persisted before this change have no txsRequired, so they follow the single-tx path as before. No migration is needed.
  • Single-tx deposits behave as before, except that a terminal failure now ends in error instead of staying pending.

Not changed

  • IS_DEPOSIT_UNDER_MAINTENANCE stays true. Re-enabling deposits is your call.

Known limitations

  • inFlightDepositIds is per tab and transfer state is not synced across tabs. If a second tab is opened during a multi-tx deposit, that tab can mark the deposit error.
  • When a multi-tx deposit ends in error, the funds remain on the intermediate chain (Injective). The UI does not yet say where they are.
  • Routes with 3 or more txs use the same logic but were not tested against a real route.

Testing

  • tsc: no errors in the changed files. The existing TradingView module errors are unrelated.
  • eslint on the changed files: no new warnings.
  • vitest: existing tests pass. There are no deposit tracking tests yet.
  • Not yet tested end to end in the app on mainnet, since deposits are paused.

Issue

Related Issues (Optional)

…IBC timeout

- Raise the deposit IBC timeout from 10 minutes to 24 hours. On Base -> Injective
  -> dYdX the Injective IBC tx is only broadcast after the CCTP leg lands
  (~15-20 min on standard finality), so a 10 minute timeout expired first and
  the tx failed on chain with "timeout elapsed".
- Record a multi-tx route as one deposit (txsRequired + transactions[]), like
  withdraws, instead of one deposit per broadcast.
- Mark the deposit successful only when the last required tx succeeds; mark it
  failed on a terminal error, a rejected later signature, or a route that can no
  longer progress after a reload. Never reopen a finished deposit.
@mintae-clk
mintae-clk requested a review from a team as a code owner November 19, 2026 10:01
@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@mintae-clk is attempting to deploy a commit to the dYdX Trading Team on Vercel.

A member of the Team first needs to authorize it.

@mintae-clk

Copy link
Copy Markdown
Author

Closing this since #2132 and #2138 cover it: the timeout is now 24h and deposits route to Injective in a single tx, so the multi-tx tracking is no longer needed.

@mintae-clk mintae-clk closed this Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant