Skip to content

fix: disable Tron swaps on RelaySwapper#12014

Merged
0xApotheosis merged 1 commit intodevelopfrom
fix/disable-relay-tron-swaps
Feb 23, 2026
Merged

fix: disable Tron swaps on RelaySwapper#12014
0xApotheosis merged 1 commit intodevelopfrom
fix/disable-relay-tron-swaps

Conversation

@0xApotheosis
Copy link
Member

@0xApotheosis 0xApotheosis commented Feb 23, 2026

Description

Production mitigation — Disables Tron as a supported chain on the RelaySwapper by removing it from the chainIdToRelayChainId mapping. This prevents any Tron quotes from being served via Relay.

Why

Tron deposits via Relay are broken due to two bugs:

  1. Wrong transaction type: ShapeShift builds Tron Relay deposits as simple TRC20 transfer() calls instead of calling depositErc20() on the Relay vault contract. The depositErc20 method includes a bytes32 id parameter that Relay uses to correlate deposits with swap intents on-chain. Without it, Relay cannot track the deposit.

  2. Missing indexer notification: The Relay indexer notification (POST /transactions/single) in checkTradeStatus is gated behind isEvmChainId(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.ts will reject any Tron sell/buy pairs with UnsupportedTradePair, which is already handled throughout the UI. All other 33 chains continue working normally.

Relay cross-chain swaps involving Tron are affected. No other protocols, transaction types, wallets, or contract interactions are impacted.

Testing

Engineering

  1. Verify Tron assets no longer appear as valid sell/buy options when Relay is the swapper
  2. Verify all other Relay-supported chains still return quotes normally
  3. Verify no runtime errors when browsing Tron assets (the chain is still supported by other swappers like ButterSwap, NearIntents, Thorchain)

Operations

  • Attempt a swap from Tron USDT to any other chain — Relay should not appear as an available swapper
  • Attempt a swap from any EVM chain to Tron USDT — Relay should not appear as an available swapper
  • Verify other swappers (ButterSwap, Thorchain, NearIntents) still offer Tron routes

Summary by CodeRabbit

  • Bug Fixes
    • Disabled Tron blockchain support in the swapper service.

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>
@0xApotheosis 0xApotheosis requested a review from a team as a code owner February 23, 2026 22:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

The pull request removes Tron support from the RelaySwapper constant mapping by removing the tronChainId import and commenting out its corresponding entry in the chainIdToRelayChainId object, while preserving the code structure for future reference.

Changes

Cohort / File(s) Summary
RelaySwapper Constants
packages/swapper/src/swappers/RelaySwapper/constant.ts
Removed tronChainId from imports and disabled Tron chain mapping in chainIdToRelayChainId object with explanatory comments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • shapeshift/web#11581 — Addresses complementary Tron handling changes across different swapper implementations, with this PR removing Tron from RelaySwapper while another adds Tron support elsewhere.

Suggested reviewers

  • NeOMakinG
  • gomesalexandre

Poem

🐰 Hop, hop, the Tron hops away,
From Relay's maps it won't stay,
Commented out with care, you see,
A graceful removal, wild and free!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: disable Tron swaps on RelaySwapper' directly and clearly summarizes the main change in the PR, which is disabling Tron from the RelaySwapper by removing it from the chainIdToRelayChainId mapping.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/disable-relay-tron-swaps

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@0xApotheosis
Copy link
Member Author

Merging to get hotfix to production.

@0xApotheosis 0xApotheosis merged commit 3d16ccb into develop Feb 23, 2026
3 of 4 checks passed
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 3cf88a5 and 9d5750f.

📒 Files selected for processing (1)
  • packages/swapper/src/swappers/RelaySwapper/constant.ts

Comment on lines +89 to +93
// 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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
// 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.

@0xApotheosis 0xApotheosis deleted the fix/disable-relay-tron-swaps branch February 23, 2026 23:01
0xApotheosis added a commit that referenced this pull request Feb 23, 2026
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>
0xApotheosis added a commit that referenced this pull request Feb 23, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant