fix: a shared ticker no longer hides one of its two real tokens (closes #276)
All checks were successful
check / check (push) Successful in 33s
All checks were successful
check / check (push) Successful in 33s
KNOWN_SYMBOLS maps a symbol to the set of contract addresses that bear it, instead of to one of them. A ticker is not unique, and the bundled list proves it: seven of its 512 tokens -- FRAX, REUSD, TON, EURE, MSUSD, MUSD and JPYC -- share a symbol with another bundled entry at a different real contract. The table is built from that list first-wins, so it kept the earlier entry of each pair and the later one was judged a spoof of its own symbol at its own address. A user holding any of the seven saw it filtered out of the balance list, the transaction history and the send token selector, and so could not spend it through the UI. Both contracts of every pair come from the same source fetch (CoinGecko, 2026-02-27, decimals verified on-chain), so neither is stale relative to the other and there is nothing to prefer between them. The fix is therefore in the shape of the table rather than in its contents: no address was picked and none was dropped. isSpoofedSymbol() asks set membership where it asked equality, which does not loosen the rule -- every address in a set is one the wallet ships as a real token, and a contract outside the set is still a spoof. The native-asset entry stays null and still means no contract may bear the symbol. The suite walked KNOWN_SYMBOLS, which is derived from TOKENS, so it could only assert that the table agreed with itself. It now also walks TOKENS asserting that no bundled token is filtered at its own address -- the walk that would have caught this -- pins both contracts of each of the seven by address, asserts a third contract bearing a shared ticker is still filtered, and asserts every address the table vouches for is a bundled token reporting that symbol.
This commit is contained in:
@@ -207,8 +207,8 @@ describe("token list assumptions the fixtures rely on", () => {
|
||||
});
|
||||
|
||||
test("USDC and WETH map to their genuine lowercased contracts", () => {
|
||||
expect(KNOWN_SYMBOLS.get("USDC")).toBe(USDC_CONTRACT);
|
||||
expect(KNOWN_SYMBOLS.get("WETH")).toBe(WETH_CONTRACT);
|
||||
expect([...KNOWN_SYMBOLS.get("USDC")]).toEqual([USDC_CONTRACT]);
|
||||
expect([...KNOWN_SYMBOLS.get("WETH")]).toEqual([WETH_CONTRACT]);
|
||||
});
|
||||
|
||||
test("the spam fixture symbol is not in the known token list", () => {
|
||||
|
||||
Reference in New Issue
Block a user