Page MenuHomePhabricator

[ecash-lib] Remove `initWasm`
ClosedPublic

Authored by tobias_ruck on Wed, Feb 5, 22:49.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC3b1bf6f9ff46: [ecash-lib] Remove `initWasm`
Summary

This is a big inconvenience for users, instead we import it as base64 into the bundle directly.

In the future, we can also remove the requirement to thread in Ecc, and just instantiate an instance globally.

Test Plan

npm test, also publish the library as an RC and see if it works in the browser

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Failed tests logs:

====== Functions used to get inputs required for accept or cancel txs: "before all" hook in "Functions used to get inputs required for accept or cancel txs".Functions used to get inputs required for accept or cancel txs "before all" hook in "Functions used to get inputs required for accept or cancel txs" ======
TypeError: (0 , import_ecash_lib.initWasm) is not a function
    at Context.<anonymous> (src/inputs.test.ts:459:15)
    at process.processImmediate (node:internal/timers:483:21)

Each failure log is accessible here:
Functions used to get inputs required for accept or cancel txs: "before all" hook in "Functions used to get inputs required for accept or cancel txs".Functions used to get inputs required for accept or cancel txs "before all" hook in "Functions used to get inputs required for accept or cancel txs"

Tail of the build log:

[549/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addressbookpage.cpp.o
[550/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[551/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[552/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[553/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[554/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[555/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroltreewidget.cpp.o
[556/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[557/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/askpassphrasedialog.cpp.o
[558/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/editaddressdialog.cpp.o
[559/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/addresstablemodel.cpp.o
[560/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrimagewidget.cpp.o
[561/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/openuridialog.cpp.o
[562/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/overviewpage.cpp.o
[563/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/coincontroldialog.cpp.o
[564/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/createwalletdialog.cpp.o
[565/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionfilterproxy.cpp.o
[566/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receiverequestdialog.cpp.o
[567/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/recentrequeststablemodel.cpp.o
[568/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/receivecoinsdialog.cpp.o
[569/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsentry.cpp.o
[570/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondescdialog.cpp.o
[571/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/signverifymessagedialog.cpp.o
[572/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionrecord.cpp.o
[573/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiondesc.cpp.o
[574/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/sendcoinsdialog.cpp.o
[575/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentserver.cpp.o
[576/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactiontablemodel.cpp.o
[577/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/transactionview.cpp.o
[578/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/paymentrequestplus.cpp.o
[579/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletframe.cpp.o
[580/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodeltransaction.cpp.o
[581/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletcontroller.cpp.o
[582/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletmodel.cpp.o
[583/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/walletview.cpp.o
[584/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[585/589] Linking CXX static library src/qt/libbitcoin-qt-base.a
[586/589] Automatic MOC for target bitcoin-qt
[587/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[588/589] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[589/589] Linking CXX executable src/qt/bitcoin-qt
/work/modules/ecash-agora /work/abc-ci-builds/ecash-agora-integration-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.4.0 build
> tsc && tsc -p ./tsconfig.build.json

src/inputs.test.ts(6,10): error TS2305: Module '"ecash-lib"' has no exported member 'initWasm'.
Build ecash-agora-integration-tests failed with exit code 2

Tail of the build log:


> chronik-client@2.1.1 build
> tsc


added 265 packages, and audited 267 packages in 5s

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

5 vulnerabilities (3 moderate, 2 high)

To address issues that do not require attention, run:
  npm audit fix

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

Run `npm audit` for details.

> chronik-client@2.1.1 build
> tsc

/work/modules/ecash-lib /work/abc-ci-builds/cashtab-tests

added 365 packages, and audited 369 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-lib@1.5.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/ecash-agora /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.4.0 build
> tsc && tsc -p ./tsconfig.build.json

src/inputs.test.ts(6,10): error TS2305: Module '"ecash-lib"' has no exported member 'initWasm'.
Build cashtab-tests failed with exit code 2

Tail of the build log:

  eslint.config.js          |       0 |        0 |       0 |       0 |                              
 ecash-lib/dist/ffi         |       0 |        0 |       0 |       0 |                              
  ecash_lib_wasm_browser.js |       0 |        0 |       0 |       0 | 3-567                        
  ecash_lib_wasm_nodejs.js  |       0 |        0 |       0 |       0 | 1-497                        
 ecash-lib/src              |   18.85 |    16.23 |    8.57 |   32.42 |                              
  consts.ts                 |       0 |      100 |     100 |       0 | 6-8                          
  ecc.ts                    |   14.28 |    83.33 |     3.7 |   27.77 | 32-52,59,65-93               
  hash.ts                   |   21.95 |    83.33 |    6.66 |   42.85 | 26,29,32,35,38,41,45-50      
  hdwallet.ts               |       0 |        0 |       0 |       0 | 12-179                       
  hmac.ts                   |       0 |        0 |       0 |       0 | 16-73                        
  index.ts                  |       0 |        0 |       0 |       0 |                              
  indexBrowser.ts           |       0 |        0 |       0 |       0 |                              
  indexNodeJs.ts            |       0 |        0 |       0 |       0 |                              
  initBrowser.ts            |       0 |      100 |       0 |       0 | 11-16                        
  initNodeJs.ts             |       0 |      100 |     100 |       0 | 9-10                         
  mnemonic.ts               |       0 |        0 |       0 |       0 | 9-144                        
  op.ts                     |   20.13 |    23.33 |   36.36 |   39.47 | ...4,107,109,117-122,133-161 
  opcode.ts                 |    50.2 |    83.33 |     100 |     100 | 1                            
  pbkdf2.ts                 |       0 |      100 |       0 |       0 | 17-51                        
  script.ts                 |   19.26 |    17.64 |    9.67 |   33.33 | ...5-42,50,55,62-173,182-193 
  sigHashType.ts            |   38.66 |       25 |   38.46 |   76.31 | 26-58                        
  tx.ts                     |   16.48 |     11.9 |    4.76 |   31.91 | ...8,143-145,150-151,156,176 
  txBuilder.ts              |    8.02 |     9.61 |    4.54 |   16.48 | ...0,234-237,246-250,256-260 
  unsignedTx.ts             |    6.69 |        5 |    2.56 |   12.58 | ...0,344-345,350-351,356-357 
 ecash-lib/src/address      |   11.35 |    15.15 |    5.12 |   22.41 |                              
  address.ts                |   10.95 |    11.36 |    3.22 |   21.05 | ...3,239-240,255-256,266-344 
  legacyaddr.ts             |   12.04 |    22.72 |    12.5 |      25 | 15-19,23-38,70-111,124-128   
 ecash-lib/src/ffi          |       0 |        0 |       0 |       0 |                              
  ecash_lib_wasm_browser.js |       0 |        0 |       0 |       0 | 3-567                        
  ecash_lib_wasm_nodejs.js  |       0 |        0 |       0 |       0 | 1-497                        
 ecash-lib/src/io           |   19.56 |    31.37 |   23.43 |   38.23 |                              
  bytes.ts                  |    4.91 |       50 |    5.88 |    9.67 | 8-12,23-74                   
  hex.ts                    |   29.87 |       50 |   22.22 |   61.76 | 33-37,41-45,50,58,66-68      
  int.ts                    |       0 |        0 |       0 |       0 |                              
  str.ts                    |   46.15 |    83.33 |      40 |   85.71 | 15                           
  varsize.ts                |    6.12 |    13.15 |      20 |      12 | 14-24,35-47                  
  writer.ts                 |       0 |        0 |       0 |       0 |                              
  writerbytes.ts            |   22.95 |    21.87 |   33.33 |   45.16 | 34,43-68,80                  
  writerlength.ts           |   33.33 |    83.33 |   30.76 |    62.5 | 27-37                        
 ecash-lib/src/test         |    8.86 |     7.24 |    2.94 |   18.42 |                              
  testRunner.ts             |    8.86 |     7.24 |    2.94 |   18.42 | 38-207                       
 ecash-lib/src/token        |   10.58 |    17.24 |    6.97 |   16.77 |                              
  alp.ts                    |    9.37 |    15.62 |    4.34 |   18.29 | ...3,127-131,135-137,141-145 
  common.ts                 |   54.54 |    83.33 |     100 |     100 | 1                            
  empp.ts                   |   26.08 |       50 |   14.28 |      50 | 11-14,22-28                  
  slp.ts                    |       0 |        0 |       0 |       0 | 13-211                       
----------------------------|---------|----------|---------|---------|------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='385']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='3404']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='137']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='956']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='39']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='592']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='381']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='2367']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-lib-integration-tests-junit.xml': No such file or directory
Build ecash-lib-integration-tests failed with exit code 1

fix one missed usage of initWasm

Tail of the build log:

  eslint.config.js          |       0 |        0 |       0 |       0 |                              
 ecash-lib/dist/ffi         |       0 |        0 |       0 |       0 |                              
  ecash_lib_wasm_browser.js |       0 |        0 |       0 |       0 | 3-567                        
  ecash_lib_wasm_nodejs.js  |       0 |        0 |       0 |       0 | 1-497                        
 ecash-lib/src              |   18.85 |    16.23 |    8.57 |   32.42 |                              
  consts.ts                 |       0 |      100 |     100 |       0 | 6-8                          
  ecc.ts                    |   14.28 |    83.33 |     3.7 |   27.77 | 32-52,59,65-93               
  hash.ts                   |   21.95 |    83.33 |    6.66 |   42.85 | 26,29,32,35,38,41,45-50      
  hdwallet.ts               |       0 |        0 |       0 |       0 | 12-179                       
  hmac.ts                   |       0 |        0 |       0 |       0 | 16-73                        
  index.ts                  |       0 |        0 |       0 |       0 |                              
  indexBrowser.ts           |       0 |        0 |       0 |       0 |                              
  indexNodeJs.ts            |       0 |        0 |       0 |       0 |                              
  initBrowser.ts            |       0 |      100 |       0 |       0 | 11-16                        
  initNodeJs.ts             |       0 |      100 |     100 |       0 | 9-10                         
  mnemonic.ts               |       0 |        0 |       0 |       0 | 9-144                        
  op.ts                     |   20.13 |    23.33 |   36.36 |   39.47 | ...4,107,109,117-122,133-161 
  opcode.ts                 |    50.2 |    83.33 |     100 |     100 | 1                            
  pbkdf2.ts                 |       0 |      100 |       0 |       0 | 17-51                        
  script.ts                 |   19.26 |    17.64 |    9.67 |   33.33 | ...5-42,50,55,62-173,182-193 
  sigHashType.ts            |   38.66 |       25 |   38.46 |   76.31 | 26-58                        
  tx.ts                     |   16.48 |     11.9 |    4.76 |   31.91 | ...8,143-145,150-151,156,176 
  txBuilder.ts              |    8.02 |     9.61 |    4.54 |   16.48 | ...0,234-237,246-250,256-260 
  unsignedTx.ts             |    6.69 |        5 |    2.56 |   12.58 | ...0,344-345,350-351,356-357 
 ecash-lib/src/address      |   11.35 |    15.15 |    5.12 |   22.41 |                              
  address.ts                |   10.95 |    11.36 |    3.22 |   21.05 | ...3,239-240,255-256,266-344 
  legacyaddr.ts             |   12.04 |    22.72 |    12.5 |      25 | 15-19,23-38,70-111,124-128   
 ecash-lib/src/ffi          |       0 |        0 |       0 |       0 |                              
  ecash_lib_wasm_browser.js |       0 |        0 |       0 |       0 | 3-567                        
  ecash_lib_wasm_nodejs.js  |       0 |        0 |       0 |       0 | 1-497                        
 ecash-lib/src/io           |   19.56 |    31.37 |   23.43 |   38.23 |                              
  bytes.ts                  |    4.91 |       50 |    5.88 |    9.67 | 8-12,23-74                   
  hex.ts                    |   29.87 |       50 |   22.22 |   61.76 | 33-37,41-45,50,58,66-68      
  int.ts                    |       0 |        0 |       0 |       0 |                              
  str.ts                    |   46.15 |    83.33 |      40 |   85.71 | 15                           
  varsize.ts                |    6.12 |    13.15 |      20 |      12 | 14-24,35-47                  
  writer.ts                 |       0 |        0 |       0 |       0 |                              
  writerbytes.ts            |   22.95 |    21.87 |   33.33 |   45.16 | 34,43-68,80                  
  writerlength.ts           |   33.33 |    83.33 |   30.76 |    62.5 | 27-37                        
 ecash-lib/src/test         |    8.86 |     7.24 |    2.94 |   18.42 |                              
  testRunner.ts             |    8.86 |     7.24 |    2.94 |   18.42 | 38-207                       
 ecash-lib/src/token        |   10.58 |    17.24 |    6.97 |   16.77 |                              
  alp.ts                    |    9.37 |    15.62 |    4.34 |   18.29 | ...3,127-131,135-137,141-145 
  common.ts                 |   54.54 |    83.33 |     100 |     100 | 1                            
  empp.ts                   |   26.08 |       50 |   14.28 |      50 | 11-14,22-28                  
  slp.ts                    |       0 |        0 |       0 |       0 | 13-211                       
----------------------------|---------|----------|---------|---------|------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='385']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='3404']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='137']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='956']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='39']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='592']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='381']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='2367']
##teamcity[blockClosed name='Code Coverage Summary']
mv: cannot stat 'test_results/ecash-lib-integration-tests-junit.xml': No such file or directory
Build ecash-lib-integration-tests failed with exit code 1

fix imports in functional tests

modules/ecash-lib/README.md
88 ↗(On Diff #52536)

major version bump for this one right? Since now we can't initWasm() even if we wanted to.

bump version, update change log, include a link to this diff.

modules/ecash-lib/src/global.d.ts
1 ↗(On Diff #52536)

what is this doing exactly?

modules/ecash-lib/src/hash.test.ts
9 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/src/hdwallet.test.ts
10 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/src/hmac.test.ts
10 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/src/mnemonic.test.ts
14 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/src/pbkdf2.test.ts
11 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/src/unsignedTx.test.ts
30 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/tests/alp.test.ts
23 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/tests/slp.test.ts
29 ↗(On Diff #52536)

do we still need this import?

modules/ecash-lib/tests/txBuilder.test.ts
36 ↗(On Diff #52536)

do we still need this import?

looks like all these might have just been auto-added by a linter, but we can lose them now

modules/ecash-lib/README.md
88 ↗(On Diff #52536)

Yes would be a major version bump, but I'd bundle in a removal of the ecc param in a lot of functions in the 2.0.0 version, so do the bump in a separate diff.

Also update ecash-agora in the same way

modules/ecash-lib/src/hash.test.ts
9 ↗(On Diff #52536)

yes, we need to run the code inside of it, otherwise code like new Ecc().derivePubkey(...) will fail.

this is only inside of the tests though, users of the lib don't have to do this

modules/ecash-lib/README.md
88 ↗(On Diff #52536)

might be worth doing it all in one diff. ecash-agora takes ecash-lib as a dependency, might run into some issues if we do not initWasm here but still have it in ecash-agora. Should show that whatever fix is rolled out here will also work in ecash-agora, best way is prob by implementing it in one go even if the diff is larger.

We already have to update lots of stuff, but I think that's what the monorepo + CI is good for.

modules/ecash-lib/src/hash.test.ts
9 ↗(On Diff #52536)

interesting -- probably worth a comment, or at least an explanation in initNodeJs ... this isn't obvious

so users of the lib would not need to do this for their tests?

get rid of the .txt?raw, use a variable directly

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded crypto-common v0.1.6
  Downloaded log v0.4.22
  Downloaded generic-array v0.14.7
  Downloaded version_check v0.9.5
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded quote v1.0.37
  Downloaded wasm-bindgen v0.2.92
  Downloaded syn v2.0.90
  Downloaded cc v1.2.3
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded unicode-ident v1.0.14
  Downloaded typenum v1.17.0
  Downloaded thiserror-impl v2.0.4
  Downloaded thiserror v2.0.4
  Downloaded sha2 v0.10.8
  Downloaded ripemd v0.1.3
  Downloaded proc-macro2 v1.0.92
  Downloaded bumpalo v3.16.0
  Downloaded digest v0.10.7
  Downloaded cpufeatures v0.2.16
  Downloaded block-buffer v0.10.4
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling typenum v1.17.0
   Compiling version_check v0.9.5
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling bumpalo v3.16.0
   Compiling log v0.4.22
   Compiling once_cell v1.20.2
   Compiling thiserror v2.0.4
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 6.95s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build ecash-lib-tests failed with exit code 2

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded log v0.4.22
  Downloaded ripemd v0.1.3
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded unicode-ident v1.0.14
  Downloaded wasm-bindgen v0.2.92
  Downloaded syn v2.0.90
  Downloaded thiserror v2.0.4
  Downloaded cc v1.2.3
  Downloaded typenum v1.17.0
  Downloaded sha2 v0.10.8
  Downloaded proc-macro2 v1.0.92
  Downloaded bumpalo v3.16.0
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded version_check v0.9.5
  Downloaded thiserror-impl v2.0.4
  Downloaded quote v1.0.37
  Downloaded generic-array v0.14.7
  Downloaded cpufeatures v0.2.16
  Downloaded block-buffer v0.10.4
  Downloaded digest v0.10.7
  Downloaded crypto-common v0.1.6
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling version_check v0.9.5
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling log v0.4.22
   Compiling once_cell v1.20.2
   Compiling bumpalo v3.16.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v2.0.4
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 6.85s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build ecash-lib-integration-tests failed with exit code 2

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded block-buffer v0.10.4
  Downloaded generic-array v0.14.7
  Downloaded log v0.4.22
  Downloaded crypto-common v0.1.6
  Downloaded cpufeatures v0.2.16
  Downloaded digest v0.10.7
  Downloaded typenum v1.17.0
  Downloaded version_check v0.9.5
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded unicode-ident v1.0.14
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded thiserror-impl v2.0.4
  Downloaded syn v2.0.90
  Downloaded wasm-bindgen v0.2.92
  Downloaded thiserror v2.0.4
  Downloaded sha2 v0.10.8
  Downloaded quote v1.0.37
  Downloaded ripemd v0.1.3
  Downloaded proc-macro2 v1.0.92
  Downloaded bumpalo v3.16.0
  Downloaded cc v1.2.3
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling typenum v1.17.0
   Compiling version_check v0.9.5
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling bumpalo v3.16.0
   Compiling log v0.4.22
   Compiling once_cell v1.20.2
   Compiling thiserror v2.0.4
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 9.40s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build cashtab-tests failed with exit code 2

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded generic-array v0.14.7
  Downloaded digest v0.10.7
  Downloaded crypto-common v0.1.6
  Downloaded proc-macro2 v1.0.92
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded cc v1.2.3
  Downloaded wasm-bindgen v0.2.92
  Downloaded syn v2.0.90
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded version_check v0.9.5
  Downloaded unicode-ident v1.0.14
  Downloaded typenum v1.17.0
  Downloaded thiserror-impl v2.0.4
  Downloaded thiserror v2.0.4
  Downloaded sha2 v0.10.8
  Downloaded ripemd v0.1.3
  Downloaded quote v1.0.37
  Downloaded log v0.4.22
  Downloaded cpufeatures v0.2.16
  Downloaded block-buffer v0.10.4
  Downloaded bumpalo v3.16.0
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling typenum v1.17.0
   Compiling version_check v0.9.5
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling log v0.4.22
   Compiling bumpalo v3.16.0
   Compiling once_cell v1.20.2
   Compiling thiserror v2.0.4
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 6.10s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build ecash-agora-integration-tests failed with exit code 2

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded log v0.4.22
  Downloaded cpufeatures v0.2.16
  Downloaded block-buffer v0.10.4
  Downloaded digest v0.10.7
  Downloaded bumpalo v3.16.0
  Downloaded generic-array v0.14.7
  Downloaded version_check v0.9.5
  Downloaded crypto-common v0.1.6
  Downloaded thiserror-impl v2.0.4
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded ripemd v0.1.3
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded sha2 v0.10.8
  Downloaded typenum v1.17.0
  Downloaded unicode-ident v1.0.14
  Downloaded thiserror v2.0.4
  Downloaded cc v1.2.3
  Downloaded wasm-bindgen v0.2.92
  Downloaded syn v2.0.90
  Downloaded proc-macro2 v1.0.92
  Downloaded quote v1.0.37
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling typenum v1.17.0
   Compiling version_check v0.9.5
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling once_cell v1.20.2
   Compiling log v0.4.22
   Compiling bumpalo v3.16.0
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v2.0.4
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling ripemd v0.1.3
   Compiling sha2 v0.10.8
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 8.63s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build token-server-tests failed with exit code 2

Tail of the build log:

    Updating git repository `https://github.com/karyontech/karyon.git`
    Updating git repository `https://github.com/LogosFoundation/bitcoinsuite`
 Downloading crates ...
  Downloaded crypto-common v0.1.6
  Downloaded digest v0.10.7
  Downloaded cpufeatures v0.2.16
  Downloaded log v0.4.22
  Downloaded bumpalo v3.16.0
  Downloaded wasm-bindgen-macro-support v0.2.92
  Downloaded version_check v0.9.5
  Downloaded wasm-bindgen-backend v0.2.92
  Downloaded wasm-bindgen-macro v0.2.92
  Downloaded syn v2.0.90
  Downloaded wasm-bindgen v0.2.92
  Downloaded unicode-ident v1.0.14
  Downloaded typenum v1.17.0
  Downloaded quote v1.0.37
  Downloaded cc v1.2.3
  Downloaded proc-macro2 v1.0.92
  Downloaded generic-array v0.14.7
  Downloaded thiserror-impl v2.0.4
  Downloaded ripemd v0.1.3
  Downloaded thiserror v2.0.4
  Downloaded sha2 v0.10.8
  Downloaded block-buffer v0.10.4
   Compiling proc-macro2 v1.0.92
   Compiling unicode-ident v1.0.14
   Compiling version_check v0.9.5
   Compiling typenum v1.17.0
   Compiling wasm-bindgen-shared v0.2.92
   Compiling shlex v1.3.0
   Compiling once_cell v1.20.2
   Compiling log v0.4.22
   Compiling bumpalo v3.16.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v2.0.4
   Compiling cfg-if v1.0.0
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling cc v1.2.3
   Compiling generic-array v0.14.7
   Compiling quote v1.0.37
   Compiling syn v2.0.90
   Compiling ecash-secp256k1-sys v0.10.0 (/work/modules/ecash-secp256k1/ecash-secp256k1-sys)
   Compiling block-buffer v0.10.4
   Compiling crypto-common v0.1.6
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling ecash-secp256k1 v0.30.0 (/work/modules/ecash-secp256k1)
   Compiling thiserror-impl v2.0.4
   Compiling wasm-bindgen-macro-support v0.2.92
   Compiling wasm-bindgen-macro v0.2.92
   Compiling ecash-lib-wasm v0.1.0 (/work/modules/ecash-lib-wasm)
    Finished release-wasm [optimized] target(s) in 9.06s
sed: can't read : No such file or directory
base64: invalid option -- 'b'
Try 'base64 --help' for more information.
sed: can't read : No such file or directory
Build ecash-agora-tests failed with exit code 2
modules/ecash-lib/README.md
88 ↗(On Diff #52536)

Well it's removed from agora in this diff, but the removal of the ecc param is a different kind of change, so IMO makes sense to split it out. Also allows some testing before we release 2.0.0

modules/ecash-lib/src/hash.test.ts
9 ↗(On Diff #52536)

No, only internally for ecash-lib

nice, huge step change for dev experience, and esp for apps that use ecash-lib and ecash-agora

in general, it's "bad" to have big patches of base64 ... but it's not like are hardcoding it as a black box, it is built from (open) source every time the lib is published.

Was concerned that this would have led to issues with the cashtab chrome extension but in testing it builds and runs no problem.

This diff will deploy a new version of Cashtab, so please run

cd cashtab/
npm version minor

before landing

+ see comment nit on faucet

This revision is now accepted and ready to land.Thu, Feb 6, 05:22

nice, huge step change for dev experience, and esp for apps that use ecash-lib and ecash-agora

Yes, took a bit of dogfooding for me to find the problems myself, and come up with piecewise solutions. One thing to note is that this will slow down loading the bundle.js of an app, as it will be part of the bundle.js and also build the webassembly synchronously the first time we require() ecash-lib now, making it harder to display a loader etc. Also, everyone will have to build the webassembly, even if they don't use any ECC.

However, I think the goal of this lib is to be a convenient tool that doesn't require a lot of setup, basically everyone ran into these issues one way or another.

If people do want to have a more granular import, we can export a bundle that allows to import individual parts: import { Ecc } from "ecash-lib/ecc", but I say we cross this bridge once someone complains for the first time.

in general, it's "bad" to have big patches of base64 ... but it's not like are hardcoding it as a black box, it is built from (open) source every time the lib is published.

Mathematically, it's identical to having a big patch of binary wasm... But since we build with Docker, it should be reproducible.

cd cashtab/
npm version minor

Why minor here and patch in D17640 ?

+ see comment nit on faucet

I don't see it

apps/faucet/index.ts
51 ↗(On Diff #52541)

remove this now-obsolete comment

Why minor here and patch in D17640 ?

actually yeah npm version patch is good for both (for the Cashtab version bump)

in this case the user should not notice any difference but I do want to be able to tell if a Cashtab user is on this ecash-lib or a previous one

+ see comment nit on faucet

remove line 51 from apps/faucet/index.ts, console.log('Initialize WASM...');

everyone will have to build the webassembly, even if they don't use any ECC.

in practice I think this will be almost no one. For the last year or so I always end up needing ECC for pretty much anything I want to do with ecash-lib...but it is a weird thing to explain to new devs (wtf is ecc? this is ... a param? it needs to be initialized? but not itself directly, we must "summon" it somehow by initting .... Wasm? but the ecc dummy does not require this ritual? wtf is an ecc dummy?)

This revision was automatically updated to reflect the committed changes.