-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(grpc): add earliest/latest block height to GetSyncing response #25648
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
base: main
Are you sure you want to change the base?
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 70.40% 70.43% +0.03%
==========================================
Files 830 830
Lines 54050 54052 +2
==========================================
+ Hits 38052 38070 +18
+ Misses 15998 15982 -16
🚀 New features to boost your workflow:
|
Signed-off-by: Evan Etton <[email protected]>
…5659) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: aljo242 <[email protected]>
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 |
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