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

query connections given client id #151

Closed
ebuchman opened this issue Jul 15, 2020 · 3 comments · Fixed by #169
Closed

query connections given client id #151

ebuchman opened this issue Jul 15, 2020 · 3 comments · Fixed by #169
Assignees

Comments

@ebuchman
Copy link
Member

Given a client id, query the list of connection identifiers.

This is an easy one that just returns a list of connection identifiers.

ABCIQuery.Path = store/ibc/key
ABCIQuery.Data = clients/{identifier}/connections

@ebuchman ebuchman changed the title query connections give client id query connections given client id Jul 15, 2020
@greg-szabo
Copy link
Member

#152 changes a lot of the underlying code and gives it the basics but validation is incomplete. There is a todo in the code to finish that.

@andynog
Copy link
Contributor

andynog commented Jul 24, 2020

Implemented a good chunk of the logic to query client connections. But got stuck trying to figure out how to parse the result returned by the simapp. If I run simapp (docker version) and do the following command:

curl 'localhost:26657/abci_query?path="store/ibc/key"&data="clients/clientidone/connections"'

I get this result:

{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "response": {
      "code": 0,
      "log": "",
      "info": "",
      "index": "0",
      "key": "Y2xpZW50cy9jbGllbnRpZG9uZS9jb25uZWN0aW9ucw==",
      "value": "Chtjb25uZWN0aW9ucy9jb25uZWN0aW9uaWRvbmU=",
      "proof": null,
      "height": "1177",
      "codespace": ""
    }
  }
}

and the value decoded is connections/connectionidone (the connection identifier). So following the pattern we have to convert the result, I need to create an array of this connections as the response. But in my code I currently have

let res: Result<ConnectionEnd, Error> = block_on(query(&chain, opts));

where it should be more like something

let res: Result<Vec<ConnectionId>, Error> = block_on(query(&chain, opts));

but then had some issues trying to implement the TryFromRaw trait for this. Need to put a bit more thinking on it. The current implementation compiles but if you run:

./target/debug/relayer -c ./relayer/relay/tests/config/fixtures/relayer_conf_example.toml query client connections chain_A ethbridge -h 4 -p false

you get an empty response value

 Options QueryClientConnectionsOptions { client_id: ClientId("ethbridge"), height: 4, proof: false }
query client connections error Empty response value

andynog added a commit that referenced this issue Jul 25, 2020
@andynog
Copy link
Contributor

andynog commented Jul 25, 2020

Found a way to parse the client connections response. If you use the command below (with docker simapp running):

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

It shows the client connections:

Options QueryClientConnectionsOptions { client_id: ClientId("clientidone"), height: 4, proof: false }
query client connections result:  ["connections/connectionidone"]

I think this issue can be closed. The only tweak that might need to do is to migrate a struct I've declared (RawClientConnections) in ics02_client/query.rs that probably should live in ibc-proto crate.

greg-szabo pushed a commit that referenced this issue Jul 29, 2020
* Implemented logic to query client connections #151

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

* Added test for client connections query params #151

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

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

* Removing unused references #169
@greg-szabo greg-szabo mentioned this issue Jul 30, 2020
6 tasks
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this issue 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 a pull request may close this issue.

4 participants