Skip to content

Bug: "base sepolia" resolves to Base mainnet in chain alias parsing #5

Description

@David-patrick-chuks-02

Summary

resolveChainAlias() in both src/lib/execution.ts and src/lib/chat.ts uses a partial-match (normalized.includes(keyword)) with Array.find(). Because the base keyword appears before base sepolia in CHAIN_KEYWORDS, any reference to Base Sepolia (chain id 84532) is resolved to Base mainnet (chain id 8453).

Impact

A user typing execute bridge 10 usdc from base sepolia to arbitrum would silently quote/execute a route from Base mainnet (8453) instead of Base Sepolia (84532), which can cause failed transactions or fund movement on the wrong chain.

Reproduction

resolveChainAlias("base sepolia") // -> 8453 (wrong, expected 84532)

Suggested fix

  • Sort CHAIN_KEYWORDS by keyword length (longest first) before matching, or
  • Use exact/anchored matching instead of includes, or
  • Match the longest keyword that is contained in the normalized string.

Files

  • src/lib/execution.ts (line ~434)
  • src/lib/chat.ts (line ~329)
  • src/constants/index.ts? (chain keyword lists are duplicated in both libs — consider centralizing)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions