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 20, 2025 10:08
@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

Manual Tests

💚 Manual testing by @pawellewandowski98 resulted in success.

Copilot finished reviewing on behalf of chris-4chain November 20, 2025 10:10
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 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.

@sonarqubecloud
Copy link

@pawellewandowski98 pawellewandowski98 added the tested PR was tested by a team member label Nov 20, 2025
@chris-4chain chris-4chain merged commit f53b0cf into main Nov 20, 2025
11 checks passed
@chris-4chain chris-4chain deleted the feat/chaintracks-enpoints branch November 20, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tested PR was tested by a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] internalizeAction MVP on sql storage

4 participants