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 mocking capabilities for ibc querying #1620

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

nik-suri
Copy link
Contributor

@nik-suri nik-suri commented Mar 4, 2023

This PR adds an IBC querier implementation to the MockQuerier. The functionality is gated by the stargate feature.

@webmaster128
Copy link
Member

@hashedone could you review this PR to ensure it serves your needs for multitest?

Copy link
Contributor

@hashedone hashedone left a comment

Choose a reason for hiding this comment

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

I don't exactly like the fact the implementation implements only half of the queried cases (querying "own" ports - I agree it is probably the most useful one, but with just a bit more work, the whole query domain could be covered).

It doesn't have much to do with multitest - it would have its query, and there would be a "mock" relayer passing messages, and opening channels, so it would simulate the chain behaviour.

packages/std/src/testing/mock.rs Show resolved Hide resolved
Copy link
Contributor

@hashedone hashedone left a comment

Choose a reason for hiding this comment

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

LGTM

@nik-suri
Copy link
Contributor Author

nik-suri commented Mar 6, 2023

@hashedone @webmaster128 thanks for your reviews. If there aren't any more reviewers, could we please merge this?

@hashedone hashedone merged commit c9cb354 into CosmWasm:main Mar 6, 2023
@nik-suri nik-suri deleted the mock-ibc-querier branch March 6, 2023 23:43
let ibc = IbcQuerier::new("myport", &[chan1]);

// query channels matching "myport" (should be none)
let query = &&IbcQuery::PortId {};
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why clippy is not complaining about this double reference 🤷‍♂️ But it seems to work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like clippy hasn't implemented lints for useless borrows?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah. Anyways, fixed in #1624

webmaster128 added a commit that referenced this pull request Mar 7, 2023
@webmaster128
Copy link
Member

Published as part of 1.2.2 today

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.

None yet

3 participants