Page MenuHomePhabricator

[alias-server] Migrate to in-node chronik-client
DraftPublic

Authored by bytesofman on Mon, Jun 17, 19:08.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

With ecash-chat, there is a use case for aliases. While it would be nice to launch aliases as NFTs for instant trading, the alias spec should still be leveraged for initial registrations.

Bring alias-server up to speed with the latest chronik-client as prep for a limited launch.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
alias-server-back
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29332
Build 58200: Build Diffalias-server-tests
Build 58199: arc lint + arc unit

Event Timeline

Failed tests logs:

====== alias-server chronikWsHandler.js: parseWebsocketMessage correctly processes a chronik websocket BlockConnected message if block is avalanche finalized.alias-server chronikWsHandler.js parseWebsocketMessage correctly processes a chronik websocket BlockConnected message if block is avalanche finalized ======
AssertionError: Expected values to be strictly equal: + actual - expected  + false - 'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598'
AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ false
- 'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598'
    at Context.<anonymous> (test/chronikWsHandler.test.js:186:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual:  failed to generate Mocha diff
====== alias-server chronikWsHandler.js: If parseWebsocketMessage is called before a previous call to handleBlockConnected has completed, the next call to handleBlockConnected will not enter until the first is completed.alias-server chronikWsHandler.js If parseWebsocketMessage is called before a previous call to handleBlockConnected has completed, the next call to handleBlockConnected will not enter until the first is completed ======
AssertionError: Expected values to be loosely deep-equal:  [   false,   false ]  should loosely deep-equal  [   'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598',   'Alias registrations updated to block 000000000000000007b5922b3e385d6d3408b61ef25af41bcc9e665462fcaf49 at height 792599' ]
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  false,
  false
]

should loosely deep-equal

[
  'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598',
  'Alias registrations updated to block 000000000000000007b5922b3e385d6d3408b61ef25af41bcc9e665462fcaf49 at height 792599'
]
    at Context.<anonymous> (test/chronikWsHandler.test.js:333:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

       [
      -  false
      -  false
      +  "Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598"
      +  "Alias registrations updated to block 000000000000000007b5922b3e385d6d3408b61ef25af41bcc9e665462fcaf49 at height 792599"
       ]
====== alias-server events.js: handleAppStartup calls handleBlockConnected with tipHeight and completes function if block is avalanche finalized, and also removes pendingAliases that are in the avalanche confirmed block.alias-server events.js handleAppStartup calls handleBlockConnected with tipHeight and completes function if block is avalanche finalized, and also removes pendingAliases that are in the avalanche confirmed block ======
AssertionError: Expected values to be loosely deep-equal:  [   {     address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',     alias: '1',     tipHeight: 785000,     txid: 'ec92610fc41df2387e7febbb358b138a802ac26023f30b2442aa01ca733fff7d'   },   {     address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',     alias: '22',     tipHeight: 785000,     txid: '922bed591461d74c2f2b177b4a28c29a28f5d81ca6cd2859dd31bec086c6a5e2'   },   {     address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',     alias: '333',     tipHeight: 785000,     txid: '0c77e...  should loosely deep-equal  []
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

[
  {
    address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',
    alias: '1',
    tipHeight: 785000,
    txid: 'ec92610fc41df2387e7febbb358b138a802ac26023f30b2442aa01ca733fff7d'
  },
  {
    address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',
    alias: '22',
    tipHeight: 785000,
    txid: '922bed591461d74c2f2b177b4a28c29a28f5d81ca6cd2859dd31bec086c6a5e2'
  },
  {
    address: 'ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj',
    alias: '333',
    tipHeight: 785000,
    txid: '0c77e...

should loosely deep-equal

[]
    at Context.<anonymous> (test/events.test.js:163:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual

      -[
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "1"
      -    "tipHeight": 785000
      -    "txid": "ec92610fc41df2387e7febbb358b138a802ac26023f30b2442aa01ca733fff7d"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "22"
      -    "tipHeight": 785000
      -    "txid": "922bed591461d74c2f2b177b4a28c29a28f5d81ca6cd2859dd31bec086c6a5e2"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "333"
      -    "tipHeight": 785000
      -    "txid": "0c77e4f7e0ff4f1028372042cbeb97eaddb64d505efe960b5a1ca4fce65598e2"
      -  }
      -  {
      -    "address": "ecash:qplkmuz3rx480u6vc4xgc0qxnza42p0e7vll6p90wr"
      -    "alias": "4444"
      -    "tipHeight": 785000
      -    "txid": "b4f4084bdc8e226595b215fa3b6588ad3464b664a57d870d0fed34f2c633b464"
      -  }
      -  {
      -    "address": "ecash:qplkmuz3rx480u6vc4xgc0qxnza42p0e7vll6p90wr"
      -    "alias": "55555"
      -    "tipHeight": 785000
      -    "txid": "6a3a05b261c0ab49126f98e8f8c65f2117ac20acb7278ea8822465003d301781"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "666666"
      -    "tipHeight": 785000
      -    "txid": "9f6a39b8d2af0d686a6282502f7ad51f4b759a896e28b6e9cc3a116e91347d2f"
      -  }
      -  {
      -    "address": "ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6"
      -    "alias": "7777777"
      -    "tipHeight": 785000
      -    "txid": "fe6cb79d51edef91d57c780eddd1d101ba60e7e502b9e3b2e7a9bc7f1dd2aafc"
      -  }
      -  {
      -    "address": "ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6"
      -    "alias": "88888888"
      -    "tipHeight": 785000
      -    "txid": "a26326c056fb9c3b5fa6489815488ee1cd4cf3c07f9fccd6a800d184ba72ba95"
      -  }
      -  {
      -    "address": "ecash:qp89xgjhcqdnzzemts0aj378nfe2mhu9yvxj9nhgg6"
      -    "alias": "999999999"
      -    "tipHeight": 785000
      -    "txid": "6c28e87b76865466a383452576af70a2cc2186655697e36d115a6aadb1287c9c"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "addressinvalid"
      -    "tipHeight": 785000
      -    "txid": "6792b6d77f3b12b4f4063fdd6ae372a9b8ff242ff073f264a20d4676ec065751"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "eighteencharacters"
      -    "tipHeight": 785000
      -    "txid": "ef3c8ea3c79ab0554982a016a96342e04a1b23e0d467dd343af3582cd074be6f"
      -  }
      -  {
      -    "address": "ecash:qphlhe78677sz227k83hrh542qeehh8el5lcjwk72y"
      -    "alias": "elevenchars"
      -    "tipHeight": 785000
      -    "txid": "05c98dc565422071e88f8682ac07843f7ef06a338067a7f0999a21840ec3aa6a"
      -  }
      -  {
      -    "address": "ecash:qphlhe78677sz227k83hrh542qeehh8el5lcjwk72y"
      -    "alias": "fifteencharac15"
      -    "tipHeight": 785000
      -    "txid": "1a88df48f476bf2857cd6c3e8b46b0fee8f0ff11adfa148d131d12609a7fa398"
      -  }
      -  {
      -    "address": "ecash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxav9up3h67g"
      -    "alias": "fourteenchar14"
      -    "tipHeight": 785000
      -    "txid": "67c479bc57d29c112135461f6acb02b60ddb5aa1f2e7982fe102353404155b29"
      -  }
      -  {
      -    "address": "ecash:prfhcnyqnl5cgrnmlfmms675w93ld7mvvqd0y8lz07"
      -    "alias": "ifp"
      -    "tipHeight": 785000
      -    "txid": "cf6e83f79e62a067e490472acac8290e8ca7698c786d7b1fcaadcc1a8e66aebf"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "nineteencharacter19"
      -    "tipHeight": 785000
      -    "txid": "d64f3087818f62bdb7df9bbc68d03316e945239dc72d0b2e18854dd36ec4fade"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "seventeencharac17"
      -    "tipHeight": 785000
      -    "txid": "08901a881448e7074e6cac2922ce84c05f02ac32b2b8f37c3751489003e853e5"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "sixteenchacter16"
      -    "tipHeight": 785000
      -    "txid": "34fdfa4b251d4ed2d151f426441b11a04a649ecd9a6f53bd41868b7c9b222f7c"
      -  }
      -  {
      -    "address": "ecash:qphlhe78677sz227k83hrh542qeehh8el5lcjwk72y"
      -    "alias": "tenchars10"
      -    "tipHeight": 785000
      -    "txid": "f2f1c1b5b0c3b1e405ea1abc9a4ff0018626ceecc425e9c571eb50a1e9bd0cb2"
      -  }
      -  {
      -    "address": "ecash:qphpmfj0qn7znklqhrfn5dq7qh36l3vxav9up3h67g"
      -    "alias": "thirteenchars"
      -    "tipHeight": 785000
      -    "txid": "4b03803bbd21f77a5b583e3bf948e0e62524a660a5b560af08d74e20489341bc"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "twelvechar12"
      -    "tipHeight": 785000
      -    "txid": "166b21d4631e2a6ec6110061f351c9c3bfb3a8d4e6919684df7e2824b42b0ffe"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "twentycharacteralias"
      -    "tipHeight": 785000
      -    "txid": "722a07ebf87b2516ea86583dab55b961df4e16973b15244cdc89bd256aba4586"
      -  }
      -  {
      -    "address": "ecash:qz2708636snqhsxu8wnlka78h6fdp77ar59jrf5035"
      -    "alias": "twentyonecharacters21"
      -    "tipHeight": 785000
      -    "txid": "1102c6393469174bc99f373a9f988f773775285463d0dc59f43c69223b22b153"
      -  }
      -  {
      -    "address": "ecash:qpmytrdsakt0axrrlswvaj069nat3p9s7cjctmjasj"
      -    "alias": "xx"
      -    "tipHeight": 785000
      -    "txid": "e9f0a9984b4ae354fb8b4dd8193c974074942b0ee6fba14bf85fa1ca14dc5987"
      -  }
      -]
      +[]
====== alias-server main.js: main() connects to a websocket, and runs handleAppStartup() correctly.alias-server main.js main() connects to a websocket, and runs handleAppStartup() correctly ======
AssertionError: Expected values to be loosely deep-equal:  false  should loosely deep-equal  'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598'
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:

false

should loosely deep-equal

'Alias registrations updated to block 00000000000000000c36528b468fac70aa50c15cea9b7017ff7df53f7d0786c8 at height 792598'
    at Context.<anonymous> (test/main.test.js:119:16)

      + expected - actual:  failed to generate Mocha diff

Each failure log is accessible here:
alias-server chronikWsHandler.js: parseWebsocketMessage correctly processes a chronik websocket BlockConnected message if block is avalanche finalized.alias-server chronikWsHandler.js parseWebsocketMessage correctly processes a chronik websocket BlockConnected message if block is avalanche finalized
alias-server chronikWsHandler.js: If parseWebsocketMessage is called before a previous call to handleBlockConnected has completed, the next call to handleBlockConnected will not enter until the first is completed.alias-server chronikWsHandler.js If parseWebsocketMessage is called before a previous call to handleBlockConnected has completed, the next call to handleBlockConnected will not enter until the first is completed
alias-server events.js: handleAppStartup calls handleBlockConnected with tipHeight and completes function if block is avalanche finalized, and also removes pendingAliases that are in the avalanche confirmed block.alias-server events.js handleAppStartup calls handleBlockConnected with tipHeight and completes function if block is avalanche finalized, and also removes pendingAliases that are in the avalanche confirmed block
alias-server main.js: main() connects to a websocket, and runs handleAppStartup() correctly.alias-server main.js main() connects to a websocket, and runs handleAppStartup() correctly

Following implementation through additional files

Tail of the build log:

> alias-server@1.0.0 test
> mocha --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/alias-server-junit.xml --reporter-options testsuitesTitle=Alias Server Unit Tests --reporter-options rootSuiteTitle=Alias Server


Error: Cannot find module '../src/rpc'
Require stack:
- /work/apps/alias-server/test/rpc.test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/work/apps/alias-server/test/rpc.test.js:11:26)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at cjsLoader (node:internal/modules/esm/translators:348:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async formattedImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:9:14)
    at async exports.requireOrImport (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:42:28)
    at async exports.loadFilesAsync (/work/apps/alias-server/node_modules/mocha/lib/nodejs/esm-utils.js:100:20)
    at async singleRun (/work/apps/alias-server/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async exports.handler (/work/apps/alias-server/node_modules/mocha/lib/cli/run.js:370:5)
------------------------|---------|----------|---------|---------|-------------------
File                    | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------|---------|----------|---------|---------|-------------------
All files               |    10.2 |        0 |       0 |   10.39 |                   
 alias-server           |     100 |      100 |     100 |     100 |                   
  config.js             |     100 |      100 |     100 |     100 |                   
  secrets.sample.js     |     100 |      100 |     100 |     100 |                   
 alias-server/constants |     100 |      100 |     100 |     100 |                   
  alias.js              |     100 |      100 |     100 |     100 |                   
 alias-server/src       |    9.65 |        0 |       0 |    9.83 |                   
  alias.js              |    5.88 |        0 |       0 |    6.06 | 23-369            
  app.js                |   16.66 |        0 |       0 |   16.66 | 23-183            
  chronik.js            |    4.47 |        0 |       0 |    4.76 | 12-196            
  chronikWsHandler.js   |      25 |        0 |       0 |      25 | 32-114            
  db.js                 |    6.09 |        0 |       0 |    6.09 | 17-308            
  events.js             |   14.81 |        0 |       0 |   14.81 | 39-249            
  main.js               |   15.78 |        0 |       0 |   15.78 | 31-81             
  telegram.js           |   14.28 |        0 |       0 |   14.28 | 17-97             
  utils.js              |    5.17 |        0 |       0 |    5.35 | 12-157            
------------------------|---------|----------|---------|---------|-------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='50']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='490']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='164']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='0']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='54']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='50']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='481']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/alias-server-junit.xml': No such file or directory
Build alias-server-tests failed with exit code 1