HomePhabricator

[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records

Description

[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records

Summary:
T2551

Depends on D13124

This diff mitigates the edge case of duplicate alias registration transactions by leveraging the approach used in D13115, achieved by setting unconfirmed txs to a block height of 100000000, sorting the txs by blockheight and txid, before filtering out subsequent instances of the same alias registration.

As part of testing, I have also validated it handles special characters and non-english languages. However depending on the language, the character counts evaluates differently as seen below.

german: Mädchen.xec <-- 7 characters, an extra one for the ä
korean: 소주.xec <-- 2 characters
chinese: 苦屎.xec <-- 2 characters
spanish: sandía.xec <-- 7 characters, an extra one for the í
arabic: محيط.xec <-- 4 characters
gibberish: ( ͡~ ͜ʖ ͡°).xec <-- 8 characters, 2 for each symbol with spaces stripped out

Based on above we can just let the existing char limit remain as is, since the char length is calculated at the point of determining the appropriate registration fee. When I hook it up to the send components in the next diff we'll need to test these thoroughly via the send inputs.

[Cashtab] [Alias] pt 1 - Create scaffold for new Identity component
[Cashtab] [Alias] pt 2 - Upgrade sendXec() to handle alias registration
[Cashtab] [Alias] pt 3 - Implement isAliasAvailable function
[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
[Cashtab] [Alias] pt 5 - Implement getAddressFromAlias function
[Cashtab] [Alias] pt 6.1 - Get latest alias tx count from payment address
[Cashtab] [Alias] pt 6.1.1 - Apply Promise.All approach for alias history retrieval
[Cashtab] [Alias] pt 6.2 - Implement getAliasesFromLocalForage
[Cashtab] [Alias] pt 6.3 - Implement updateAliases
[Cashtab] [Alias] pt 6.4 - Update getAliases() to extract both alias and address
[Cashtab] [Alias] pt 6.5 - Optimize getAllTxHistory to only make API calls for uncached tx history pages
[Cashtab] [Alias] pt 6.6 - Render list of Aliases owned by active wallet in Alias.js
[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records (same rego in same block, validate emoji char counts)
[Cashtab] [Alias] pt 8 - Enable alias lookup for Send XEC component
[Cashtab] [Alias] pt 9 - Enable alias lookup for Send Token component
[Cashtab] [Alias] pt 10 - Upgrade tx history to recognize alias registration txs
[Cashtab] [Alias] pt 11 - Set final registration fees and remove residual dev logs

Test Plan:

  • npm test
  • npm start
  • register a new alias, quickly delete the cashtabCache object and navigate to the Alias page again. Verify there are no duplicate aliases in cachtabCache.aliasCache.aliases
  • Verify via the console log the unconfirmed tx in the aliasTxsSortedByTxidAndBlockheight output has now been updated with the block.height: 100000000 attribute
  • attempt to register some antediluvian language that's within the char limit and ensure it registers all ok
  • refresh alias page and ensure the partial tx retrieval has not regressed

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D13134

Details

Provenance
emackAuthored on Feb 16 2023, 07:55
emackPushed on Feb 22 2023, 04:05
Reviewer
Restricted Project
Differential Revision
D13134: [Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records
Parents
rABC3379295c0ba2: [Cashtab] [Alias] pt 6.6 - Render list of Aliases owned by active wallet in…
Branches
Unknown
Tags
Unknown