Skip to content

Conversation

@Cordtus
Copy link

@Cordtus Cordtus commented Dec 5, 2025

Description

This PR extends the GetSyncingResponse in cosmos.base.tendermint.v1beta1.Service to include block height information that is essential for indexers and tooling.

Problem

Indexers need to know which blocks are available on a node before attempting to fetch them. Currently, this information is only available via CometBFT's /status RPC endpoint (sync_info.earliest_block_height), requiring clients to query two different endpoints.

When an indexer tries to fetch a pruned block, it gets an error like:

height 60 is not available, lowest height is 28566001

Discovering available block heights proactively via gRPC would be more efficient.

Solution

Add two new fields to GetSyncingResponse:

  • earliest_block_height - The earliest block height available on this node
  • latest_block_height - The latest block height available on this node

These fields expose the same information as CometBFT's SyncInfo struct, making it available via the existing gRPC endpoint without requiring a separate RPC call.

Changes

File Change
proto/cosmos/base/tendermint/v1beta1/query.proto Add new fields to GetSyncingResponse
client/grpc/cmtservice/query.pb.go Generated code with new fields
client/grpc/cmtservice/service.go Populate new fields from SyncInfo

API

message GetSyncingResponse {
  bool syncing = 1;
  int64 earliest_block_height = 2;  // NEW
  int64 latest_block_height = 3;    // NEW
}

Backward Compatibility

This is a non-breaking change - it only adds new optional fields to an existing response message. Existing clients will continue to work unchanged.

Use Case

// Before: Need to query CometBFT RPC separately
status, _ := rpcClient.Status(ctx)
earliest := status.SyncInfo.EarliestBlockHeight

// After: Available via gRPC
resp, _ := cmtClient.GetSyncing(ctx, &GetSyncingRequest{})
earliest := resp.EarliestBlockHeight

@github-actions github-actions bot added the C:CLI label Dec 5, 2025
@Cordtus Cordtus marked this pull request as draft December 5, 2025 18:45
@Cordtus Cordtus force-pushed the feat/earliest-block-height-grpc branch from c24cdcc to b6db48e Compare December 5, 2025 18:45
Extend the GetSyncingResponse in cosmos.base.tendermint.v1beta1.Service
to include earliest_block_height and latest_block_height fields.

This enables gRPC clients (like indexers) to discover block availability
without needing to query the CometBFT RPC separately. The fields expose
the same information as the /status RPC endpoint's sync_info.

Changes:
- Add earliest_block_height field to GetSyncingResponse proto
- Add latest_block_height field to GetSyncingResponse proto
- Update service implementation to populate new fields from SyncInfo
@Cordtus Cordtus force-pushed the feat/earliest-block-height-grpc branch from b6db48e to dc48552 Compare December 6, 2025 00:11
@Cordtus Cordtus marked this pull request as ready for review December 6, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant