feat(grpc): add earliest/latest block height to GetSyncing response#25648
feat(grpc): add earliest/latest block height to GetSyncing response#25648aljo242 merged 19 commits intocosmos:mainfrom
Conversation
c24cdcc to
b6db48e
Compare
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
b6db48e to
dc48552
Compare
|
This would be useful for manifest-network/yaci#28 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25648 +/- ##
==========================================
+ Coverage 66.50% 68.20% +1.69%
==========================================
Files 929 894 -35
Lines 60231 58146 -2085
==========================================
- Hits 40058 39658 -400
+ Misses 20173 18488 -1685
🚀 New features to boost your workflow:
|
Signed-off-by: Evan Etton <evanettoneva@gmail.com>
…5659) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: aljo242 <alex@cosmoslabs.io>
Add systemtest coverage for the GetSyncing gRPC endpoint to verify earliest_block_height and latest_block_height fields work correctly. Tests include: - Basic gRPC connectivity and field validation - latest_block_height increases over time - earliest_block_height stable on unpruned chain - Block pruning scenario: configures min-retain-blocks=5 and max_age_num_blocks=5 in genesis to trigger actual pruning, verifying earliest_block_height increases as blocks are pruned
|
Added a systemtest. Run with: The pruning test configures |
|
@aljo242 is there anything blocking this PR? |
|
Bump. Would like to be sure there is nothing else needed from my end here. |
|
@technicallyty to review this |
|
needs go mod tidy and changelog |
|
@Cordtus looks like you need to run |
…osmos#25648) Signed-off-by: Evan Etton <evanettoneva@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io> Co-authored-by: Evan Etton <evanettoneva@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
|
@aljo242 @technicallyty -- could the |
|
@mergify backport release/v0.53.x |
✅ Backports have been createdDetails
Cherry-pick of 174b2e9 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
…25648) Signed-off-by: Evan Etton <evanettoneva@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io> Co-authored-by: Evan Etton <evanettoneva@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com> (cherry picked from commit 174b2e9) # Conflicts: # CHANGELOG.md # go.mod # go.sum # tests/systemtests/go.mod
Description
Ref: #15463
This PR extends the
GetSyncingResponseincosmos.base.tendermint.v1beta1.Serviceto 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
/statusRPC 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:
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 nodelatest_block_height- The latest block height available on this nodeThese fields expose the same information as CometBFT's
SyncInfostruct, making it available via the existing gRPC endpoint without requiring a separate RPC call.Changes
proto/cosmos/base/tendermint/v1beta1/query.protoGetSyncingResponseclient/grpc/cmtservice/query.pb.goclient/grpc/cmtservice/service.goSyncInfotests/systemtests/cometbft_service_test.goAPI
Testing
Systemtest added (
TestCometBFTGetSyncingGRPCandTestCometBFTGetSyncingWithBlockRetention) that:latest_block_heightincreases over timeearliest_block_heightis stable on unpruned chainsmin-retain-blocks=5andmax_age_num_blocks=5(in genesis), then confirmsearliest_block_heightincreases as blocks are prunedThe pruning test required modifying both
app.toml(viaEditToml) and genesis params (viaModifyGenesisJSON) because CometBFT's block retention is the minimum ofmin-retain-blocksandmax_age_num_blocks. Defaultmax_age_num_blocks=100000would prevent pruning in tests.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