Page MenuHomePhabricator

[Cashtab] Migrate to new wallet shape that includes ecash-lib-ready sk and pk
DraftPublic

Authored by bytesofman on Wed, Nov 20, 13:39.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

We have been calculating sk and pk from wif every time we need them for ecash-lib txs. This was not particularly complicated when we were still using sendXec for all txs in Cashtab. However, with advanced tx construction methods provided by ecash-agora, we now to to calculate sk and pk in many places throughout Cashtab.

These values should be calculated when Cashtab first loads its wallets, not recalculated for every tx.

Migrate wallets to include these values.

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
wallet-pubkey-back
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31219
Build 61938: Build Diffcashtab-tests
Build 61937: arc lint + arc unit

Event Timeline

Tail of the build log:

Run `npm audit` for details.

> ecash-lib@0.2.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Installing ecash-agora dependencies...
/work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 364 packages, and audited 367 packages in 2s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@0.1.1 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 1483 packages, and audited 3329 packages in 25s

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

4 vulnerabilities (2 moderate, 2 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

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

TS2554: Expected 3 arguments, but got 2.
    343 |
    344 |             // If wallet is invalid, rebuild to latest Cashtab schema
  > 345 |             let newWallet = await createCashtabWallet(
        |                                   ^^^^^^^^^^^^^^^^^^^^
  > 346 |                 storedWallet.mnemonic,
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 347 |                 extraPathsToMigrate,
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  > 348 |             );
        | ^^^^^^^^^^^^^^
    349 |
    350 |             // Keep original name
    351 |             newWallet = { ...newWallet, name: storedWallet.name };


Build cashtab-tests failed with exit code 1

More type info, get migrations to work, update App.test.js to pass ecc and pass

Tail of the build log:

  npm audit fix

Run `npm audit` for details.

> ecash-lib@0.2.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

Installing ecash-agora dependencies...
/work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests

added 364 packages, and audited 367 packages in 1s

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

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@0.1.1 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/modules/ecash-agora /work/modules/ecash-lib /work/modules/ecash-lib-wasm /work/modules/ecash-script /work/modules/chronik-client /work/modules/mock-chronik-client /work/modules/ecashaddrjs /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1483 packages, and audited 3329 packages in 24s

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

3 vulnerabilities (2 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

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

TS2322: Type 'Map<number, { address: string; hash: string; wif: string; sk: Uint8Array; pk: Uint8Array; }>' is not assignable to type 'CashtabWalletPaths'.
  Property '1899' is missing in type 'Map<number, { address: string; hash: string; wif: string; sk: Uint8Array; pk: Uint8Array; }>' but required in type 'RequiredCashtabPathInfo'.
    1471 |     mnemonic: 'some words that would give it all away',
    1472 |     name: '[Burned] useWallet Mock',
  > 1473 |     paths: new Map([
         |     ^^^^^
    1474 |         [
    1475 |             1899,
    1476 |             {


Build cashtab-tests failed with exit code 1