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

Improve mock wasmvm query implementation #4879

Conversation

chatton
Copy link
Contributor

@chatton chatton commented Oct 16, 2023

Description

closes: #4873

The implementation wasn't as straightforward as I was expecting.

It seems it is not possible to use type constraints as keys to a map, because of this I opted to use the type name and pre-populate the map with all allowed types so it is only possible to register types for the expected values.

I needed to move the mock vm to the same package as the types to be able to actually do this.

I'm not too happy about that, and I think we can actually revert that if we just opt to use a set of string constants instead of types. Open to suggestions!

I also looked into the possibility of using an internal directory, but types aren't importable from types_test from a separate package.


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.

@chatton chatton marked this pull request as ready for review October 16, 2023 15:32
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.

i think this is a good base to start migrating the tests with so we can check that the correct q methods are called, happy for you to merge it in first and then we iterate after as needed!

@chatton chatton merged commit bc380a4 into feat/wasm-clients Oct 17, 2023
63 checks passed
@chatton chatton deleted the cian/issue#4873-improve-mock-wasmvm-query-implementation branch October 17, 2023 10:48
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