Skip to content

Something confusing about ICS03, ICS18 #960

Closed

Description

As function pendingDatagrams in ICS18

function pendingDatagrams(chain: Chain, counterparty: Chain): List<Set<Datagram>> {
...
  // ICS3 : Connections
  connections = chain.getConnectionsUsingClient(counterparty)
  for (const localEnd of connections) {
    remoteEnd = counterparty.getConnection(localEnd.counterpartyIdentifier)
    if (localEnd.state === INIT && (remoteEnd === null || remoteEnd.state === INIT))
      counterpartyDatagrams.push(ConnOpenTry{...})
...
}

Relayer relays ConnOpenTry to B when localEnd.state == INIT in A and remoteEnd == null || remoteEnd.state == INIT in B. But I think it is impossible that both connectionEnd equal INIT.
As function connOpenInit in ICS03

function connOpenInit(...) {
    identifier = generateIdentifier()
...
    connection = ConnectionEnd{state, "", counterpartyPrefix,
      clientIdentifier, counterpartyClientIdentifier, versions, delayPeriodTime, delayPeriodBlocks}
...
}

There is no counterpartyConnectionIdentifier when a connectionEnd in A is "INIT". Acoording to ICS03, if a connectionEnd in A and connectionEnd in B are both "INIT", function connOpenTry should be relayed to both chain and each chain will create a new connectionEnd in TRYOPEN to complete the handshake.

function connOpenTry(...) {
    identifier = generateIdentifier()
...
    connection = ConnectionEnd{TRYOPEN, counterpartyConnectionIdentifier, counterpartyPrefix,
                               clientIdentifier, counterpartyClientIdentifier, [version], delayPeriodTime, delayPeriodBlocks}
...
}

So I don't quite understand this if (localEnd.state === INIT && (remoteEnd === null || remoteEnd.state === INIT)), is there any special use for it that I don't think of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions