Page MenuHomePhabricator

[chronik-client] Support history, confirmedTxs, unconfirmedTxs for plugins endpoints
ClosedPublic

Authored by bytesofman on Sep 18 2024, 23:36.

Details

Summary

Depends on D16783

Support endpoints added to chronik in D16708

The test setup script is updated to reflect the change, and tests are added in line with what is confirmed in the setup script.

Test Plan

CI tests

Event Timeline

bytesofman added inline comments.
modules/chronik-client/test/integration/plugins.ts
634 ↗(On Diff #49728)

I took this sorting from the existing chronik-client tests in script_endpoints.ts

It's not what is being tested in the setup script:

txs = sorted([proto_tx1, proto_tx2], key=lambda t: t.txid[::-1])

which then matches confirmed txs, and matches the reverse of history

...I don't think history is just alphabetical backwards by txid, which I think is what the setup script is testing? Either the setup script or this test is using a sort that "happens to work"

emack added inline comments.
modules/chronik-client/test/integration/plugins.ts
634 ↗(On Diff #49728)

if you remove the sort by txid logic above, do the tests still pass?

modules/chronik-client/test/integration/plugins.ts
634 ↗(On Diff #49728)

lol mb but the point is we want to show that the txs are sorted the way they are expected to be sorted.

[first Tx, secondTx] might just happen to be "the right way" ... it's hard to tell with only 2 txs

I know the tests pass if I follow what is tested in the setup script, i.e. "alphabetical by txid and then the opposite of that" ... but I don't think there is any reason for the indexer to return "opposite of alphabetical by txid" -- so either

  • I am misreading the sort in the setup script, or
  • I am applying the wrong sort on the expected order, or
  • the sorting in the setup script "happens to work" but reverse alphabetical isn't really how chronik sorts things
tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
modules/chronik-client/test/integration/plugins.ts
634 ↗(On Diff #49728)

in this test the timeFirstSeen is the same for both so I didn't add it to the lambda

it's more about the txs being there; the right order should be tested in the script_group tests

703 ↗(On Diff #49728)

any reason to remove the const? it should just shadow correctly

I try to avoid mutable variables with big scopes

This revision now requires changes to proceed.Sep 19 2024, 09:14

ok updated sorting with comment, removed globals

modules/chronik-client/test/integration/plugins.ts
703 ↗(On Diff #49728)

fixed

when I started the test, I didn't realize these would change between scopes

bytesofman marked an inline comment as done.

explain sorting, remove global tx objects from plugins tests

remove py script comments from plugins.ts, improve comments

This revision is now accepted and ready to land.Sep 19 2024, 16:28
This revision was landed with ongoing or failed builds.Sep 19 2024, 16:29
This revision was automatically updated to reflect the committed changes.