Page MenuHomePhabricator

[ecash-lib] Add `parseAlp`
ClosedPublic

Authored by tobias_ruck on Fri, Apr 4, 17:21.

Details

Reviewers
Fabien
bytesofman
Group Reviewers
Restricted Project
Commits
rABC8fcfd69f15d0: [ecash-lib] Add `parseAlp`
Summary

Parses an ALP pushdata from eMPP.

See doc comment of parseAlp for details. Parallels D17871.

Also add readU48 to Bytes, so we have nice error messages.

Test Plan

npm test

Event Timeline

bytesofman requested changes to this revision.Fri, Apr 4, 18:24
bytesofman added inline comments.
modules/ecash-lib/src/token/alp.parse.ts
94 ↗(On Diff #53381)

would it make sense to have a parseAlpEmpp or generic parseEmpp function?

here, we need to first parse the EMPP, then parse all of the pushes to see if any are ALP

would be nice to just parseEMPP and get a summary of the whole tx

210 ↗(On Diff #53381)

is this endianness distinct from SLP?

Seems like should reference the spec, if not in specific function sat least in a comment at the top of the file

This revision now requires changes to proceed.Fri, Apr 4, 18:24
modules/ecash-lib/src/token/alp.parse.ts
94 ↗(On Diff #53381)

Yes, there will be a separate diff with parseEmpp, which will just return Uint8Array[].

Parsing and validating all ALP pushdata of a tx is not that trivial as it needs to do coloring, so best to do that in a function indicating "color", just like we do it in color.rs

210 ↗(On Diff #53381)

yes, SLP and ALP have reverse endianness to each other. can reference it

This revision is now accepted and ready to land.Fri, Apr 4, 20:48

Tail of the build log:

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

7 vulnerabilities (6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/ecash-wallet-tests

> chronik-client@3.0.1 prepublish
> npm run build


> chronik-client@3.0.1 build
> tsc


added 170 packages, and audited 172 packages in 5s

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

4 vulnerabilities (3 moderate, 1 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@3.0.1 build
> tsc

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

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build ecash-wallet-tests failed with exit code 2

Tail of the build log:

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

7 vulnerabilities (6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/ecash-agora-integration-tests

> chronik-client@3.0.1 prepublish
> npm run build


> chronik-client@3.0.1 build
> tsc


added 170 packages, and audited 172 packages in 5s

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

4 vulnerabilities (3 moderate, 1 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@3.0.1 build
> tsc

/work/modules/ecash-lib /work/abc-ci-builds/ecash-agora-integration-tests

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build ecash-agora-integration-tests failed with exit code 2

Tail of the build log:

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

7 vulnerabilities (6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/cashtab-tests

> chronik-client@3.0.1 prepublish
> npm run build


> chronik-client@3.0.1 build
> tsc


added 170 packages, and audited 172 packages in 4s

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

4 vulnerabilities (3 moderate, 1 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@3.0.1 build
> tsc

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

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build cashtab-tests failed with exit code 2

Tail of the build log:

  run `npm fund` for details

7 vulnerabilities (6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/ecash-lib-tests

> chronik-client@3.0.1 prepublish
> npm run build


> chronik-client@3.0.1 build
> tsc


added 170 packages, and audited 172 packages in 5s

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

4 vulnerabilities (3 moderate, 1 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@3.0.1 build
> tsc

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

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
CI configured to test build. Building...

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build ecash-lib-tests failed with exit code 2

Tail of the build log:

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

7 vulnerabilities (6 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecashaddrjs@2.0.0 build
> tsc

/work/modules/chronik-client /work/abc-ci-builds/ecash-agora-tests

> chronik-client@3.0.1 prepublish
> npm run build


> chronik-client@3.0.1 build
> tsc


added 170 packages, and audited 172 packages in 4s

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

4 vulnerabilities (3 moderate, 1 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@3.0.1 build
> tsc

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

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build ecash-agora-tests failed with exit code 2

Tail of the build log:

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

added 271 packages, and audited 275 packages in 2s

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

6 vulnerabilities (5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

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

src/token/alp.parse.ts(10,5): error TS2305: Module '"./alp.js"' has no exported member 'ALP_MAX_SIZE'.
Build ecash-lib-integration-tests failed with exit code 2
This revision was automatically updated to reflect the committed changes.