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

New channel query to get channel, connection and client info in a single CLI #1062

Closed
2 of 7 tasks
ancazamfir opened this issue Jun 8, 2021 · 2 comments · Fixed by #1130
Closed
2 of 7 tasks

New channel query to get channel, connection and client info in a single CLI #1062

ancazamfir opened this issue Jun 8, 2021 · 2 comments · Fixed by #1130
Assignees
Milestone

Comments

@ancazamfir
Copy link
Collaborator

ancazamfir commented Jun 8, 2021

Crate

relayer, relayer-cli

Summary

DEX had asked us to provide a CLI that given a chain-id, port-id, and channel-id we return the ChannelEnd, ConnectionEnd and AnyClientState on both ends. We should probably define a new struct to include the information such that it can be read easily.

Problem Definition

Currently the user needs to do ~6 queries to get this information.

Proposal

We can introduce a new query CLI, tentatively called query trace taking 3 parameters: a chain-id, port-id, and channel-id.

The most challenging part is how to assemble the output in a simple, meaningful way, given that there are multiple queries that this will involve, as follows:

  1. hermes query channel end chain-id port-id channel-id

    • extract from the result the connection hop identifier, for example connection-id
    • also extract the counterparty channel/port, counterparty-port-id and counterparty-channel-id
  2. hermes query connection end chain-id connection-id

    • extract the client identifier of the underlying client, for example client-id
    • extract also the counterparty client identifier, counterparty-client-id
    • extract also the counterparty conn identifier, counterparty-connection-id
  3. hermes query client state chain-id client-id

    • extract the chain identifier from the client state, counterparty-chain-id
    • now we have the full trace information on the side of chain-id
    • proceed to fetch the trace information from the counterparty side
  4. hermes query client state counterparty-chain-id counterparty-client-id

  5. hermes query connection end counterparty-chain-id counterparty-connection-id

  6. hermes query channel end counterparty-chain-id counterparty-port-id counterparty-channel-id

It probably makes sense to have two modes for the output:

  • default: Hermes outputs the whole structure of every field (not only the identifiers) for instance:
struct Trace {
  channel_end: ChannelEnd,
  connection_end: ConnectionEnd,
  client_state: AnyClientState,
  counterparty_channel_end: ChannelEnd,
  counterparty_connection_end: ConnectionEnd,
  counterparty_client_state: AnyClientState, 
}
  • summarised: Hermes only returns the identifier information, in a compact format, for instance:
struct TraceSummary {
  port_id: PortId,
  channel_id: ChannelId,
  connection_id: ConnectionId,
  client_id: ClientId,
  counterparty_port_id: PortId,
  counterparty_channel_id: ChannelId,
  counterparty_connection_id: ConnectionId,
  counterparty_client_id: ClientId,  
}

Acceptance Criteria

Get full channel information from both chains with a single CLI.

  • add new CLI hermes query trace CHAIN-ID PORT-ID CHANNEL-ID [-s/--summary]
  • integrate the new CLI into the E2E testing suite

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@ancazamfir ancazamfir added this to the 06.2021 milestone Jun 8, 2021
@ancazamfir ancazamfir self-assigned this Jun 17, 2021
@adizere adizere assigned soareschen and unassigned ancazamfir Jun 25, 2021
@ancazamfir
Copy link
Collaborator Author

ancazamfir commented Jun 28, 2021

@adizere pointed out that Dex wanted to filter also on destination chain, in other words show channels between two chains.
Could we extend then the existing query channels CLI to look something like:
query channels <chain-id> [--other-chain <other-chain-id>] [--verbose]

Opened issue #1132 for this.

@ancazamfir
Copy link
Collaborator Author

For this one, can we maybe incorporate in query channel? Maybe query channel ends <chain-id> <port-id> <channel-id> [--trace]. Note ends (will show both ends of the channel) vs end.

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