Skip to content

Conversation

@peterbroadhurst
Copy link
Contributor

@peterbroadhurst peterbroadhurst commented Jan 5, 2026

This PR pulls the BlockListener out into a separate package for re-use, as part of indexing workflows.

This is a useful utility that tracks the head of an Ethereum chain, and keeps an in-memory canonical chain that extends back a pre-set number of "unstable" blocks (say 100).

If any changes are detected in this head, then the consumer is notified not just of the block, but of the consistent set of blocks ahead of that up to the new head. By processing this set of hashes as a single unit, rather than many individual events, logic that deals with confirmation management is able to be optimized.

The utility also allows multiple consumers within a single go process, to share a single stream of these changes.

Breakdown of proposed change

  • Adding a pkg dir to firelfy-evmconnect
  • Making the new ethblocklistener package available there
  • Defining etherrors and ethrpc packages alongside for the core JSON/RPC data types and error mapping code
  • Adding JSONFormatOptions to ethrpc so those structures can be serialized in more app friendly ways
    • Builds on abi.Serializer in firefly-signer
    • Provides a JSON Query style interface to build a single formatter
    • Same formatter can be used for formatting the JSON objects, as well as the ABI parsed data
  • Minor refactors to interfaces between components
  • Test enhancements and simplification

@peterbroadhurst peterbroadhurst changed the title Standalone blocklistener Make BlockListener a public package for re-use Jan 5, 2026
@peterbroadhurst peterbroadhurst marked this pull request as ready for review January 6, 2026 12:22
@peterbroadhurst peterbroadhurst requested a review from a team as a code owner January 6, 2026 12:22
@peterbroadhurst peterbroadhurst marked this pull request as draft January 6, 2026 12:22
…ion checking more intuitive

Signed-off-by: Peter Broadhurst <[email protected]>
@peterbroadhurst peterbroadhurst force-pushed the standalone-blocklistener branch from 4f4cab8 to 2571505 Compare January 6, 2026 12:48
@peterbroadhurst peterbroadhurst marked this pull request as ready for review January 6, 2026 12:57
@peterbroadhurst peterbroadhurst marked this pull request as draft January 6, 2026 13:03
@peterbroadhurst peterbroadhurst force-pushed the standalone-blocklistener branch from 5e9b30f to eeb5b99 Compare January 7, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants