Page MenuHomePhabricator

[chronik-client] Add support for tx finalization/invalidation
ClosedPublic

Authored by Fabien on Aug 12 2025, 15:29.

Details

Summary

Handle the new enum and the optional finalization reason field from Chronik.

Test Plan
npm run integration-tests

Diff Detail

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

Event Timeline

Fabien requested review of this revision.Aug 12 2025, 15:29

Tail of the build log:

6 vulnerabilities (1 low, 3 moderate, 1 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
CI not configured to test build.

> chronik-client@3.4.0 test
> mocha -r ts-node/register test/test.ts --reporter mocha-junit-reporter --reporter-options mochaFile=test_results/junit_results_chronik-client.xml --reporter-options testsuitesTitle=Chronik Client Unit Tests --reporter-options rootSuiteTitle=Chronik Client


Error: Cannot find module '../src/ChronikClient'
    at Function.<anonymous> (node:internal/modules/cjs/loader:1365:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/work/modules/chronik-client/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at internalRewire (/work/modules/chronik-client/node_modules/rewire/lib/rewire.js:23:25)
    at rewire (/work/modules/chronik-client/node_modules/rewire/lib/index.js:11:12)
    at Object.<anonymous> (/work/modules/chronik-client/test/test.ts:13:35)
    at Module._compile (node:internal/modules/cjs/loader:1688:14)
    at Module.replacementCompile (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:60:13)
    at Module.m._compile (/work/modules/chronik-client/node_modules/ts-node/src/index.ts:1618:23)
    at module.exports (/usr/lib/node_modules/nyc/node_modules/default-require-extensions/js.js:7:9)
    at /usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4
    at require.extensions.<computed> (/work/modules/chronik-client/node_modules/ts-node/src/index.ts:1621:12)
    at Object.<anonymous> (/usr/lib/node_modules/nyc/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1423:32)
    at Function._load (node:internal/modules/cjs/loader:1246:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1445:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.exports.requireOrImport (/work/modules/chronik-client/node_modules/mocha/lib/nodejs/esm-utils.js:60:20)
    at async Object.exports.loadFilesAsync (/work/modules/chronik-client/node_modules/mocha/lib/nodejs/esm-utils.js:103:20)
    at async singleRun (/work/modules/chronik-client/node_modules/mocha/lib/cli/run-helpers.js:125:3)
    at async Object.exports.handler (/work/modules/chronik-client/node_modules/mocha/lib/cli/run.js:374:5)
-------------------|---------|----------|---------|---------|---------------------------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                     
-------------------|---------|----------|---------|---------|---------------------------------------
All files          |    4.46 |     0.68 |    1.44 |    4.34 |                                       
 proto             |    4.02 |     0.69 |    1.55 |    4.05 |                                       
  chronik.ts       |    4.02 |     0.69 |    1.55 |    4.05 | ...6705,6710-6749,6757-6862,6866-6875 
 src               |    12.1 |        0 |       0 |    9.39 |                                       
  failoverProxy.ts |    5.35 |        0 |       0 |     5.5 | 26-43,56-335                          
  validation.ts    |   28.88 |        0 |       0 |      20 | 14-49,54-55,62-63,70-71,81-96         
-------------------|---------|----------|---------|---------|---------------------------------------

##teamcity[blockOpened name='Code Coverage Summary']
##teamcity[buildStatisticValue key='CodeCoverageAbsBCovered' value='128']
##teamcity[buildStatisticValue key='CodeCoverageAbsBTotal' value='2865']
##teamcity[buildStatisticValue key='CodeCoverageAbsRCovered' value='14']
##teamcity[buildStatisticValue key='CodeCoverageAbsRTotal' value='2051']
##teamcity[buildStatisticValue key='CodeCoverageAbsMCovered' value='7']
##teamcity[buildStatisticValue key='CodeCoverageAbsMTotal' value='483']
##teamcity[buildStatisticValue key='CodeCoverageAbsLCovered' value='123']
##teamcity[buildStatisticValue key='CodeCoverageAbsLTotal' value='2834']
##teamcity[blockClosed name='Code Coverage Summary']
Build chronik-client-tests failed with exit code 1
Fabien planned changes to this revision.Aug 12 2025, 15:42

Investigating CI failure

Rebase to fix build issue

bytesofman added a subscriber: bytesofman.
bytesofman added inline comments.
modules/chronik-client/test/integration/websocket.ts
845–846 ↗(On Diff #55221)

I think we are already subscribed to this from the "New regtest chain" initial step, can lose this

but prob no negative consequences from double subscribing. expected behavior of this is no error, no change in behavior

We "unsubscribe" from it but only to confirm that subscribing to the address gives us the same results

// Unsubscribe from p2pkh script, and resubscribe to it as address,
// to confirm the sub is active in the same was as the script sub
// in later steps
ws.unsubscribeFromScript('p2pkh', p2pkhHash);
ws.subscribeToAddress(p2pkhAddress);
This revision is now accepted and ready to land.Aug 13 2025, 13:09
modules/chronik-client/test/integration/websocket.ts
832 ↗(On Diff #55221)

here

845–846 ↗(On Diff #55221)

we unsubscribed from all in the previous step

modules/chronik-client/test/integration/websocket.ts
845–846 ↗(On Diff #55221)

👍