Re-implement indexer with multi-endpoint support and reliable fork tracking #8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.