fix(bridging): query across status by deposit tx hash, not order id - #992
fix(bridging): query across status by deposit tx hash, not order id#992gomesalexandre wants to merge 1 commit into
Conversation
getBridgingStatusFromEvents() asked the Across "/deposit/status" API about event.orderId (the CoW order UID) instead of event.srcTransactionHash (the actual on-chain deposit tx). Across has no record of the order UID, so the lookup effectively never resolves a real deposit, the error is swallowed by the surrounding try/catch, and a Bungee-routed Across bridge that actually expired or got refunded is reported as IN_PROGRESS forever instead of EXPIRED/REFUND.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Bungee bridge status flow now uses the deposit transaction hash for Across status queries. It requires a source transaction hash and adds coverage for expired destination events. ChangesBungee status lookup
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Across bridge status polling now uses the on-chain deposit transaction hash, allowing expired or refunded deposits to resolve correctly instead of remaining in progress. The change includes coverage for this behavior and has no remaining merge-blocking risk. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
packages/bridging/src/providers/bungee/BungeeBridgeProvider.test.tsParsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax. packages/app-data/tsconfig.json(2,14): error TS6053: File ' packages/bridging/src/providers/bungee/BungeeBridgeProvider.tsParsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax. packages/app-data/tsconfig.json(2,14): error TS6053: File ' packages/bridging/src/providers/bungee/getBridgingStatusFromEvents.tsParsing error: Unable to parse the specified 'tsconfig' file. Ensure it's correct and has valid syntax. packages/app-data/tsconfig.json(2,14): error TS6053: File ' Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
tl;dr
getBridgingStatusFromEventswas asking Across about the CoW order UID instead of the actual deposit tx hash, so an expired/refunded Bungee+Across bridge was never detected.What's broken
In
packages/bridging/src/providers/bungee/getBridgingStatusFromEvents.ts, when a Bungee event's source leg isCOMPLETEDand the destination leg is stillPENDINGfor an Across-routed bridge, the code asks the Across API for the deposit status:getAcrossStatus(seeBungeeApi.ts) hits Across's/deposit/status?depositTxHash=...endpoint - it needs the on-chain deposit transaction hash, notorderId(which is CoW's own order UID / Bungee's request identifier and has no meaning to Across).Since Across never recognizes the order UID as a deposit hash, the lookup fails, the error is swallowed by the surrounding
try/catch(console.erroronly), and the function falls through toIN_PROGRESS. Net effect: a bridge that Across has actually markedexpiredorrefundedis reported as perpetuallyIN_PROGRESSand never surfacesBridgeStatus.EXPIRED/BridgeStatus.REFUNDto callers.Also added a guard for the case
srcTransactionHashis undefined (per the type, only guaranteed oncesrcTxStatus === COMPLETED, but TS still types it optional) so this compiles cleanly and doesn't attempt a lookup withundefined.Fix
Pass
event.srcTransactionHash(the real deposit tx hash) instead ofevent.orderId. Also renamed the misleading callback parameter name at both call sites inBungeeBridgeProvider.ts(it was itself namedorderId, which is likely how this slipped in) todepositTxHashto match what the callback's type signature actually expects.receipts
no runtime changes visually - this is backend/status-polling logic with no UI surface. Added a regression test (
BungeeBridgeProvider.test.ts) that:getAcrossStatusis called with the deposit tx hash ('0x123'), never the order id ('123')EXPIRED(previously would have been swallowed intoIN_PROGRESS)Confirmed the added test fails against the pre-fix code (wrong arg passed) and passes after the fix, across all 3 SDK adapters (ethers v5, ethers v6, viem).
Test plan
pnpm jest BungeeBridgeProvider.test.ts- 48/48 passing across all adapterspnpm turbo run typecheck --filter=@cowprotocol/sdk-bridgingpnpm turbo run lint --filter=@cowprotocol/sdk-bridgingSummary by CodeRabbit