fix(grpc): return actual earliest_store_height in node.Status endpoint #25647
+269
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes: #15463
This PR implements the
EarliestVersion()method on theMultiStoreinterface to enable querying the earliest available state height. This addresses the longstanding TODO in the Status gRPC endpoint that was returning0forEarliestStoreHeight.Problem
Indexers and tooling need to know which heights a pruned node can serve queries for. Currently:
earliest_block_heightin Tendermint's STATUS RPC returns the earliest block, not the earliest stateEarliestStoreHeightfield incosmos.base.node.v1beta1.Statuswas hardcoded to0Solution
EarliestVersion() int64to theMultiStoreinterfacerootmulti.Store:s/earliestkey1for unpruned chainsPruneStores()cachemulti.Store(consistent withLatestVersion())Changes
store/types/store.goEarliestVersion()toMultiStoreinterfacestore/rootmulti/store.goEarliestVersion(),GetEarliestVersion(),flushEarliestVersion()store/cachemulti/store.goclient/grpc/node/service.goEarliestVersion()instead of hardcoded0store/rootmulti/store_test.goTesting
TestEarliestVersion- basic functionality, default valueTestEarliestVersionWithPruning- tracks updates after pruningTestEarliestVersionPersistence- persists across restartsAPI Changes
This is a breaking change for any code implementing the
MultiStoreinterface - they must now implementEarliestVersion() int64.