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)
Summary
resolveChainAlias()in bothsrc/lib/execution.tsandsrc/lib/chat.tsuses a partial-match (normalized.includes(keyword)) withArray.find(). Because thebasekeyword appears beforebase sepoliainCHAIN_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 arbitrumwould 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
Suggested fix
CHAIN_KEYWORDSby keyword length (longest first) before matching, orincludes, orFiles
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)