add a work pool to fetch check points - #473
Closed
FelixFan1992 wants to merge 7 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR speeds up chain catch-up by fetching checkpoint data in parallel (while still committing checkpoints in-order) and reduces per-checkpoint DB work in the TransactionsIndexer by caching the decoded transmitter set from the latest ConfigSet event.
Changes:
- Add a concurrent fetch stage to
ChainPoller.catchUp, committing checkpoints strictly in sequence order. - Add a transmitter cache (TTL + “refresh grace” window) to avoid re-querying/re-decoding
ConfigSeton every checkpoint. - Optimize event filtering by precomputing normalized selector type strings; add/adjust unit tests for the new behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| relayer/chainreader/indexer/transactions_indexer.go | Adds transmitter caching and invalidation based on seeing ConfigSet in a checkpoint batch. |
| relayer/chainreader/indexer/transactions_indexer_unit_test.go | Adds a unit test for detecting ConfigSet presence within a checkpoint batch. |
| relayer/chainreader/indexer/chain_poller.go | Introduces concurrent checkpoint fetching for catch-up, splits fetch vs commit, and optimizes event filtering comparisons. |
| relayer/chainreader/indexer/chain_poller_test.go | Makes catch-up tests concurrency-safe (mutex + order-independent assertions). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
relayer/chainreader/indexer/transactions_indexer.go:557
- getTransmitters() documents that callers should not be able to mutate the shared transmitter cache, but on a cache miss it returns the slice from fetchTransmitters() directly. That slice can be mutated by the caller and diverge from the cached copy, and it also violates the function comment.
return transmitters, nil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe your changes
Issue ticket number and link
Describe highly relevant files or code snippets that are critical in the review
Are there other PRs that should be merged first?