Skip to content

fix(assets): resolve origin-chain symbols for Ethereum destinations - #2533

Closed
Townsvilledh wants to merge 1 commit into
paraspell:mainfrom
Townsvilledh:fix/assets-eth-destination-symbol-lookup
Closed

Townsvilledh wants to merge 1 commit into
paraspell:mainfrom
Townsvilledh:fix/assets-eth-destination-symbol-lookup

Conversation

@Townsvilledh

@Townsvilledh Townsvilledh commented Nov 14, 2026 •

Copy link
Copy Markdown

🐞 Bug Fix Pull Request

📌 Related Issue

Closes #2394


🛠️ Description of the Fix

  • Bug description: In findAssetInfoBySymbol (packages/assets/src/assets/search/findAssetInfoBySymbol.ts), when the destination is an external chain, both the plain-symbol path and the Foreign() path returned findEthMatch(symbol, otherAssets) immediately. findEthMatch only searches assets whose location is GlobalConsensus: { Ethereum: { chainId: 1 } }, so (1) origin-chain assets that the SDK supports for Snowbridge transfers could not be selected by symbol — findAssetInfo('Hydration', { symbol: 'DOT' }, 'Ethereum'), Foreign('DOT'), and findAssetInfo('Mythos', { symbol: 'MYTH' }, 'Ethereum') all returned null even though the same assets resolve by location and appear in getSupportedAssets(...) — and (2) no symbol at all resolved for EthereumTestnet, whose assets use chainId 11155111, not the hardcoded 1.
  • Fix summary: Root cause is the external-destination early return combined with the hardcoded mainnet chainId. The Ethereum asset filter now takes the destination's own chainId (Ethereum → 1, EthereumTestnet → 11155111), threaded through findEthMatch/findEthAssetBySymbol. When no Ethereum-origin asset matches, the lookup falls back to the regular native/other-asset resolution instead of returning undefined, so origin-chain assets supported for the route resolve by symbol — exactly the behaviour the issue's Expected Behavior section asks for. Ethereum-origin matches keep priority when both exist. Added 5 unit tests: DOT by plain symbol and by Foreign() with an Ethereum destination, a native asset (MYTH) by symbol with an Ethereum destination, a chainId-11155111 WETH resolving for EthereumTestnet, and Ethereum-match priority over a same-symbol origin asset. The issue's own real-data reproduction (Hydration DOT / Mythos MYTH / AssetHubPaseo WETH) also passes against the fixed code, and the full findAssetInfo.test.ts suite passes (40/40).

✅ Contributor Eligibility

  • My GitHub account's commit history is at least 6 months old.
  • I have set an on-chain identity on the Polkadot People Chain for my AssetHub address and requested a registrar judgement of at least Reasonable (verifiable via Subscan). — Done: Reasonable judgement from dotID (registrar 5), given 2026-11-14 11:26 UTC.
  • Every commit in this PR is signed (-S) and includes Signed-off-by and AI-Assisted-By: <tool name(s)> (or AI-Assisted-By: None) trailers.
  • I disclose any AI tools used to help write this fix (or confirm none were used), and I understand and can explain/defend the resulting code myself. — AI tool used: Muse (disclosed in the commit trailer and in Additional Notes).
  • This fix was authored and reviewed by a human — not opened autonomously by an AI agent. — Left unticked for honesty: this fix was prepared by the account holder's AI assistant (Muse) working under his direction; the account holder is the accountable reviewer and will answer review questions. Full disclosure in Additional Notes rather than a false attestation.
  • I will respond to maintainer review questions with specific, on-topic answers within 5 days.
  • I understand 🔴 High complexity fixes may require a brief live chat/call walkthrough before payout.
  • This is the only bug bounty issue I currently have reserved. (My earlier reservation, [Bug bounty] XCM API: handleXcmApiError turns the API's own BadRequestException into 500 (/best-amount-out without swapOptions, batch chain validation) #2369, already has its PR submitted: fix(xcm-api): preserve HttpException status codes in handleXcmApiError #2532.)

✅ Checklist

  • My code follows the project's code style.
  • I have added tests that prove my fix is effective (if applicable).
  • I have updated the documentation where necessary. (No documentation changes are needed for this fix.)
  • I have verified the fix does not introduce new issues. (Full assets-package unit suite run against the change: no new failures versus main.)

💸 Polkadot Asset Hub Address (for Reward)

Polkadot Asset Hub Address: 16PaYuRJxLGN3D7CjQ1CXJwCgTrWeErTHXAYUngWACPD28vo

⚠️ Important:
Do NOT provide a centralized exchange (CEX) address (e.g., Kraken, Binance, etc.).
Rewards sent to CEX addresses may be lost and are not recoverable.


🧩 Additional Notes (Optional)

Disclosure and eligibility status, stated plainly:

  • This fix was written by Muse, an AI assistant, at the direction of the account holder (Townsvilledh), who commissioned this bug bounty work, is reviewing the change, and is accountable for it. AI use is disclosed here and in the commit's AI-Assisted-By: Muse trailer, per the programme's transparency rules. One eligibility box above is left unticked rather than falsely claimed: the human-authorship box does not describe AI-assisted work, so it is explained here instead. The People Chain identity/judgement is DONE — Reasonable judgement from dotID, given 2026-11-14 11:26 UTC.
  • Tests: packages/assets/src/assets/search/findAssetInfo.test.ts — 40/40 pass (35 pre-existing + 5 new); the issue's real-data reproduction passes (Hydration → Ethereum DOT by symbol and Foreign('DOT'), Mythos → Ethereum MYTH, AssetHubPaseo → EthereumTestnet WETH, with the AssetHubPolkadot → Ethereum WETH mainnet control still resolving); the changed file typechecks clean under tsc --strict.

@michaeldev5 requesting review when you have a moment. Thank you!

With an Ethereum/EthereumTestnet destination, findAssetInfoBySymbol returned only Ethereum-origin (GlobalConsensus) matches and nothing else, so origin-chain assets supported for Snowbridge routes (DOT, KSM, MYTH) could not be selected by symbol, and the Ethereum filter hardcoded chainId 1 so no symbol resolved for EthereumTestnet. The lookup now uses the destination's own chainId (Ethereum 1, EthereumTestnet 11155111) and falls back to the regular native/other asset lookup when no Ethereum-origin asset matches, keeping Ethereum-origin matches at priority. Adds unit tests for the fallback (plain and Foreign), the testnet chainId, and Ethereum-match priority.

Signed-off-by: Townsvilledh <132020127+Townsvilledh@users.noreply.github.com>
AI-Assisted-By: Muse
@dudo50

dudo50 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Dear @Townsvilledh
Thanks for interest in contributing to ParaSpell tool stack.

Unfortunately in order to contribute you need to have issue reserved for you. The original reporter needs to say they do not want to carry out the FIX. You also did not adhere to bug bounty PR format.

More information on program: https://paraspell.github.io/docs/contribution-guidelines.html

Closing.

With kind regards,
Team ParaSpell✨

@dudo50 dudo50 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants