fix: disable Tron swaps on RelaySwapper#12014
Conversation
Tron deposits via Relay are broken due to two bugs: 1. Transactions are built as simple TRC20 transfers instead of depositErc20() vault contract calls, so Relay cannot correlate deposits with swap intents on-chain. 2. The Relay indexer notification (POST /transactions/single) is gated behind isEvmChainId(), so non-EVM chains never notify Relay about completed deposits. This combination causes Tron deposits to be completely untracked by Relay, resulting in stuck/lost user funds in the vault contract. Disabling Tron in the chainIdToRelayChainId mapping prevents any Tron quotes from being served until the underlying bugs are fixed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe pull request removes Tron support from the RelaySwapper constant mapping by removing the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
|
Merging to get hotfix to production. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/swapper/src/swappers/RelaySwapper/constant.ts`:
- Around line 89-93: Remove the explanatory comment block (the multi-line
comment about Tron deposits and Relay indexer) added in constant.ts and leave
only the code (e.g., the commented-out entry [tronChainId]: 728126428 if
desired), so no new descriptive comments remain in the file; capture the
rationale in the PR description or an issue instead. Ensure you remove lines
that begin with the comment markers around the Tron explanation and do not add
any other comments describing past implementations or changes.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/swapper/src/swappers/RelaySwapper/constant.ts
| // DISABLED: Tron deposits are built as simple TRC20 transfers instead of depositErc20() vault calls, | ||
| // and the Relay indexer notification is never sent for non-EVM chains. This causes deposits to be | ||
| // untracked by Relay, resulting in stuck/lost funds. Re-enable once the Tron transaction building | ||
| // is verified to use the Relay quote calldata (depositErc20) correctly. | ||
| // [tronChainId]: 728126428, |
There was a problem hiding this comment.
Remove the explanatory comment block (comments disallowed here).
Lines 89-93 add comments explaining prior behavior and the change; this violates the repo rule to avoid new comments and to avoid comments that describe changes. Please remove the comment block and keep the code change only, and capture rationale in the PR description or an issue.
Proposed diff
- // DISABLED: Tron deposits are built as simple TRC20 transfers instead of depositErc20() vault calls,
- // and the Relay indexer notification is never sent for non-EVM chains. This causes deposits to be
- // untracked by Relay, resulting in stuck/lost funds. Re-enable once the Tron transaction building
- // is verified to use the Relay quote calldata (depositErc20) correctly.
- // [tronChainId]: 728126428,As per coding guidelines “Never add code comments unless explicitly requested” and “When modifying code, do not add comments that reference previous implementations or explain what changed. Comments should only describe the current logic and functionality.”
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // DISABLED: Tron deposits are built as simple TRC20 transfers instead of depositErc20() vault calls, | |
| // and the Relay indexer notification is never sent for non-EVM chains. This causes deposits to be | |
| // untracked by Relay, resulting in stuck/lost funds. Re-enable once the Tron transaction building | |
| // is verified to use the Relay quote calldata (depositErc20) correctly. | |
| // [tronChainId]: 728126428, |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/swapper/src/swappers/RelaySwapper/constant.ts` around lines 89 - 93,
Remove the explanatory comment block (the multi-line comment about Tron deposits
and Relay indexer) added in constant.ts and leave only the code (e.g., the
commented-out entry [tronChainId]: 728126428 if desired), so no new descriptive
comments remain in the file; capture the rationale in the PR description or an
issue instead. Ensure you remove lines that begin with the comment markers
around the Tron explanation and do not add any other comments describing past
implementations or changes.
Tron deposits via Relay are broken due to two bugs: 1. Transactions are built as simple TRC20 transfers instead of depositErc20() vault contract calls, so Relay cannot correlate deposits with swap intents on-chain. 2. The Relay indexer notification (POST /transactions/single) is gated behind isEvmChainId(), so non-EVM chains never notify Relay about completed deposits. This combination causes Tron deposits to be completely untracked by Relay, resulting in stuck/lost user funds in the vault contract. Disabling Tron in the chainIdToRelayChainId mapping prevents any Tron quotes from being served until the underlying bugs are fixed. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Tron deposits via Relay are broken due to two bugs: 1. Transactions are built as simple TRC20 transfers instead of depositErc20() vault contract calls, so Relay cannot correlate deposits with swap intents on-chain. 2. The Relay indexer notification (POST /transactions/single) is gated behind isEvmChainId(), so non-EVM chains never notify Relay about completed deposits. This combination causes Tron deposits to be completely untracked by Relay, resulting in stuck/lost user funds in the vault contract. Disabling Tron in the chainIdToRelayChainId mapping prevents any Tron quotes from being served until the underlying bugs are fixed. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Description
Production mitigation — Disables Tron as a supported chain on the RelaySwapper by removing it from the
chainIdToRelayChainIdmapping. This prevents any Tron quotes from being served via Relay.Why
Tron deposits via Relay are broken due to two bugs:
Wrong transaction type: ShapeShift builds Tron Relay deposits as simple TRC20
transfer()calls instead of callingdepositErc20()on the Relay vault contract. ThedepositErc20method includes abytes32 idparameter that Relay uses to correlate deposits with swap intents on-chain. Without it, Relay cannot track the deposit.Missing indexer notification: The Relay indexer notification (
POST /transactions/single) incheckTradeStatusis gated behindisEvmChainId(chainId), so non-EVM chains (Tron, Solana, Bitcoin) never notify Relay about completed deposits. This is the fallback mechanism for Relay to correlate transactions, and it's completely bypassed for Tron.This combination causes Tron deposits to be completely untracked by Relay, resulting in user funds sitting in the vault contract with no way to match them to a swap intent. We confirmed this by investigating a real stuck transaction (
4a76a14976d4ed350d846a33fcd5f8fdf8f0d4053c522c59941c2b7e52f3d6a4) — 500 USDT sent to the Relay Tron vault that Relay has zero record of.A follow-up PR will fix the underlying bugs (use Relay quote calldata for
depositErc20, widen the notification gate to all supported chains).Risk
Low risk — This is a single-line change that removes Tron from the supported chain mapping. The existing validation in
getTrade.tswill reject any Tron sell/buy pairs withUnsupportedTradePair, which is already handled throughout the UI. All other 33 chains continue working normally.Testing
Engineering
Operations
Summary by CodeRabbit