Skip to content

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

Closed
@ancazamfir

Description

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

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions