-
Notifications
You must be signed in to change notification settings - Fork 3
feat: chaintracks enpoints #690
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💚 Manual testing by @pawellewandowski98 resulted in success. |
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 adds new HTTP endpoints to the chaintracks service for querying blockchain header information. The changes include refactoring configuration structures, adding new handler endpoints, and improving the service initialization flow.
Key changes:
- Added five new HTTP endpoints for blockchain querying (getInfo, getPresentHeight, findChainTipHashHex, findHeaderHexForHeight, findChainTipHeaderHex)
- Refactored LogConfig from infra package to defs package for better reusability
- Updated Handler to accept a Service instance instead of config, improving dependency management
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/services/chaintracks/models/live_block_header.go | Added LiveOrBulkBlockHeader type alias for unified header handling |
| pkg/services/chaintracks/models/chaintracks_dto.go | Changed Height field from uint32 to uint for consistency |
| pkg/services/chaintracks/mappings.go | Added new mapping function from LiveBlockHeader to BlockHeader DTO |
| pkg/services/chaintracks/gormstorage/chaintracks_storage_default_sqlite.go | Removed unused time import and changed MaxConnectionTime to 0 |
| pkg/services/chaintracks/chaintracks_service.go | Updated service methods to return LiveBlockHeader types instead of ChainBlockHeader |
| pkg/services/chaintracks/chaintracks_server.go | Added context parameter, MakeAvailable call, Service field, and MakeLogger function |
| pkg/services/chaintracks/chaintracks_handler_test.go | Updated test to use new Handler constructor with Service |
| pkg/services/chaintracks/chaintracks_handler.go | Added five new endpoint handlers with GET method constraints |
| pkg/infra/config.go | Moved LogConfig to defs package |
| pkg/defs/logging.go | Added LogConfig struct and related functions from infra package |
| pkg/defs/chaintracks.go | Added Logging field to ChaintracksServerConfig |
| cmd/chaintracks_config_gen/main.go | New command to generate example configuration files |
| cmd/chaintracks/main.go | Refactored main function to load config from file/env and use proper context |
| chaintracks-config.example.yaml | Generated example configuration file |
| .gitignore | Added chaintracks config file patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|



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: