Page MenuHomePhabricator

[Cashtab] extension with new pkgs, version bump
ClosedPublic

Authored by bytesofman on Jan 11 2021, 13:05.

Details

Summary

Remove web-hosted slp npm module from browser extension and its manifest permissions; version bump

Test Plan
  1. npm run extension
  2. Navigate to brave://extensions or chrome://extensions and load web/cashtab/extension/dist as unpacked extension
  3. Try a BCHA tx and an SLPA tx and observe no errors

Diff Detail

Repository
rABC Bitcoin ABC
Branch
extension-unpkg-remove
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 14704
Build 29367: Build Diffcashtab-tests
Build 29366: arc lint + arc unit

Event Timeline

Looks like npm extension has not replaced the original web files, patching

Tail of the build log:

added 2882 packages, and audited 2883 packages in 38s

57 packages are looking for funding
  run `npm fund` for details

6 vulnerabilities (4 low, 2 high)

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
npm notice 
npm notice New minor version of npm available! 7.3.0 -> 7.4.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.0>
npm notice Run `npm install -g npm@7.4.0` to update!
npm notice 

> cashtab@0.1.8 prebuild
> npm run prepare-fbts


> cashtab@0.1.8 prepare-fbts
> NODE_ENV=production npm run manifest-fbts && npm run collect-fbts && npm run fbt-generate-translations && npm run translate-fbts


> cashtab@0.1.8 manifest-fbts
> NODE_ENV=production node node_modules/babel-plugin-fbt/bin/manifest --src src


> cashtab@0.1.8 collect-fbts
> NODE_ENV=production node node_modules/babel-plugin-fbt/bin/collectFBT --pretty --manifest < .src_manifest.json > .source_strings.json


> cashtab@0.1.8 fbt-generate-translations
> NODE_ENV=production node node_modules/fbt-generate-translations --locales src/i18n/locales.js --multi-files translations


> cashtab@0.1.8 translate-fbts
> NODE_ENV=production node node_modules/babel-plugin-fbt/bin/translate.js --pretty --translations translations/*.json --jenkins > src/translatedFbts.json


> cashtab@0.1.8 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

./src/components/App.js
Cannot find file '../assets/popout.svg' in './src/components'.


npm ERR! code 1
npm ERR! path /work/web/cashtab
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-01-11T13_07_16_565Z-debug.log
Build cashtab-tests failed with exit code 1

Undoing extension overwrite of src files

Fabien added inline comments.
web/cashtab/extension/public/manifest.json
6 ↗(On Diff #26844)

Why is it jumping from 1 to 4 ?

Failed tests logs:

====== CashTab Unit Tests: useBCH hook gets SLP and BCH balances and utxos ======
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 5
+ Received  + 0

@@ -2,11 +2,10 @@
    "nonSlpUtxos": Array [
      Object {
        "address": "bitcoincash:qrzuvj0vvnsz5949h4axercl5k420eygavv0awgz05",
        "height": 660544,
        "isValid": false,
-       "satoshis": 2196,
        "tx_hash": "5ebb5272b6f875b65f41f2cfca031e6f07f9cf519ee7577f0f63cb79aa86fd0a",
        "tx_pos": 1,
        "txid": "5ebb5272b6f875b65f41f2cfca031e6f07f9cf519ee7577f0f63cb79aa86fd0a",
        "value": 2196,
        "vout": 1,
@@ -16,11 +15,10 @@
      Object {
        "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
        "decimals": 1,
        "height": 659837,
        "isValid": true,
-       "satoshis": 546,
        "tokenDocumentHash": "",
        "tokenDocumentUrl": "mint.bitcoin.com",
        "tokenId": "009ff65ef50632111a9661f67d80025481ebc80ced239d32a92705b04d5df8cc",
        "tokenName": "TT",
        "tokenQty": "7",
@@ -37,11 +35,10 @@
      Object {
        "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
        "decimals": 5,
        "height": 659843,
        "isValid": true,
-       "satoshis": 546,
        "tokenDocumentHash": "",
        "tokenDocumentUrl": "mint.bitcoin.com",
        "tokenId": "2aef6e63edfded1a299e78b529286deea2a6dd5299b6911778c25632d78a9479",
        "tokenName": "pitico",
        "tokenQty": "99.35",
@@ -63,11 +60,10 @@
        "info": Object {
          "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
          "decimals": 1,
          "height": 659837,
          "isValid": true,
-         "satoshis": 546,
          "tokenDocumentHash": "",
          "tokenDocumentUrl": "mint.bitcoin.com",
          "tokenId": "009ff65ef50632111a9661f67d80025481ebc80ced239d32a92705b04d5df8cc",
          "tokenName": "TT",
          "tokenQty": "7",
@@ -89,11 +85,10 @@
        "info": Object {
          "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
          "decimals": 5,
          "height": 659843,
          "isValid": true,
-         "satoshis": 546,
          "tokenDocumentHash": "",
          "tokenDocumentUrl": "mint.bitcoin.com",
          "tokenId": "2aef6e63edfded1a299e78b529286deea2a6dd5299b6911778c25632d78a9479",
          "tokenName": "pitico",
          "tokenQty": "99.35",
    at Object.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:75:24)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

Each failure log is accessible here:
CashTab Unit Tests: useBCH hook gets SLP and BCH balances and utxos

majcosta requested changes to this revision.Jan 11 2021, 13:21

tests are failing

This revision now requires changes to proceed.Jan 11 2021, 13:21

Fix mocks for test. This does not have anything to do with this diff...not sure what change caused this. Mock
return values duplicated same output field as 'satoshis' and 'value'

Fabien requested changes to this revision.Jan 11 2021, 14:51

Please fix the test in another diff if this is unrelated. This makes the review easier, causes the fix to get landed faster, and we will not introduce the bug again should we revert this diff for any reason.

This revision now requires changes to proceed.Jan 11 2021, 14:51

Remove test fix, out of scope for this diff

Failed tests logs:

====== CashTab Unit Tests: useBCH hook gets SLP and BCH balances and utxos ======
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 5
+ Received  + 0

@@ -2,11 +2,10 @@
    "nonSlpUtxos": Array [
      Object {
        "address": "bitcoincash:qrzuvj0vvnsz5949h4axercl5k420eygavv0awgz05",
        "height": 660544,
        "isValid": false,
-       "satoshis": 2196,
        "tx_hash": "5ebb5272b6f875b65f41f2cfca031e6f07f9cf519ee7577f0f63cb79aa86fd0a",
        "tx_pos": 1,
        "txid": "5ebb5272b6f875b65f41f2cfca031e6f07f9cf519ee7577f0f63cb79aa86fd0a",
        "value": 2196,
        "vout": 1,
@@ -16,11 +15,10 @@
      Object {
        "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
        "decimals": 1,
        "height": 659837,
        "isValid": true,
-       "satoshis": 546,
        "tokenDocumentHash": "",
        "tokenDocumentUrl": "mint.bitcoin.com",
        "tokenId": "009ff65ef50632111a9661f67d80025481ebc80ced239d32a92705b04d5df8cc",
        "tokenName": "TT",
        "tokenQty": "7",
@@ -37,11 +35,10 @@
      Object {
        "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
        "decimals": 5,
        "height": 659843,
        "isValid": true,
-       "satoshis": 546,
        "tokenDocumentHash": "",
        "tokenDocumentUrl": "mint.bitcoin.com",
        "tokenId": "2aef6e63edfded1a299e78b529286deea2a6dd5299b6911778c25632d78a9479",
        "tokenName": "pitico",
        "tokenQty": "99.35",
@@ -63,11 +60,10 @@
        "info": Object {
          "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
          "decimals": 1,
          "height": 659837,
          "isValid": true,
-         "satoshis": 546,
          "tokenDocumentHash": "",
          "tokenDocumentUrl": "mint.bitcoin.com",
          "tokenId": "009ff65ef50632111a9661f67d80025481ebc80ced239d32a92705b04d5df8cc",
          "tokenName": "TT",
          "tokenQty": "7",
@@ -89,11 +85,10 @@
        "info": Object {
          "address": "bitcoincash:qphazxf3vhe4qchvzz2pjempdhplaxcj957xqq8mg2",
          "decimals": 5,
          "height": 659843,
          "isValid": true,
-         "satoshis": 546,
          "tokenDocumentHash": "",
          "tokenDocumentUrl": "mint.bitcoin.com",
          "tokenId": "2aef6e63edfded1a299e78b529286deea2a6dd5299b6911778c25632d78a9479",
          "tokenName": "pitico",
          "tokenQty": "99.35",
    at Object.<anonymous> (/work/web/cashtab/src/hooks/__tests__/useBCH.test.js:75:24)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

Each failure log is accessible here:
CashTab Unit Tests: useBCH hook gets SLP and BCH balances and utxos

Fabien requested changes to this revision.Jan 11 2021, 16:17
Fabien added inline comments.
web/cashtab/extension/public/manifest.json
6 ↗(On Diff #26857)

I still don't get why the version is jumping from 1 to 4 ?

This revision now requires changes to proceed.Jan 11 2021, 16:17

I still don't get why the version is jumping from 1 to 4 ?

This is bad codebase mgmt on my part.

Versions 0.0.2 and 0.0.3 had no other changes except for the version number and I neglected to submit them as diffs here.

Going forward, will run version bumps through phab.

This revision is now accepted and ready to land.Jan 12 2021, 14:56