-
Notifications
You must be signed in to change notification settings - Fork 3
feat: live-to-bulk migration & new-tip/reorg callbacks & more config fields & fixes #699
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
Conversation
Manual Testsℹ️ Remember to ask team members to perform manual tests and to assign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements live-to-bulk header migration, new tip/reorg event callbacks, additional configuration fields, and various bug fixes for the Chaintracks service.
- Adds a pub/sub event system for broadcasting new chain tip headers and reorganization events to subscribers
- Implements automatic migration of live headers to bulk storage when threshold is exceeded
- Introduces configurable
AddLiveRecursionLimitandLiveHeightThresholdparameters to control header synchronization behavior
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/services/chaintracks/models/storage_queries.go | Adds interface methods for querying and deleting live headers by height and IDs |
| pkg/services/chaintracks/models/reorg_event.go | Defines ReorgEvent model for chain reorganization notifications |
| pkg/services/chaintracks/internal/pub_sub_events.go | Implements generic pub/sub event system for broadcasting events to multiple subscribers |
| pkg/services/chaintracks/internal/cacheable_with_ttl.go | Adds Invalidate method to clear cached values on demand |
| pkg/services/chaintracks/gormstorage/storage_queries.go | Implements database queries for finding and deleting live headers |
| pkg/services/chaintracks/chaintracks_service.go | Adds live-to-bulk migration logic, reorg/tip event publishing, and uses new config fields |
| pkg/services/chaintracks/chaintracks_handler.go | Improves error handling by returning 404 for not-found errors |
| pkg/services/chaintracks/bulk_manager.go | Updates methods to accept liveHeightThreshold parameter and adds MigrateFromLiveHeaders function |
| pkg/services/chaintracks/bulk_headers_container.go | Changes error handling to return nil instead of error for out-of-bounds header lookups |
| pkg/defs/chaintracks.go | Adds AddLiveRecursionLimit and LiveHeightThreshold config fields with validation |
| cmd/chaintracks/main.go | Demonstrates usage of new subscription APIs for tip headers and reorg events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
|



Description of Changes
Provide a brief description of the changes you've made.
Linked Issues / Tickets
Reference any related issues or tickets, e.g. "Closes #123".
Testing Procedure
Describe the tests you've added or any testing steps you've taken.
Checklist: