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

fix(testing): use the correct revision height when querying trusted validator set #4483

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

colin-axner
Copy link
Contributor

@colin-axner colin-axner commented Aug 28, 2023

Description

see ref comment

ref: #4484

Commit Message / Changelog Entry

type: commit message

see the guidelines for commit messages. (view raw markdown for examples)


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

}

histInfo, ok := chain.App.GetStakingKeeper().GetHistoricalInfo(chain.GetContext(), height)
func (chain *TestChain) GetValsAtHeight(trustedHeight int64) (*cmttypes.ValidatorSet, bool) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a followup pr I will change this api:

func (chain *TestChain) GetTrustedValidators(trustedHeight clienttypes.Height) (*cmttypes.ValidatorSet, error) {

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if validator sets in historical info at height n are consistent with whats returned from the consensus service grpc. It may be worth checking that, but I'm not sure how exactly we would access this consensus service from our testing lib without doing a bit of digging.

The sdk team have been discussing making changes to historical info, potentially removing the validator set info. It would be good to make sure there is a backup option for our testing library if that happens.

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for going down this rabbit hole and fixing the issue in a clean way, @colin-axner!

@colin-axner
Copy link
Contributor Author

The sdk team have been discussing making changes to historical info, potentially removing the validator set info. It would be good to make sure there is a backup option for our testing library if that happens.

My vote would be to keep a map in the TestChain struct which goes from clienttypes.Height -> validator set, can be updated for each block committed, already thought about making the change just for readability

@colin-axner colin-axner merged commit 4e0bea7 into main Aug 29, 2023
52 of 53 checks passed
@colin-axner colin-axner deleted the colin/fix-getvalsatheight branch August 29, 2023 15:51
mergify bot pushed a commit that referenced this pull request Aug 29, 2023
…set in testingpkg (#4483)

(cherry picked from commit 4e0bea7)

# Conflicts:
#	testing/chain.go
mergify bot pushed a commit that referenced this pull request Aug 29, 2023
…set in testingpkg (#4483)

(cherry picked from commit 4e0bea7)

# Conflicts:
#	testing/chain.go
colin-axner added a commit that referenced this pull request Aug 30, 2023
…alidator set (backport #4483) (#4505)

* fix: use the correct revision height when querying trusted validator set in testingpkg (#4483)

(cherry picked from commit 4e0bea7)

# Conflicts:
#	testing/chain.go

* fix conflicts

* fix import types

---------

Co-authored-by: colin axnér <[email protected]>
Co-authored-by: Carlos Rodriguez <[email protected]>
colin-axner added a commit that referenced this pull request Aug 30, 2023
…alidator set (backport #4483) (#4506)

* fix: use the correct revision height when querying trusted validator set in testingpkg (#4483)

(cherry picked from commit 4e0bea7)

# Conflicts:
#	testing/chain.go

* fix conflicts

---------

Co-authored-by: colin axnér <[email protected]>
Co-authored-by: Carlos Rodriguez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants