Skip to content

Conversation

@RogerKSI
Copy link
Member

Implementation details

  • get only header of block instead of the whole block for block timestamp.

Please ensure the following requirements are met before submitting a pull request:

  • The pull request is targeted against the correct target branch
  • The pull request is linked to an issue with appropriate discussion and an accepted design OR is linked to a spec that describes the work.
  • The pull request includes a description of the implementation/work done in detail.
  • The pull request includes any and all appropriate unit/integration tests
  • You have added a relevant changelog entry to CHANGELOG_UNRELEASED.md
  • You have re-reviewed the files affected by the pull request (e.g. using the Files changed tab in the Github PR explorer)

Copy link

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 optimizes block data retrieval by fetching only block headers instead of full blocks when extracting block timestamps. This is a performance improvement that reduces network overhead and data transfer since only the header information is needed.

Changes:

  • Replaced GetBlock method with GetHeaderBlock to retrieve only block headers
  • Updated error messages and alert constants to reflect the new method name
  • Updated mocks to match the new interface

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
relayer/chains/evm/provider.go Updated to call GetHeaderBlock instead of GetBlock and access header.Time field directly
relayer/chains/evm/client.go Renamed method from GetBlock to GetHeaderBlock, changed return type from *Block to *Header, and updated to use HeaderByNumber
relayer/alert/alert.go Updated alert constant from GetBlockErrorMsg to GetHeaderBlockErrorMsg
internal/relayertest/mocks/chain_evm_client.go Updated mock implementation to reflect the interface change from GetBlock to GetHeaderBlock

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RogerKSI RogerKSI merged commit 1d95991 into main Jan 28, 2026
2 checks passed
@RogerKSI RogerKSI deleted the get-only-header-block branch January 28, 2026 06:28
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.

4 participants