Page MenuHomePhabricator

[Cashtab] Build all targetOutputs with script instead of address key
ClosedPublic

Authored by bytesofman on Jul 5 2024, 21:15.

Details

Summary

ecash-lib requires tx builder outputs to have a script: <Script> key, not an address: <cashaddr> key. Currently we are converting all targetOutputs in the sendXec function.

Going forward, we will start to support more complicated txs that may have targetOutputs already fully prepared (e.g. with a custom p2sh Script from ecash-agora. Rather than only convert some targetOutputs and not others in sendXec, we should instead prepare all targetOutputs to the same ecash-lib standard.

With added support in ecash-lib for converting an address to a Script now available, we can now prepare all Cashtab targetOutputs for ecash-lib so that they do not need to go through a Cashtab-specific conversion process at the tx build step.

Test Plan

npm test

Diff Detail

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

Event Timeline

should wait on review and landing of D16425 here, as fully implementing this function requires additional modifications to slpv1 functions that generate targetOutputs with address key

Tail of the build log:

   Compiling wasm-bindgen-shared v0.2.92
   Compiling once_cell v1.19.0
   Compiling bumpalo v3.16.0
   Compiling log v0.4.21
   Compiling cc v1.0.92
   Compiling thiserror v1.0.58
   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 generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   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 secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   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 5.72s
/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 362 packages, and audited 364 packages in 2s

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

found 0 vulnerabilities

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

/work/cashtab /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 1641 packages, and audited 2460 packages in 23s

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

found 0 vulnerabilities

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

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

[eslint] 
src/components/Etokens/Token/index.js
  Line 45:19:  'addressToScript' is defined but never used  no-unused-vars

Search for the keywords to learn more about each error.


Build cashtab-tests failed with exit code 1

Finish implementation, update tests

Tail of the build log:

   Compiling wasm-bindgen-shared v0.2.92
   Compiling once_cell v1.19.0
   Compiling cc v1.0.92
   Compiling bumpalo v3.16.0
   Compiling log v0.4.21
   Compiling cfg-if v1.0.0
   Compiling wasm-bindgen v0.2.92
   Compiling thiserror v1.0.58
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   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 secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   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 5.58s
/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 362 packages, and audited 364 packages in 2s

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

found 0 vulnerabilities

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

/work/cashtab /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 1641 packages, and audited 2460 packages in 22s

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

found 0 vulnerabilities

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

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

[eslint] 
src/components/Etokens/Token/index.js
  Line 45:19:  'addressToScript' is defined but never used  no-unused-vars

Search for the keywords to learn more about each error.


Build cashtab-tests failed with exit code 1

implement updated ecash-lib with Script.fromAddress method

Tail of the build log:

   Compiling wasm-bindgen-shared v0.2.92
   Compiling cc v1.0.92
   Compiling log v0.4.21
   Compiling once_cell v1.19.0
   Compiling bumpalo v3.16.0
   Compiling wasm-bindgen v0.2.92
   Compiling cfg-if v1.0.0
   Compiling thiserror v1.0.58
   Compiling abc-rust-lint v0.1.0 (/work/chronik/abc-rust-lint)
   Compiling generic-array v0.14.7
   Compiling quote v1.0.36
   Compiling syn v2.0.58
   Compiling secp256k1-sys-abc v0.4.1 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling digest v0.10.7
   Compiling sha2 v0.10.8
   Compiling ripemd v0.1.3
   Compiling wasm-bindgen-backend v0.2.92
   Compiling secp256k1-abc v0.20.3 (https://github.com/raipay/secp256k1-abc?rev=b23e742#b23e7421)
   Compiling thiserror-impl v1.0.58
   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.29s
/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 363 packages, and audited 366 packages in 2s

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

found 0 vulnerabilities

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

/work/cashtab /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 1641 packages, and audited 2460 packages in 24s

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

found 0 vulnerabilities

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

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

[eslint] 
src/transactions/index.js
  Line 6:8:  'cashaddr' is defined but never used  no-unused-vars

Search for the keywords to learn more about each error.


Build cashtab-tests failed with exit code 1
bytesofman published this revision for review.Jul 9 2024, 13:06
bytesofman edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Jul 9 2024, 13:53