Skip to content

Conversation

@chris-4chain
Copy link
Collaborator

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.

  • I have added new unit tests
  • All tests pass locally
  • I have tested manually in my local environment

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have run the linter

@chris-4chain chris-4chain requested a review from Copilot November 27, 2025 10:59
@github-actions
Copy link
Contributor

Manual Tests

ℹ️ Remember to ask team members to perform manual tests and to assign tested label after testing.

Copy link
Contributor

Copilot AI left a 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 AddLiveRecursionLimit and LiveHeightThreshold parameters 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.

@sonarqubecloud
Copy link

@chris-4chain chris-4chain merged commit 42c8ad9 into main Nov 27, 2025
10 checks passed
@chris-4chain chris-4chain deleted the feat/chaintracks-migrate-live-to-bulk branch November 27, 2025 16:44
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.

[FEATURE] internalizeAction MVP on sql storage

4 participants