Skip to content

feat: add IndexerSnapshot WebSocket support for RCManager#287

Closed
ezeike wants to merge 3 commits intomainfrom
indexer-websocket-snapshots
Closed

feat: add IndexerSnapshot WebSocket support for RCManager#287
ezeike wants to merge 3 commits intomainfrom
indexer-websocket-snapshots

Conversation

@ezeike
Copy link
Contributor

@ezeike ezeike commented Jan 6, 2026

Summary

  • Adds buildIndexerSnapshot method to RCManager for building comprehensive state snapshots
  • Adds IndexerSnapshot protobuf message in block.proto for wire format
  • Adds new /v1/subscribe-block-data WebSocket endpoint for streaming block data
  • Integrates PublishBlockData into block commit flow to broadcast snapshots automatically
  • Uses protobuf serialization (not JSON) for WebSocket transport
  • Adds SellOrder.IsLocked(), SellOrder.Copy(), and OrderBook.Copy() helper methods
  • Adds warning logs for error handling in buildIndexerSnapshot

New WebSocket Endpoint

GET /v1/subscribe-block-data - Streams IndexerSnapshot data to connected clients

  • Sends initial snapshot on connection
  • Broadcasts updated snapshot on each block commit
  • Supports multiple concurrent subscribers
  • Uses same lifecycle management (ping/pong, timeouts) as existing RC info endpoint

Data Included in IndexerSnapshot

  • Block, transactions, events
  • Accounts, validators, pools
  • Orders, DEX prices, DEX batches
  • Committee data, non-signers, double signers
  • Change detection pairs (current + H-1) for efficient indexing

@ezeike ezeike force-pushed the indexer-websocket-snapshots branch from 999b2b1 to a6dad68 Compare January 6, 2026 20:52
- Add controller reference to RCManager for state access
- Add buildIndexerSnapshot method to create state snapshots
- Define IndexerSnapshot and DexPrice proto messages for efficient
  binary serialization over WebSocket

🏷️ feat: add IndexerSnapshot proto message and extract swap methods

- Define IndexerSnapshot message in block.proto for WebSocket streaming
- Extract SellOrder.IsLocked, SellOrder.Copy, OrderBook.Copy to swap_ext.go
  to prevent loss during proto regeneration
@ezeike ezeike force-pushed the indexer-websocket-snapshots branch from a6dad68 to 09aa073 Compare January 6, 2026 21:52
ezeike added 2 commits January 6, 2026 23:29
Replace silent error suppression with warning logs for all data
fetching and marshaling operations in buildIndexerSnapshot. This
improves debuggability while maintaining the non-fatal behavior
where errors result in nil values rather than function failure.
Add /v1/subscribe-block-data WebSocket endpoint that streams
IndexerSnapshot data to connected clients on each block commit.

- Add BlockDataSubscriber struct and lifecycle management
- Add PublishBlockData method to RCManagerI interface
- Hook PublishBlockData into CommitCertificate flows
- Send initial snapshot when clients connect
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