-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(grpc): return actual earliest_store_height in node.Status endpoint #25647
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
|
Would love to get this backported to 0.50.x. It would enable fixing manifest-network/yaci#28 |
|
This seems like a nice feature but will need more extensive testing such as using |
Add EarliestVersion() method to MultiStore interface to enable querying the earliest available state height. This is essential for indexers and tooling that need to know which heights a pruned node can serve. Changes: - Add EarliestVersion() to MultiStore interface - Implement in rootmulti.Store with persistent storage - Track earliest version after pruning in PruneStores() - Add panic impl in cachemulti.Store (matches LatestVersion) - Update Status gRPC endpoint to return actual EarliestStoreHeight - Add unit tests for EarliestVersion functionality Closes: cosmos#15463
The gRPC query context provides a CacheMultiStore which panics on EarliestVersion(). Fix by passing the root CommitMultiStore directly to the node service and using it for the EarliestStoreHeight field.
Needed for EarliestVersion implementation in the store module.
Tests earliest_store_height field in the node.Status gRPC endpoint: - Basic test verifies valid heights are returned - Stability test confirms earliest height remains stable on unpruned chain - Pruning test verifies earliest_store_height increases after state pruning
e7384c5 to
eaa696a
Compare
|
Added systemtest for the
Also updated the service to use Run locally: make build && cp build/simd tests/systemtests/binaries/
cd tests/systemtests && go test -tags system_test -v -run TestNodeStatus |
Add EarliestVersion() method to msWrapper in blockstm and multiStore in server/mock to satisfy the updated MultiStore interface. Also add store module replace directive to tests/go.mod to use local store module with EarliestVersion implementation.
|
@aljo242 is there anything blocking this PR? |
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.