Page MenuHomePhabricator

[ecash-agora] Support full-accept agora partials
ClosedPublic

Authored by bytesofman on Tue, Mar 11, 14:11.

Details

Reviewers
tobias_ruck
Group Reviewers
Restricted Project
Commits
rABCc92a2d2520d0: [ecash-agora] Support full-accept agora partials
Summary

Attempting to create an agora partial with minAcceptedAtoms the same as offeredAtoms will routinely create an unacceptable offer for "large-ish" offeredAtoms (must be above some truncation threshhold, in practice it tends to happen over ~10_000_000_000 atoms)

For this case, we match the quantities on creation to prevent the best-effort calc from creating an unacceptable offer (minAcceptedAtoms exceeding offeredAtoms).

Arguably this type of offer should instead be a one-shot. But either way, we want to prevent the creation of unacceptable offers.

Test Plan

CI tests

Diff Detail

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

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: <Token /> available actions rendered We can list an SLP1 fungible token ======
TestingLibraryElementError: Unable to find an accessible element with the role "button" and name `/List Vespene Gas/`

Here are the accessible roles:

  region:

  Name "Notifications Alt+T":
  <section
    aria-atomic="false"
    aria-label="Notifications Alt+T"
    aria-live="polite"
    aria-relevant="additions text"
    class="Toastify"
  />

  --------------------------------------------------
  combobox:

  Name "":
  <select
    class="sc-crNyjn bXFivV"
    data-testid="wallet-select"
    id="wallets"
    name="wallets"
  />

  --------------------------------------------------
  option:

  Name "Token Test":
  <option
    class="sc-cpHetk jodErs"
    value="Token Test"
  />

  --------------------------------------------------
  button:

  Name "Copy ecash:qqq9f9z3uhpzkxrgdjkd7dxuuey7tmpmugpmnw0kue":
  <button
    aria-label="Copy ecash:qqq9f9z3uhpzkxrgdjkd7dxuuey7tmpmugpmnw0kue"
    class="sc-cJSrbW kZNvLw"
  />

  Name "icon for 20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8":
  <button
    class="sc-hzNEM eBXvVM"
  />

  Name "Click for more info about this token type":
  <button
    aria-label="Click for more info about this token type"
    class="sc-cJSrbW kZNvLw"
  />

  Name "Copy Token ID":
  <button
    aria-label="Copy Token ID"
    class="sc-cJSrbW kZNvLw"
  />

  Name "Click for more info about agora partial sales":
  <button
    aria-label="Click for more info about agora partial sales"
    class="sc-cJSrbW kZNvLw"
  />

  Name "Transactions":
  <button
    class="sc-hycgNl fdpVNO"
  />

  Name "Send Screen":
  <button
    aria-label="Send Screen"
    class="sc-hycgNl fdpVNO"
  />

  Name "Tokens":
  <button
    aria-label="Tokens"
    class="sc-hycgNl fdpVNO"
  />

  Name "Receive":
  <button
    aria-label="Receive"
    class="sc-hycgNl fdpVNO"
  />

  Name "Wallet Backup":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Wallets":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Listed NFTs":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Agora":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Contacts":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Airdrop":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Rewards":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Sign & Verify":
  <button
    class="sc-chAAoq hxqjDv"
  />

  Name "Settings":
  <button
    class="sc-chAAoq hxqjDv"
  />

  --------------------------------------------------
  link:

  Name "XECX":
  <a
    href="/#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
  />

  Name "FIRMA":
  <a
    href="/#/token/0387947fd575db4fb19a3e322f635dec37fd192b5941625b66bc4b2c3008cbf0"
  />

  Name "20a...6f8":
  <a
    href="https://explorer.e.cash/tx/20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8"
    rel="noopener noreferrer"
    target="_blank"
  />

  Name "simple.wikipedia.org/wiki/StarCraft#Gameplay":
  <a
    href="https://simple.wikipedia.org/wiki/StarCraft#Gameplay"
    rel="noreferrer"
    target="_blank"
  />

  --------------------------------------------------
  paragraph:

  Name "Price in Local Currency":
  <p
    class="sc-AnqlK fLVAuQ"
    title="Price in Local Currency"
  />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  Name "":
  <p />

  --------------------------------------------------
  img:

  Name "icon for 20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8":
  <img
    alt="icon for 20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8"
    height="128"
    src="https://icons.etokens.cash/128/20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8.png"
    width="128"
  />

  Name "cashtab":
  <img
    alt="cashtab"
    class="sc-cCbXAZ jOUSPN"
    src="test-file-stub"
  />

  --------------------------------------------------
  heading:

  Name "Vespene Gas":
  <h2 />

  --------------------------------------------------

Ignored nodes: comments, script, style
<body>
  <div>
    <div
      class="sc-keFjpB fuvsSf"
    >
      <section
        aria-atomic="false"
        aria-label="Notifications Alt+T"
        aria-live="polite"
        aria-relevant="additions text"
        class="Toastify"
      />
      <div
        class="sc-jWojfa gOMhPW"
      >
        <div
          class="sc-kVrTmx dSIcDd"
        >
          <div
            class="sc-ivVeuv hQBWoJ"
          >
            <img
              alt="cashtab"
              class="sc-cCbXAZ jOUSPN"
              src="test-file-stub"
            />
          </div>
          <div
            class="sc-cmIlrE ckvYmi"
          >
            <div
              class="sc-jkCMRl gxKbjs"
            >
              <select
                class="sc-crNyjn bXFivV"
                data-testid="wallet-select"
                id="wallets"
                name="wallets"
              >
                <option
                  class="sc-cpHetk jodErs"
                  value="Token Test"
                >
                  Token Test
                </option>
              </select>
              <div
                class="sc-bqjOQT kauMuv"
              >
                <button
                  aria-label="Copy ecash:qqq9f9z3uhpzkxrgdjkd7dxuuey7tmpmugpmnw0kue"
                  class="sc-cJSrbW kZNvLw"
                >
                  <svg
                    title="copy-paste"
                  />
                </button>
                <div
                  class="sc-eerKOB cvXwwv"
                >
                  <div
                    class="sc-emmjRN bSWkUh"
                  >
                    <input
                      checked=""
                      class="sc-gFaPwZ iPJMNd"
                      id="show-hide-balance"
                      name="show-hide-balance"
                      title="show-hide-balance"
                      type="checkbox"
                    />
                    <label
                      class="sc-cpmLhU iUeRKn"
                      for="show-hide-balance"
                    >
                      <span
                        class="sc-dymIpo hGwQkt"
                        data-off=""
                        data-on=""
                      />
                      <span
                        class="sc-bnXvFD cpOMDW"
                      />
                    </label>
                  </div>
                </div>
              </div>
            </div>
            <div
              class="sc-gleUXh fSfkBQ"
              title="Wallet Info"
            >
              <div
                class="sc-nrwXf erXBln"
              >
                <div
                  class="sc-eitiEO isWDMZ"
                  title="Balance XEC"
                >
                  9,970.81
                   
                  XEC
                </div>
                <div
                  class="sc-eitiEO gaHDhC"
                  title="Balance XECX"
                >
                  10,000.00
                   
                  <a
                    href="/#/token/c67bf5c2b6d91cfb46a5c1772582eff80d88686887be10aa63b0945479cf4ed4"
                  >
                    XECX
                  </a>
                </div>
                <div
                  class="sc-eitiEO gaHDhC"
                  title="Balance FIRMA"
                >
                  100.0000
                   
                  <a
                    href="/#/token/0387947fd575db4fb19a3e322f635dec37fd192b5941625b66bc4b2c3008cbf0"
                  >
                    FIRMA
                  </a>
                </div>
              </div>
              <div
                class="sc-bhlBdH kdHsOB"
                title="Balance in Local Currency"
              >
                $
                100.60
                 
                USD
              </div>
              <p
                class="sc-AnqlK fLVAuQ"
                title="Price in Local Currency"
              >
                1 
                XEC
                 = 
                0.00003000
                 
                USD
              </p>
            </div>
          </div>
          <div
            class="sc-dTLGrV eQoClh"
          >
            <div
              class="sc-jKVCRD kVWwbS"
            >
              <div
                class="sc-fcdeBU chTKnN"
                title="Token Stats"
              >
                <div
                  class="sc-RcBXQ kItXmO"
                >
                  <button
                    class="sc-hzNEM eBXvVM"
                  >
                    <img
                      alt="icon for 20a0b9337a78603c6681ed2bc541593375535dcd9979196620ce71f233f2f6f8"
                      height="128"
   ...
    at Object.getElementError (/work/cashtab/node_modules/@testing-library/dom/dist/config.js:37:19)
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:76:38
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:52:17
    at /work/cashtab/node_modules/@testing-library/dom/dist/query-helpers.js:95:19
    at Object.getByRole (/work/cashtab/src/components/Etokens/__tests__/TokenActions.test.js:272:35)

Each failure log is accessible here:
CashTab Unit Tests: <Token /> available actions rendered We can list an SLP1 fungible token

tobias_ruck added inline comments.
modules/ecash-agora/src/partial.ts
447–448 ↗(On Diff #53012)
This revision is now accepted and ready to land.Tue, Mar 11, 15:31