Page MenuHomePhabricator

[Cashtab] eCash native transaction builder (xec-js)
Needs RevisionPublic

Authored by emack on May 18 2022, 14:20.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

eCash native transaction building refactor which leverages Sam Rock's bch-js fork to directly pass in eCash addresses. This enabled the removal of logic previously going the extra step of converting to cash addresses (due to bch-js requirements) prior to transaction building.

Of particular note:

  • Both one-to-one and one-to-many TXs in Send.js' Send() function no longer converts the single or array of eCash addresses into bitcoincash: before calling useBCH.js' sendXec()
  • sendXec() instantiates xec-js' TransactionBuilder and adds the eCash addresses as output directly with no further conversion. In some cases (e.g. REMAINDER_ADDR) conversion to eCash address is required.
  • xec-js (the bch-js fork) is stored within /src because of the explicit restriction of create-react-app's ModuleScopePlugin preventing relative imports from outside of the src folder.
Test Plan
  • npm i assert
  • npm start
  • send a one to one tx
  • send a one to many tx
  • optionally add in debug statements to verify the addresses passed in to xec-js are in the eCash format

Diff Detail

Repository
rABC Bitcoin ABC
Branch
xecTxBuilder
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 19078
Build 37904: Build Diffcashtab-tests
Build 37903: arc lint + arc unit

Event Timeline

emack requested review of this revision.May 18 2022, 14:20

Tail of the build log:

Build 'Bitcoin ABC Diffs / Diff Testing' #46191, branch 'refs/tags/phabricator/diff/33580'
Triggered 2022-05-18 14:20:57 by 'Phabricator Staging (phabricator-staging)'
Started 2022-05-18 14:21:16 on agent 'buildagent4'
Finished 2022-05-18 14:21:18 with status FAILURE 'Unable to collect changes'
VCS revisions: 'BitcoinABC_BitcoinAbcStaging' (Git, instance id 22): 'N/A' (checkout rules: '+:. => ./bitcoin-abc')
TeamCity URL https://build.bitcoinabc.org/viewLog.html?buildId=391075&buildTypeId=BitcoinABC_BitcoinAbcStaging 
TeamCity server version is 2019.2.4 (build 72059), server timezone: GMT (UTC)

[14:20:57]E: bt15 (running for 20s)
[14:20:57]i: TeamCity server version is 2019.2.4 (build 72059)
[14:20:57] : Collecting changes in 2 VCS roots (6s)
[14:20:57] :	 [Collecting changes in 2 VCS roots] VCS Root details
[14:20:57] :		 [VCS Root details] "Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}
[14:20:57] :		 [VCS Root details] "abc-infrastructure" {instance id=24, parent internal id=7, parent id=AutomatedDeployments_BitcoinAbcDeveloperTools_AbcInfrastructure, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/infrastructure.git#refs/heads/master"}
[14:20:58]i:	 [Collecting changes in 2 VCS roots] Detecting changes in VCS root 'abc-infrastructure' (used in 'Bitcoin-ABC Infra Checkout', 'Extract secp256k1 from ABC' and 3 other configurations)
[14:20:58]i:	 [Collecting changes in 2 VCS roots] Will collect changes for 'abc-infrastructure' starting from revision 2883c3860e7d614161ff6475cbd4a35ec7145105
[14:20:58]i:	 [Collecting changes in 2 VCS roots] Detecting changes in VCS root 'Bitcoin ABC Staging' (used in 'Diff Testing', 'Staging Checkout Dummy')
[14:20:58]i:	 [Collecting changes in 2 VCS roots] Will collect changes for 'Bitcoin ABC Staging' starting from revision 53a5929c014186606c89c5950be7ba9cf18b36a3
[14:20:58]i:	 [Collecting changes in 2 VCS roots] VCS revisions for 'Bitcoin ABC Staging' - 53a5929c014186606c89c5950be7ba9cf18b36a3..53a5929c014186606c89c5950be7ba9cf18b36a3
[14:20:58]i:	 [Collecting changes in 2 VCS roots] Processing combined checkout rule for 'Bitcoin ABC Staging' 
[14:20:59]i:	 [Collecting changes in 2 VCS roots] VCS root 'Bitcoin ABC Staging': git fetch ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git
[14:21:03]i:	 [Collecting changes in 2 VCS roots] VCS root 'Bitcoin ABC Staging': update ref remote name: refs/tags/phabricator/diff/33580, local name: refs/tags/phabricator/diff/33580, old object id: 0000000000000000000000000000000000000000, new object id: a780f873b6b60d33d271fe0f4d77279e0028246f, result: NEW
[14:21:03]i:	 [Collecting changes in 2 VCS roots] VCS root 'Bitcoin ABC Staging': Remote process messages: Total 13 (delta 0), reused 0 (delta 0), pack-reused 0
[14:21:03]i:	 [Collecting changes in 2 VCS roots] VCS root 'Bitcoin ABC Staging': git fetch ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git finished
[14:21:16] : The build is removed from the queue to be prepared for the start
[14:21:18]E: Failed to collect changes, error: Error collecting changes for VCS repository '"Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}'
Collecting changes failed: jetbrains.buildServer.buildTriggers.vcs.git.submodules.MissingSubmoduleEntryException: The repository 'ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git' has a submodule in the 'a780f873b6b60d33d271fe0f4d77279e0028246f' commit at the 'web/cashtab/src/xec-js' path, but has no entry for this path in .gitmodules configuration, VCS root: "Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}
[14:21:18]E: Failed to collect changes, error: Error collecting changes for VCS repository '"Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}'
Collecting changes failed: jetbrains.buildServer.buildTriggers.vcs.git.submodules.MissingSubmoduleEntryException: The repository 'ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git' has a submodule in the 'a780f873b6b60d33d271fe0f4d77279e0028246f' commit at the 'web/cashtab/src/xec-js' path, but has no entry for this path in .gitmodules configuration, VCS root: "Bitcoin ABC Staging" {instance id=22, parent internal id=3, parent id=BitcoinABC_BitcoinAbcStaging, description: "ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc-staging.git#refs/heads/master"}
[14:21:18] : Build finished

Very nice diff. I think this is more of a good proof of concept for now though. Next steps:

  1. Implement chronik
  2. Clean up transaction functions [modular]
  3. Get xec-js published to npm; we shouldn't be pulling things from personal git repos
  4. Deprecate bch-js for xec-js
This revision now requires changes to proceed.May 19 2022, 20:26