Page MenuHomePhabricator

[chronik-client] Support new tokenId endpoints
ClosedPublic

Authored by bytesofman on Feb 20 2024, 23:04.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Commits
rABC566d272e3f7b: [chronik-client] Support new tokenId endpoints
Summary

T3441

Support endpoints introduced by D15386

Add Token key to Utxo_InNode, used by these endpoints and others

Test Plan

CI or see D14915

Diff Detail

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

Event Timeline

Add more tests, need to refine and work out history() test at end

Failed tests logs:

====== Get blocktxs, txs, and history for ALP token txs: Can all tx history from tokenId.history().Get blocktxs, txs, and history for ALP token txs Can all tx history from tokenId.history() ======
AssertionError: expected undefined to deeply equal { …(12) }
    at /work/modules/chronik-client/test/integration/token_alp.ts:1061:47
    at Generator.next (<anonymous>)
    at fulfilled (test/integration/token_alp.ts:31:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

      + expected - actual:  failed to generate Mocha diff

Each failure log is accessible here:
Get blocktxs, txs, and history for ALP token txs: Can all tx history from tokenId.history().Get blocktxs, txs, and history for ALP token txs Can all tx history from tokenId.history()

bytesofman edited the test plan for this revision. (Show Details)

Failed tests logs:

====== Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 child genesis tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 child genesis tx from the mempool" ======
Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/work/modules/chronik-client/test/integration/token_slp_nft1.ts)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)

Each failure log is accessible here:
Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 child genesis tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 child genesis tx from the mempool"

modules/chronik-client/test/integration/token_alp.ts
1080 ↗(On Diff #45435)

todo work out why the order is different here vs the confirmed ones

bytesofman added a subscriber: tobias_ruck.
bytesofman added inline comments.
modules/chronik-client/test/integration/token_alp.ts
716 ↗(On Diff #45451)

Here it happens to be reverse alphabetical, but in other places it is not

In all cases, the order we get repeats from test to test. I am not sure what the order is though.

It is not broadcast order as the genesis tx is not last or first. See other inline comments for better datasets.

1147 ↗(On Diff #45451)

here is the order we get for confirmed txs from a tokenId(<tokenId>).history() call

not reverse broadcast order

  • genesis tx is 2nd to last and not last
  • alpSendTxid is out of order with alpMultiTxid

not alphabetical order

  • alpMegaTxid is alphabetically before other txs

I am not sure what the order is. @tobias_ruck is there an expected order here?

1267 ↗(On Diff #45451)

We see ordering by blockheight. Ordering within blocks is determinate but I am not able to tell the pattern.

will update comments on expected order

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

Update comments and ordering tests

Failed tests logs:

====== Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool" ======
Error: Timeout of 20000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/work/modules/chronik-client/test/integration/token_slp_nft1.ts)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)

Each failure log is accessible here:
Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool"

rebase and bump mocha timeout

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
Fabien added inline comments.
modules/chronik-client/src/ChronikClientNode.ts
1177 ↗(On Diff #45459)

This is no longer true, it's not present for utxos. Not sure if that's better, is that consistent with other fields returned by the library ?

modules/chronik-client/test/integration/token_alp.ts
1117 ↗(On Diff #45459)
bytesofman marked 2 inline comments as done.

improve comments on interface definition, fix typo in test

modules/chronik-client/src/ChronikClientNode.ts
1177 ↗(On Diff #45459)

We could keep it here and always return entryIdx: -1 for utxos, which is what we get from chronik. But the -1 seems to be there just to inform the user that there is no tokenEntry key of arrays to get this data from.

Since the -1 is useless in utxos, I figured it would be better to simply exclude it. We do something similar with fields that are occasionally expected to be undefined (i.e., simply omitting the keys in what chronik-client returns).

Updated the comment

Failed tests logs:

====== Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool" ======
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/work/modules/chronik-client/test/integration/token_slp_nft1.ts)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)

Each failure log is accessible here:
Get blocktxs, txs, and history for SLP NFT1 token txs: "before each" hook for "Gets an SLP NFT1 send tx from the mempool".Get blocktxs, txs, and history for SLP NFT1 token txs "before each" hook for "Gets an SLP NFT1 send tx from the mempool"

bump mocha timeout to match py testrunner timeout

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
This comment was removed by emack.
PiRK added a subscriber: PiRK.

Code looks good and test coverage seems enough, I just pointed to two nits.

modules/chronik-client/test/integration/token_alp.ts
1113 ↗(On Diff #45483)

missing verb

test/functional/setup_scripts/chronik-client_token_alp.py
344 ↗(On Diff #45483)

leftover debugging commented code

This revision is now accepted and ready to land.Feb 23 2024, 13:58
This revision was automatically updated to reflect the committed changes.
bytesofman marked 2 inline comments as done.