Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement indexer with multi-endpoint support and reliable fork tracking #8

Merged
merged 18 commits into from
Aug 23, 2023

Conversation

pk910
Copy link
Member

@pk910 pk910 commented Aug 23, 2023

This PR re-implements the indexer related code in a much more structured and cleaner way.
The new indexer supports multiple endpoints (CL Nodes), that are used in parallel to keep track of the chain.

Incoming block events from all connected nodes are processed in the central indexer cache.
Corresponding block headers/bodies are loaded from the first node that sees them.

That way the explorer can reliably keep track of the chain - even in case of chain splits caused by consensus problems.

The persistent orphaned block detections & epoch stats aggregations are processed once epochs are getting finalized.
To achieve this, the indexer needs to keep track of all unfinalized blocks in memory. To avoid running out of memory during long non-finalization periods, block bodies are moved into a separate db table after inMemoryEpochs epochs, so only the block header is kept in memory.

The orphaned block detection & epoch aggregation for unfinalized epochs are processed on the fly when requested.

This PR mostly does backend changes only, so there is no difference from UI side.
There are further PRs coming to display the new fork related information the indexer is providing.

@pk910 pk910 merged commit a2e66c8 into master Aug 23, 2023
3 checks passed
@pk910 pk910 deleted the forkmon branch August 23, 2023 05:55
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.

1 participant