Page MenuHomePhabricator

[Cashtab] Remove tech debt around checking token names for scams
ClosedPublic

Authored by bytesofman on Aug 1 2023, 22:26.

Details

Summary

Move token name and ticker blacklist items out of currency object (to be fully deprecated) and into a dedicated blacklist.

In the process of creating this diff, found some tech debt that made sense to clean up here.

  1. No need to have two functions for isProbablyNotAScam for ticker and name, esp since they are both checking each anyway
  2. Blacklist needs to condition data so that multi-word banned token names are correctly picked up, like 'Lido Staked Ether'
  3. Blacklist should be exported as a single pre-processed array. Validation function should compare against only one array.
Test Plan

npm test

npm start and go to create an etoken. Try some scam names and some normal names. See validation error on scam names.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
blacklists
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24659
Build 48912: Build Diffcashtab-tests
Build 48911: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Aug 2 2023, 15:04
Fabien added a subscriber: Fabien.
Fabien added inline comments.
cashtab/src/components/Tokens/CreateTokenForm.js
272 ↗(On Diff #41668)

I usually rant about using variables for no reason, but here it's a good idea to use some to cache the value of isValidTokenName(value) and isProbablyNotAScam(value), which are far from being free calls

299 ↗(On Diff #41668)

dito

This revision now requires changes to proceed.Aug 2 2023, 15:04

Use variables for validation checks

Fabien requested changes to this revision.Aug 2 2023, 18:07
Fabien added inline comments.
cashtab/src/components/Tokens/CreateTokenForm.js
264 ↗(On Diff #41679)

not these ?

This revision now requires changes to proceed.Aug 2 2023, 18:07
This revision is now accepted and ready to land.Aug 2 2023, 22:15