fix(grpc): return actual earliest_store_height in node.Status endpoint#25647
fix(grpc): return actual earliest_store_height in node.Status endpoint#25647technicallyty merged 11 commits intocosmos:mainfrom
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 |
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 |
|
@aljo242 is there anything blocking this PR? |
|
Bump. Would like to be sure there is nothing else needed from my end here. |
|
@aljo242 is there anything I can do to help this one along? |
995a18e to
1172c68
Compare
|
@technicallyty to review this |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25647 +/- ##
==========================================
- Coverage 68.23% 68.19% -0.04%
==========================================
Files 910 910
Lines 59147 59177 +30
==========================================
- Hits 40358 40357 -1
- Misses 18789 18820 +31
🚀 New features to boost your workflow:
|
i'm fine with merging this with systemtests, but i would like to use systemtest more sparingly in the future. systest runs a local 4 node network, which is not necessary for queries like this. an e2e integration test is more than enough for these types of PRs |
4f40612 to
5c4a042
Compare
Add EarliestVersion() to the CommitMultiStore interface to enable querying the earliest available state height. Placed on CommitMultiStore rather than MultiStore since it requires root DB access that CacheMultiStore does not have. - Implement in rootmulti.Store with persistent DB storage - Track earliest version after pruning in PruneStores - Add unit tests for EarliestVersion functionality Ref: cosmos#15463
Pass CommitMultiStore to the node query service to populate EarliestStoreHeight in the Status response.
5c4a042 to
609ddf6
Compare
|
I edited the original description and cleaned it up a bit. This makes more sense for sure. Sorry for the mess. |
Instead of passing CommitMultiStore directly to the node gRPC service, add earliestStoreHeight field to sdk.Context and populate it when creating query contexts. This is more idiomatic for the SDK and avoids coupling the service to the store implementation. - Add EarliestStoreHeight() and WithEarliestStoreHeight() to Context - Populate context in CreateQueryContextWithCheckHeader - Remove CommitMultiStore parameter from RegisterNodeService
09b146d to
88416e6
Compare
…tore-height refactor: change how store height is retreived
|
just need changelog and test fixes |
Add missing earliestStoreHeightFn argument to NewQueryServer call in test, matching the updated function signature.
|
The The |
|
@aljo242 @technicallyty -- same request here, could the |
|
@mergify backport release/v0.53.x |
✅ Backports have been createdDetails
Cherry-pick of ae80efb 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 |
Description
Closes: #15463
Add
EarliestVersion()to theCommitMultiStoreinterface to enable querying the earliest available state height.This addresses the longstanding TODO in the Status gRPC endpoint that was returning
0forEarliestStoreHeight.Problem
Indexers and tooling need to know which heights a pruned node can serve queries for. Currently:
earliest_block_heightin CometBFT's STATUS RPC returns the earliest block, not the earliest stateEarliestStoreHeightfield incosmos.base.node.v1beta1.Statuswas hardcoded to0Solution
EarliestVersion() int64to theCommitMultiStoreinterface (notMultiStore, sinceCacheMultiStorelacks root DB access)rootmulti.Store:s/earliestkey1for unpruned chainsPruneStores()EarliestStoreHeight()andWithEarliestStoreHeight()tosdk.ContextearliestStoreHeightin query context creation (CreateQueryContextWithCheckHeader)Changes
store/types/store.goEarliestVersion()toCommitMultiStoreinterfacestore/rootmulti/store.goEarliestVersion(),GetEarliestVersion(),flushEarliestVersion(), updatePruneStores()store/rootmulti/store_test.gotypes/context.goearliestStoreHeightfield with getter/setterbaseapp/abci.goearliestStoreHeightwhen creating query contextclient/grpc/node/service.goEarliestStoreHeightfrom contextruntime/app.gosimapp/app.goTesting
TestEarliestVersion- basic functionality, default valueTestEarliestVersionWithPruning- tracks updates after pruningTestEarliestVersionPersistence- persists across restartsTestNodeStatus- gRPC endpoint returns valid heightsAPI Changes
Breaking change for any code implementing
CommitMultiStore— must now implementEarliestVersion() int64.No impact on
MultiStoreorCacheMultiStoreimplementations.