Skip to content

fix: check for all native assetIds in isNativeAddress util #6076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 16, 2025

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented Jul 8, 2025

Explanation

This change updates the isNativeAddressutil so that it returnstrue` when the address is a native EVM assetId

References

Related to https://consensyssoftware.atlassian.net/browse/SWAPS-2601

Changelog

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@micaelae micaelae requested a review from a team as a code owner July 8, 2025 19:29
@micaelae micaelae marked this pull request as draft July 8, 2025 19:29
@micaelae micaelae marked this pull request as ready for review July 16, 2025 15:16
@micaelae micaelae requested a review from a team as a code owner July 16, 2025 15:16
cursor[bot]

This comment was marked as outdated.

@micaelae micaelae enabled auto-merge (squash) July 16, 2025 15:18
@micaelae micaelae disabled auto-merge July 16, 2025 15:20
@micaelae micaelae merged commit 07db0f4 into main Jul 16, 2025
210 checks passed
@micaelae micaelae deleted the swaps-native-address-util branch July 16, 2025 15:30
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Address Matching Bug

The isNativeAddress function incorrectly identifies non-native addresses as native assets. The condition address.includes(reference) || reference.endsWith(address) is overly permissive. For example, an address like 'account60' would match a '60' SLIP44 reference, and '1' would match '501', leading to arbitrary strings being treated as native assets.

packages/bridge-controller/src/utils/bridge.ts#L162-L167

!address ||
(!isStrictHexString(address) &&
Object.values(SYMBOL_TO_SLIP44_MAP).some(
// check if it matches any supported SLIP44 references
(reference) => address.includes(reference) || reference.endsWith(address),
));

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

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.

2 participants