feat(frontend): rank economic tokens above test tokens in Transfer picker (#136) #155
No reviewers
Labels
No labels
agent:implement
agent:ready
backend
bug
cannot-reproduce
confirmed
desktop
docs
documentation
duplicate
enhancement
feature
frontend
good first issue
help wanted
high-risk
in-review
invalid
mobile
needs-triage
P0-critical
P1-high
P2-medium
P3-low
qa
QA
question
ready
report
responsive
security
security-escalate
smart-contract
solana
tablet
test-pass
ux
wallet-issue
wallet:keplr
wallet:metamask
wallet:station
wallet:walletconnect
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-bridge-monorepo!155
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/gl-136-economic-token-rank"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
faucetTokens.ts— never displaysymbol(spoof-resistant).TransferFormauto-selects the first ranked token when empty/invalid (defaultTransferTokenId); an explicit still-valid test-token choice is kept.skills/agent-frontend-token-rank.md.Closes #136
Test plan
cd packages/frontend && npm run test:unit(686 tests passed locally)npm run test:run -- src/utils/tokenEconomicRank.test.ts src/services/transfer/buildTransferTokens.test.ts src/components/transfer/SubComponents.test.tsxe2e/token-selection.spec.tswhen local e2e infra is up (workers: 5already in playwright.config.ts)RECOMMEND: ACCEPT
Reviewed against #136 (acceptance criteria, attack table, verification checklist). This is a frontend display/default-selection change only. It does not alter mappings, fees, hash encoding, or which tokens are bridgeable.
Security
No BLOCK issues. Ranking cannot cause a wrong-token submit if
id/tokenId/evmTokenAddressstay bound to the row.symbol()(CL8Yon testa,testaon CL8Y)tokenEconomicRank.test.tsand TokenSelect click testsdata-tokenidis the submit id); component test covers<img>/<script>rankTransferTokensslices then sorts; does not mutate identity fieldsfaucetTokens.tsappears at the top)defaultTransferTokenIdkeeps a still-valid explicit id#136 acceptance criteria
compareTransferTokenRankfaucetTokens.ts+ SPL mint setGaps (non-blocking)
e2e/token-selection.spec.tsis written (economic-before-test + keep testa) but not run in the MR checklist. Run it before merge when local e2e infra is up.Testing
Unit coverage on the rank helper,
buildTransferTokenspaths, TokenSelectdata-tokenid, and catalog-sync is thorough. Happy path (economic default) and bad path (spoofed label still submits test id) are covered. No additional DeFi attack tests are required for this MR.Code is readable, DRY (one catalog for Faucet + rank), and matches the issue’s recommended design. Safe to merge after the existing Playwright spec is green in CI or a local run.
Follow-up (second pass): still RECOMMEND: ACCEPT. Non-blocking test nits:
e2e/token-selection.spec.tskeep-selection locator —options.filter({ has: page.locator('[data-tokenid="…"]') })matches a descendant with that attribute.data-tokenidis on the<li role="option">itself, so the MAINNET_TESTA/B/TDEC branches likely never match and always fall through to “click the last option”. Prefer[role="option"][data-tokenid="…"]scoped to the token listbox.Local e2e ranking can pass vacuously — the spec imports
isNoneconomicBridgeTokenfrom Vite-builtfaucetTokens.ts. Playwright’s Node process does not populateimport.meta.envthe way Vite does, so local TKNA/B/C/KDEC ids may drop out of the denylist in the runner while the page still ranks them. An inverted local ranking would not fail CI. Classify e2e ids fromprocess.env/.env.e2e.local(plus hardcoded mainnet CW20s).TransferForm default/race is covered on
defaultTransferTokenIdonly. A singleTransferFormtest (empty → first economic; keep testa across array identity change) would match the #136 test plan.Unit/component coverage remains the real ranking proof. Happy to merge with these as follow-ups.
added 7 commits
maind86a844d- chore: merge main into feat/gl-136-economic-token-rank (GL-136 + clickwrap/writer docs)Compare with previous version
mentioned in commit
50b593d47cmentioned in issue #136