Skip to content

fix(grpc): return actual earliest_store_height in node.Status endpoint (backport #25647)#25901

Closed
mergify[bot] wants to merge 4 commits intorelease/v0.53.xfrom
mergify/bp/release/v0.53.x/pr-25647
Closed

fix(grpc): return actual earliest_store_height in node.Status endpoint (backport #25647)#25901
mergify[bot] wants to merge 4 commits intorelease/v0.53.xfrom
mergify/bp/release/v0.53.x/pr-25647

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Feb 11, 2026

Description

Closes: #15463

Add EarliestVersion() to the CommitMultiStore interface to enable querying the earliest available state height.
This addresses the longstanding TODO in the Status gRPC endpoint that was returning 0 for EarliestStoreHeight.

Problem

Indexers and tooling need to know which heights a pruned node can serve queries for. Currently:

  • earliest_block_height in CometBFT's STATUS RPC returns the earliest block, not the earliest state
  • The EarliestStoreHeight field in cosmos.base.node.v1beta1.Status was hardcoded to 0

Solution

  • Add EarliestVersion() int64 to the CommitMultiStore interface (not MultiStore, since CacheMultiStore lacks root DB access)
  • Implement persistent tracking in rootmulti.Store:
    • Stores earliest version at s/earliest key
    • Defaults to 1 for unpruned chains
    • Updates after successful pruning in PruneStores()
  • Add EarliestStoreHeight() and WithEarliestStoreHeight() to sdk.Context
  • Populate earliestStoreHeight in query context creation (CreateQueryContextWithCheckHeader)
  • Node gRPC service reads from context rather than storing a reference to the multistore

Changes

File Change
store/types/store.go Add EarliestVersion() to CommitMultiStore interface
store/rootmulti/store.go Implement EarliestVersion(), GetEarliestVersion(), flushEarliestVersion(), update PruneStores()
store/rootmulti/store_test.go Add 3 unit tests
types/context.go Add earliestStoreHeight field with getter/setter
baseapp/abci.go Populate earliestStoreHeight when creating query context
client/grpc/node/service.go Read EarliestStoreHeight from context
runtime/app.go Simplified service registration (no store param)
simapp/app.go Simplified service registration (no store param)

Testing

  • TestEarliestVersion - basic functionality, default value
  • TestEarliestVersionWithPruning - tracks updates after pruning
  • TestEarliestVersionPersistence - persists across restarts
  • System test: TestNodeStatus - gRPC endpoint returns valid heights

API Changes

Breaking change for any code implementing CommitMultiStore — must now implement EarliestVersion() int64.
No impact on MultiStore or CacheMultiStore implementations.


This is an automatic backport of pull request #25647 done by Mergify.

#25647)

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
Co-authored-by: Alex | Cosmos Labs <alex@cosmoslabs.io>
(cherry picked from commit ae80efb)

# Conflicts:
#	CHANGELOG.md
#	enterprise/poa/simapp/app.go
#	store/rootmulti/store.go
@mergify
Copy link
Copy Markdown
Contributor Author

mergify Bot commented Feb 11, 2026

Cherry-pick of ae80efb has failed:

On branch mergify/bp/release/v0.53.x/pr-25647
Your branch is up to date with 'origin/release/v0.53.x'.

You are currently cherry-picking commit ae80efbfd.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   client/grpc/node/service.go
	modified:   client/grpc/node/service_test.go
	modified:   runtime/app.go
	modified:   server/mock/store.go
	modified:   simapp/app.go
	modified:   store/rootmulti/store_test.go
	modified:   store/types/store.go
	new file:   tests/systemtests/node_service_test.go

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   CHANGELOG.md
	deleted by us:   enterprise/poa/simapp/app.go
	both modified:   store/rootmulti/store.go

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

_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
io "io"
reflect "reflect"

Check notice

Code scanning / CodeQL

Sensitive package import Note

Certain system packages contain functions which may be a possible source of non-determinism
@technicallyty
Copy link
Copy Markdown
Member

@Cordtus unfortunately i won't be able to backport this one, as it would require a bump to store. this one is only going to be supported in future releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants