Skip to content
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

Empty values returned when pruned height is queried #12823

Closed
V-Staykov opened this issue Aug 4, 2022 · 0 comments
Closed

Empty values returned when pruned height is queried #12823

V-Staykov opened this issue Aug 4, 2022 · 0 comments
Assignees
Labels

Comments

@V-Staykov
Copy link

V-Staykov commented Aug 4, 2022

Summary of Bug

When trying to query anything with a --height that is pruned, the return is a default response, i.e. empty values, rather than error, as it is documented it should. I've traced the problem to store/iavl/store.go and GetImmutable function. There if VersionExists returns false, an error is expected to be thrown, but instead it is nil.

I say error is expected to be returned because of the comment in store/rootmulti/store.go in CacheMultiStoreWithVersion where GetImmutable is called and before it the comment says:

// Attempt to lazy-load an already saved IAVL store version. If the
// version does not exist or is pruned, an error should be returned.

The problem code is this:

if !st.VersionExists(version) {
	return &Store{tree: &immutableTree{&iavl.ImmutableTree{}}}, nil
}

Version

cosmos-sdk v0.45.3

Steps to Reproduce

Query a node with noded q staking validators --height <pruned_height_number> for a pruned block. It is expected to throw error, but returns empty array of balances.

Example return for pruned block:
noded q staking validators --height 99

pagination:
  next_key: null
  total: "0"
validators: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants