fix: a token symbol read off a contract is never stored cut mid-emoji #482

Merged
clawbot merged 1 commits from issue-458-symbol-codepoints into next 2026-10-06 23:59:23 +02:00
Collaborator

Closes #458.

lookupTokenInfo() in src/shared/balances.js caps the symbol it reads off a contract at 12 and the name at 64, and counted both in UTF-16 units. An emoji outside the Basic Multilingual Plane is two units, so the cut could fall between its halves, and the half left over was stored with the token and shown as U+FFFD wherever the token is listed. Both caps now count code points, with the same Array.from(...) idiom displaySymbol() has used since #329. The limits are unchanged.

The token name was cut the same unsafe way, so it gets the same fix.

tests/tokenLookupTruncation.test.js looks up a token whose contract answers with a symbol and a name made of such emoji, each starting with one ASCII letter so that a cut by UTF-16 units lands inside an emoji. Both tests fail against current next.

  • Not done, per the issue: no repair of a symbol or name already stored broken (pre-1.0, no upgrade paths).
  • Judgement call: the stored value is still cut with no ellipsis, as before; displaySymbol() adds one only on display.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/AutistMask/issues/458. `lookupTokenInfo()` in `src/shared/balances.js` caps the symbol it reads off a contract at 12 and the name at 64, and counted both in UTF-16 units. An emoji outside the Basic Multilingual Plane is two units, so the cut could fall between its halves, and the half left over was stored with the token and shown as U+FFFD wherever the token is listed. Both caps now count code points, with the same `Array.from(...)` idiom `displaySymbol()` has used since https://git.eeqj.de/sneak/AutistMask/issues/329. The limits are unchanged. The token name was cut the same unsafe way, so it gets the same fix. `tests/tokenLookupTruncation.test.js` looks up a token whose contract answers with a symbol and a name made of such emoji, each starting with one ASCII letter so that a cut by UTF-16 units lands inside an emoji. Both tests fail against current `next`. - Not done, per the issue: no repair of a symbol or name already stored broken (pre-1.0, no upgrade paths). - Judgement call: the stored value is still cut with no ellipsis, as before; `displaySymbol()` adds one only on display. Model: opus-5-5
clawbot self-assigned this 2026-10-06 23:11:23 +02:00
clawbot added 1 commit 2026-10-06 23:11:23 +02:00
fix: a token symbol read off a contract is never stored cut mid-emoji (closes #458)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
cc9fdfac99
lookupTokenInfo() cut the symbol at 12 and the name at 64 UTF-16 units,
so an emoji outside the Basic Multilingual Plane could be cut between its
two halves and the half left over stored and shown as U+FFFD. Both are
now cut on code points, as displaySymbol() does. A symbol already stored
broken is not repaired.

Model: opus-5-5
clawbot added the needs-review label 2026-10-06 23:11:35 +02:00
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit cd730241bb into next 2026-10-06 23:59:23 +02:00
clawbot deleted branch issue-458-symbol-codepoints 2026-10-06 23:59:25 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#482