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

Add mock test for CheckSubstituteAndUpdateState. #4950

Merged

Conversation

DimitrisJim
Copy link
Contributor

@DimitrisJim DimitrisJim commented Oct 25, 2023

Description

closes: #4829

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.

@DimitrisJim DimitrisJim marked this pull request as draft October 25, 2023 13:34
@DimitrisJim DimitrisJim force-pushed the jim/4829-test-check-substitute-and-update-state branch 6 times, most recently from 6862662 to 3c5f5b0 Compare October 26, 2023 08:38
@DimitrisJim DimitrisJim force-pushed the jim/4829-test-check-substitute-and-update-state branch from 3c5f5b0 to 0cb3adb Compare October 26, 2023 08:48
@DimitrisJim DimitrisJim marked this pull request as ready for review October 26, 2023 08:54
expErr error
}{
{
"success",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding a check for writes/asserting reads from the store passed in will be done in PR for the wrappedStore.

@DimitrisJim
Copy link
Contributor Author

talked with @charleenfei, will mark as draft until #4862 is merged to include additional tests for changes added there

@DimitrisJim DimitrisJim marked this pull request as draft October 26, 2023 13:32
@DimitrisJim DimitrisJim force-pushed the jim/4829-test-check-substitute-and-update-state branch from 54c6419 to e1e9eb0 Compare October 30, 2023 13:41
@@ -21,7 +21,7 @@ var (
queryTypes = [...]any{types.StatusMsg{}, types.ExportMetadataMsg{}, types.TimestampAtHeightMsg{}, types.VerifyClientMessageMsg{}, types.CheckForMisbehaviourMsg{}}

// sudoTypes contains all the possible sudo message types.
sudoTypes = [...]any{types.UpdateStateMsg{}, types.UpdateStateOnMisbehaviourMsg{}, types.VerifyUpgradeAndUpdateStateMsg{}, types.VerifyMembershipMsg{}, types.VerifyNonMembershipMsg{}}
sudoTypes = [...]any{types.UpdateStateMsg{}, types.UpdateStateOnMisbehaviourMsg{}, types.VerifyUpgradeAndUpdateStateMsg{}, types.VerifyMembershipMsg{}, types.VerifyNonMembershipMsg{}, types.MigrateClientStoreMsg{}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding these as necessary

"failure: code hashes do not match",
func() {
substituteClientState = &types.ClientState{
CodeHash: []byte("invalid"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about using a mock value here but can't see many occasions where we do this

Copy link
Contributor

Choose a reason for hiding this comment

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

i think we have many mock code hash instances like in genesis_test,wasm_test, but maybe just better to have a separate pr cleaning all these up as we've been doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, can also move all vals to a values.go file as we do for top level testing/.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DimitrisJim DimitrisJim marked this pull request as ready for review October 30, 2023 13:44
@DimitrisJim
Copy link
Contributor Author

TestCheckSubstituteAndUpdateStateGrandpa/success is failing, as expected

Copy link
Contributor

@charleenfei charleenfei left a comment

Choose a reason for hiding this comment

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

nice work @DimitrisJim thanks!

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

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

Nice one!

func() {
substituteClientState = &ibctm.ClientState{}
},
clienttypes.ErrInvalidClient,
Copy link
Contributor

Choose a reason for hiding this comment

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

could maybe wrap the error with the error string in the code to make it more specific, but fine as is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could do, this is pretty prevalent currently. Could be nice to open overarching issue and maybe pick it up in future?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm happy with whatever :)

@colin-axner
Copy link
Contributor

We can remove the grandpa test as well? That will be handled by e2e's

@DimitrisJim DimitrisJim merged commit 995a3bd into feat/wasm-clients Oct 30, 2023
58 of 59 checks passed
@DimitrisJim DimitrisJim deleted the jim/4829-test-check-substitute-and-update-state branch October 30, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants