Page MenuHomePhabricator

[chronik-client] Add support for ws block extra data
ClosedPublic

Authored by Fabien on Sep 25 2024, 11:33.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABC7ba221cf30a6: [chronik-client] Add support for ws block extra data
Summary

Add support for the avalanche invalidated ws block message type,
return the block timestamp and the coinbase data when applicable.

Test Plan
npm run integration-tests

Event Timeline

Fabien requested review of this revision.Sep 25 2024, 11:33
bytesofman added a subscriber: bytesofman.
bytesofman added inline comments.
modules/chronik-client/package.json
3

we also want to bump this value in package-lock.json

the best way to handle this is, before manually changing any version numbers, run

npm version minor from modules/chronik-client

this will update package.json and package-lock.json

modules/chronik-client/proto/chronik.ts
211

was this file generated by npm run build-proto ?

modules/chronik-client/src/ChronikClient.ts
965

imo the API would be improved if the coinbaseData key were omitted for cases where it is undefined

this is how chronik-client handles other keys that are defined/undefined in some cases.

To do this, need to build this onMessage object -- then conditionally add the coinbaseData key if it is present.

See for example the convertToTx function in this file, which only includes block if the tx is confirmed.

1886

mb redundant to use coinbaseOutputs and coinbaseScriptsig inside CoinbaseData?

why not

export interface CoinbaseData {
   scriptsig: string;
   outputs: TxOutput[];
}

not a blocker

This revision now requires changes to proceed.Sep 25 2024, 16:49
modules/chronik-client/proto/chronik.ts
211

yes

modules/chronik-client/src/ChronikClient.ts
1886

sure, makes sense

Simplify names, dismiss the key instead of nullifying

This revision is now accepted and ready to land.Sep 25 2024, 23:38