Page MenuHomePhabricator

[Cashtab] Upgrade slpv1 burn txs
ClosedPublic

Authored by bytesofman on Feb 23 2024, 22:46.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABCad48553135ee: [Cashtab] Upgrade slpv1 burn txs
Summary

Use latest coinselect and slpv1 methods to create and broadcast slpv1 token burn txs in Cashtab

Test Plan

npm test

Diff Detail

Repository
rABC Bitcoin ABC
Branch
upgrade-slpv1-burns
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 27378
Build 54319: Build Diffcashtab-tests
Build 54318: arc lint + arc unit

Event Timeline

Tail of the build log:

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm WARN deprecated @babel/plugin-proposal-private-methods@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
npm WARN deprecated @babel/plugin-proposal-private-property-in-object@7.21.11: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated domexception@4.0.0: Use your platform's native DOMException instead
npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
npm WARN deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0

added 1722 packages, and audited 1723 packages in 22s

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

found 0 vulnerabilities

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

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

[eslint] 
src/components/Send/SendToken.js
  Line 33:10:  'burnToken' 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

Failed tests logs:

====== CashTab Unit Tests: <Home /> Renders Sideshift button if user loads with a new wallet ======
Error: Unable to find role="button" and name `/Exchange to XEC via SideShift/`

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="ant-spin-nested-loading css-dev-only-do-not-override-1rqnfsa"
    >
      <div>
        <div
          aria-busy="true"
          aria-live="polite"
          class="ant-spin ant-spin-spinning css-dev-only-do-not-override-1rqnfsa"
        >
          <span
            aria-label="loading"
            class="anticon anticon-loading anticon-spin cashLoadingIcon ant-spin-dot"
            role="img"
          >
            <svg
              aria-hidden="true"
              data-icon="loading"
              fill="currentColor"
              focusable="false"
              height="1em"
              viewBox="0 0 1024 1024"
              width="1em"
            >
              <path
                d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"
              />
            </svg>
          </span>
        </div>
      </div>
      <div
        class="ant-spin-container ant-spin-blur"
      >
        <div
          class="sc-LKuAh jSXNAo"
        >
          <div
            class="sc-kZmsYB eHkWzo"
          >
            <div
              class="sc-RcBXQ gMCskf"
            >
              <div
                class="sc-hzNEM iiFjIO"
              >
                <div
                  class="sc-iSDuPN ccpgHi"
                >
                  <img
                    alt="cashtab"
                    class="sc-fZwumE bcurWd"
                    src="test-file-stub"
                  />
                </div>
                <div
                  class="sc-elJkPf geNavj"
                  data-testid="wallet-info-ctn"
                >
                  <div
                    class="sc-dEoRIm iVOOxs"
                  >
                    <div
                      class="sc-jtggT dNidya"
                    >
                      Transaction Fixtures
                    </div>
                    <a
                      href="/configure"
                    >
                      <svg
                        class="sc-jTzLTM bTdWCF"
                      />
                    </a>
                    <div>
                       
                      <button
                        aria-checked="false"
                        class="ant-switch ant-switch-small css-dev-only-do-not-override-1rqnfsa"
                        role="switch"
                        type="button"
                      >
                        <div
                          class="ant-switch-handle"
                        />
                        <span
                          class="ant-switch-inner"
                        >
                          <span
                            class="ant-switch-inner-checked"
                          >
                            <svg
                              class="sc-cSHVUG bgwEHu"
                            />
                          </span>
                          <span
                            class="ant-switch-inner-unchecked"
                          >
                            <svg
                              class="sc-kAzzGY fUTkYj"
                            />
                          </span>
                        </span>
                      </button>
                    </div>
                  </div>
                  <div
                    class="sc-ebFjAB kxaSkj"
                    data-testid="balance-xec"
                  >
                    0.00
                     
                    XEC
                     
                  </div>
                </div>
              </div>
              <div
                class="sc-jwKygS hNrbtP"
                data-testid="loading-ctn"
              />
            </div>
            <div
              class="sc-iBEsjs jmPiFQ"
            >
              <button
                class="sc-gmeYpB dpikyJ"
              >
                <svg />
              </button>
              <button
                class="sc-gmeYpB eQwTbZ"
                data-testid="nav-btn-send"
              >
                <svg
                  class="sc-kEYyzF dWIuoY"
                  style="margin-top: -9px;"
                />
              </button>
              <button
                class="sc-gmeYpB eQwTbZ"
                data-testid="nav-btn-etokens"
              >
                <span
                  aria-label="appstore-add"
                  class="anticon anticon-appstore-add"
                  role="img"
                  style="font-size: 24px;"
                >
                  <svg
                    aria-hidden="true"
                    data-icon="appstore-add"
                    fill="currentColor"
                    focusable="false"
                    height="1em"
                    viewBox="64 64 896 896"
                    width="1em"
                  >
                    <defs />
                    <path
                      d="M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"
                    />
                  </svg>
                </span>
              </button>
              <button
                class="sc-gmeYpB eQwTbZ"
                data-testid="nav-btn-receive"
              >
                <svg />
              </button>
              <div
                class="sc-chbbiW ktwTIv"
                data-testid="hamburger"
              >
                <span
                  class="sc-kxynE bbUulF"
                />
                <div
                  class="sc-cooIXK gkGTON"
                  data-testid="hamburger-menu"
                >
                  <button
                    class="sc-fcdeBU RXlWo"
                    data-testid="nav-btn-airdrop"
                  >
                     
                    <p>
                      Airdrop
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                  <button
                    class="sc-fcdeBU RXlWo"
                    data-testid="nav-btn-swap"
                  >
                     
                    <p>
                      Swap
                    </p>
                    <span
                      aria-label="swap"
                      class="anticon anticon-swap"
                      role="img"
                      style="font-size: 24px;"
                    >
                      <svg
                        aria-hidden="true"
                        data-icon="swap"
                        fill="currentColor"
                        focusable="false"
                        height="1em"
                        viewBox="64 64 896 896"
                        width="1em"
                      >
                        <path
                          d="M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z"
                        />
                      </svg>
                    </span>
                  </button>
                  <button
                    class="sc-fcdeBU RXlWo"
                    data-testid="nav-btn-signverifymsg"
                  >
                    <p>
                      Sign & Verify
                    </p>
                    <svg
                      class="sc-chPdSV kiHcnD"
                    />
                  </button>
                  <button
                    class="sc-fcdeBU RXlWo"
                    data-testid="nav-btn-configure"
                  >
                    <p>
                      Settings
                    </p>
                    <svg
                      height="33px"
                      width="30px"
                    />
                  </button>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
    at waitForWrapper (/work/cashtab/node_modules/@testing-library/dom/dist/wait-for.js:163:27)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:86:33
    at Object.findByRole (/work/cashtab/src/components/Home/__tests__/Home.test.js:128:26)

Each failure log is accessible here:
CashTab Unit Tests: <Home /> Renders Sideshift button if user loads with a new wallet

rerun ci, flaky test unrelated to diff

skip chronik preflight checks for txs that are intended to be burns

bytesofman added inline comments.
cashtab/src/components/Send/SendToken.js
460

Ran into this error before implementing the isBurn bool in sendXec -- this works i.e. this renders the error in the notification, previous method printed {}

cashtab/src/components/Send/__tests__/SendToken.test.js
68 ↗(On Diff #45552)

I haven't gotten to these tests here while applying standardized cashtab testing wrappers throughout the app. Was necessary for the newest test, so applied it just there, with associated beforeEach and afterEach

applying throughout this component will be its own diff.

410 ↗(On Diff #45549)

image.png (657×790 px, 70 KB)

This tx burns all input utxos

Can see that the SLP is "sending" 0

can't tell in electrum but the mock here has a utxo qty of 1. need to get the chronik-client validate-tx endpoint supported for better testing of token txs

cashtab/src/slpv1/index.js
201 ↗(On Diff #45552)

tokenId is needed in getSendTokenInputs and its dependent functions, getSlpSendTargetOutputs and getSlpBurnTargetOutputs

It is available from a token utxo ... but we should pass it to make sure we are always using the same param.

Will update getSlpSendTargetOutputs to use this param after this diff.

209 ↗(On Diff #45552)

see D15525

221 ↗(On Diff #45552)

pending D15525

cashtab/src/transactions/fixtures/vectors.js
570 ↗(On Diff #45549)

image.png (657×790 px, 78 KB)

2 token inputs
1 token output for change

can see the hex is "SEND" ing 8ac72047b7ecebff ('9999996989999999000') -- in this case, this is the change, what we do not want to burn. You can see it corresponds with sendAmounts[1] on line 566

Instead of sending 10000000000 and catching 9999996989999999999 as change like the send tx, the burn tx just catches 9999996989999999999 as change while destroying the 10000000000 token utxo.

This revision is now accepted and ready to land.Feb 24 2024, 20:03
This revision was automatically updated to reflect the committed changes.