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

Implement query for client connections #169

Merged
merged 11 commits into from
Jul 29, 2020
Merged

Conversation

andynog
Copy link
Contributor

@andynog andynog commented Jul 27, 2020

Closes: #151

Description

Implemented query for client connections. Response is parsed as array of strings (which is the ABCI query result).


For contributor use:

  • Unit tests written
  • Added test to CI if applicable
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer

Copy link
Member

@greg-szabo greg-szabo left a comment

Choose a reason for hiding this comment

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

Ok, this might be a very high level feedback, but running the command gives me an empty value. (I'm running simd in docker on the side.)

cargo run --bin relayer -- -c relayer/relay/tests/config/fixtures/simple_config.toml query client connections ibc-test ethbridge --height 3 -p false
query client connections error Empty response value

Copy link
Member

@greg-szabo greg-szabo left a comment

Choose a reason for hiding this comment

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

Overall looks good, minor notes and requests here and there.

At the testing code, somehow I expected that the command itself will be tested. We should implement some kind of integration testing for these.

Not in this PR, though, that would be unfair to the scope here.

modules/src/ics02_client/query.rs Outdated Show resolved Hide resolved
modules/src/ics02_client/query.rs Outdated Show resolved Hide resolved
Copy link
Member

@greg-szabo greg-szabo left a comment

Choose a reason for hiding this comment

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

I just noticed that you implemented the TryFromRaw in the obsolete query.rs. Please clean up the unused code and move things around like you can see in the connection and channel code.

@romac romac changed the title Andy/query client conn Implement query for client connections Jul 28, 2020
@andynog
Copy link
Contributor Author

andynog commented Jul 28, 2020

Ok, this might be a very high level feedback, but running the command gives me an empty value. (I'm running simd in docker on the side.)

cargo run --bin relayer -- -c relayer/relay/tests/config/fixtures/simple_config.toml query client connections ibc-test ethbridge --height 3 -p false
query client connections error Empty response value

Using the simapp version in this branch, the command I've used to get the client connections is:

cargo run --bin relayer -- -c ./relayer/relay/tests/config/fixtures/relayer_conf_example.toml query client connections chain_A clientidone -h 4 -p false

the chain_id used is chain_A and client_id clientidone.

@greg-szabo
Copy link
Member

Ah cool, thanks! I was a bit lost there. Can you update the comment in the code to reflect that?
I know it's hairsplitting but I'm going to use that comment to write our first tests for testing queries and it helps me tremendously if the comment is correct.

Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

If we supply a height that is too advanced, the reported error is a bit misleading saying something along the lines of proof is unexpectedly empty; ensure height has not been pruned:. See below:

     Running `target/debug/relayer -c ./relayer/relay/tests/config/fixtures/relayer_conf_example.toml query client connections chain_A clientidone -h 1000`
     Options QueryClientConnectionsOptions { client_id: ClientId("clientidone"), height: 1000, proof: true }
query client connections error RPC error: proof is unexpectedly empty; ensure height has not been pruned: invalid request

@andynog
Copy link
Contributor Author

andynog commented Jul 28, 2020

If we supply a height that is too advanced, the reported error is a bit misleading saying something along the lines of proof is unexpectedly empty; ensure height has not been pruned:. See below:

     Running `target/debug/relayer -c ./relayer/relay/tests/config/fixtures/relayer_conf_example.toml query client connections chain_A clientidone -h 1000`
     Options QueryClientConnectionsOptions { client_id: ClientId("clientidone"), height: 1000, proof: true }
query client connections error RPC error: proof is unexpectedly empty; ensure height has not been pruned: invalid request

Actually noticed this on another issue and provided comments. I think someone mentioned that has to do with pruning I believe but can't find that thread.

@greg-szabo
Copy link
Member

Hint: the file modules/src/ics02_client/query.rs should completely disappear after this PR. Ping me if you need any pointers on how to achieve that.

@adizere
Copy link
Member

adizere commented Jul 29, 2020

Actually noticed this on another issue and provided comments. I think someone mentioned that has to do with pruning I believe but can't find that thread.

I'm not sure this is about pruning. Pruning would interfere with a query if the supplied height -h would be very old (which was pruned). But in this case I was supplying a height (1000) that does not exist yet (it's a height in the future). At the least, I think the error message is not right.

query client connections error RPC error: proof is unexpectedly empty; ensure height has not been pruned: invalid request

But there might a bug in the validation/handling.

@andynog
Copy link
Contributor Author

andynog commented Jul 29, 2020

I just noticed that you implemented the TryFromRaw in the obsolete query.rs. Please clean up the unused code and move things around like you can see in the connection and channel code.

This is fixed in 1ca727d

@andynog andynog closed this Jul 29, 2020
@andynog andynog reopened this Jul 29, 2020
Copy link
Member

@greg-szabo greg-szabo left a comment

Choose a reason for hiding this comment

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

Last drift, I promise.

relayer/cli/src/commands/query/client.rs Outdated Show resolved Hide resolved
relayer/cli/src/commands/query/client.rs Outdated Show resolved Hide resolved
andynog and others added 2 commits July 29, 2020 12:01
Thanks for fixing

Co-authored-by: Greg Szabo <16846635+greg-szabo@users.noreply.github.com>
Thanks for fixing

Co-authored-by: Greg Szabo <16846635+greg-szabo@users.noreply.github.com>
@codecov-commenter
Copy link

Codecov Report

Merging #169 into master will increase coverage by 2.1%.
The diff coverage is 19.6%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #169     +/-   ##
========================================
+ Coverage    13.6%   15.7%   +2.1%     
========================================
  Files          69      59     -10     
  Lines        3752    3823     +71     
  Branches     1374    1480    +106     
========================================
+ Hits          513     604     +91     
+ Misses       2618    2475    -143     
- Partials      621     744    +123     
Impacted Files Coverage Δ
modules/src/events.rs 0.0% <ø> (ø)
modules/src/ics02_client/client.rs 0.0% <0.0%> (ø)
modules/src/ics02_client/client_type.rs 47.6% <ø> (ø)
modules/src/ics03_connection/error.rs 25.0% <0.0%> (-8.4%) ⬇️
modules/src/ics03_connection/exported.rs 42.1% <0.0%> (-9.6%) ⬇️
modules/src/ics04_channel/error.rs 23.0% <0.0%> (-2.0%) ⬇️
modules/src/ics04_channel/packet.rs 0.0% <0.0%> (ø)
modules/src/ics07_tendermint/error.rs 33.3% <0.0%> (+33.3%) ⬆️
modules/src/ics07_tendermint/msgs/create_client.rs 0.0% <0.0%> (ø)
modules/src/ics23_commitment/mod.rs 0.0% <0.0%> (ø)
... and 47 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 021cdc4...3d3a2e0. Read the comment docs.

@greg-szabo greg-szabo merged commit 841a02c into master Jul 29, 2020
@greg-szabo greg-szabo deleted the andy/query_client_conn branch July 29, 2020 18:33
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
* Implemented logic to query client connections informalsystems#151

* Implemented a way to parse the client connections query response as a vector of string informalsystems#151

* Added test for client connections query params informalsystems#151

* Refactored TryFromRaw for Vec<String> as suggested on review informalsystems#169

* Fixed comments and fixed command line example to test the query client connections informalsystems#169

* Removing unused references informalsystems#169
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.

query connections given client id
5 participants