-
Notifications
You must be signed in to change notification settings - Fork 653
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
Question about multiple OpenTry messages #1430
Comments
Hmm, yes this seems like a thing we should be able to check on TRY. We would have to probably store some additional state, since on the TRY step, we wouldn't be able to efficiently search through our own existing connectionIDs to see if they have the same counterparty. So we would have to store a mapping from the proposed counterparty to the ID that we have generated for a handshake in progress on TRY. This would then get deleted on CONFIRM if the first handshake fails in order to allow for a subsequent handshake against the same counterparty. Similar logic would need to be applied on connection/channel handshakes |
@AdityaSripal question: if we have 3 chains (A, B, C) and both A and B want to create a connection to C. Both A and B could have on their side the same client ID and connection ID, right? For example |
Hi Carlos, yes that is correct. There can be two connections with the same counterparty connectionID since they may refer to different chains. However, there cannot be two connections with the same counterparty connectionID that also has the same underlying clientID. We cannot just key on the counterpartyID, we will also have to key on our identifier for the layer below. So let's say we have your scenario. So chainA and chainB both have client and connectionIDs to chain C ( Chain C has a clientID to A: We should key on our clientID and the counterparty connectionID. privateStore: So any new CONN_TRY message, can check the key with its own clientID and the counterparty connectionID. If it exists, then error since the connection has already been established. Similar logic will apply for channel handshakes, but we use our own connectionID and the counterparty channelID. Does that make sense? cc: @colin-axner |
Found it here! Looks like the conclusions were the same:
|
great! thanks @colin-axner! feel free to close on of the two issues. |
Hi @ancazamfir! We ran into some open questions when trying to implement this issue. I would like to ask some followup questions so we can find an appropriate solution to the problem. There's two concerns that arose when addressing this problem:
In the original issue you mention:
What sort of logic does hermes need to do? Do you expect core IBC to return an identifier of the existing connection in open try? When trying to account for existing state which may be considered "invalid", we have a few potential solutions:
The primary issue with existing state is that core IBC cannot tell which is the correct connection identifier for the relayer to use. If there's connection-100 and connection-101 representing the same counterparty connection, it might be the case that the counterparty connection has selected connection-101 while this migration is being performed. Very much an edge case scenario, but still worth considering. Does this issue arise for hermes when two relayers attempt to complete the same handshake? If the slower relayer fails on try (currently it'd fail on ack), what is its expected behaviour? Does it stall and wait for the other relayer to finish or does it attempt to continue the handshake using the correct identifier? I'm assuming hermes would want to ensure the handshake finishes even if it is delayed slightly after detecting a race. Currently, this is fairly straightforward, it would either complete its duplicate try step and proceed to ack (assuming the other relayer stops after try) or it fails on ack and looks up the selected identifier on the try side. If core IBC returns an error on OpenTry for an existing connection to the counterparty endpoint, then it would be necessary to have some way of determining which connections exist relative to that counterparty endpoint. Off the top of my head, this would require using events, or iterating over existing connections. If we ignore existing state, this seems fine to return the existing connection id with the error on open try. One benefit of allowing multiple open try's is that an invalid connection state set in the open try step doesn't require starting over the handshake, but perhaps it would be easier to introduce cleanup on failed handshakes if you enforced a single connection. It seems to me, returning an error on open try without returning only a single identifier could make things more difficult. If we fixed this issue by ignoring existing state and returning an error on open try with the identifer for new handshakes, would that be beneficial to hermes? |
there are some comments that may help here:
Not sure I understand the proposal here. If the connection to counterparty exist in |
I'm going to close this issue. IBC eureka/v2 will move away from connection/channel handshakes, so I don't think this issue would be addressed before they are removed entirely (especially since we haven't addressed it up to now, sorry for that!) |
Summary of Bug
Testing connection handshake with multiple relayers (https://github.com/informalsystems/ibc-rs/issues/2168), i see that multiple
MsgConnectionOpenTry
messages with same counterparty are accepted and they generate multiple connection ends in tryOpen state. Only for one of them will the handshake be succesful of course but was wondering why theConnOpenTry
handler does not check if the counterparty is already bound to an existing connection.I remember asking this a while ago but cannot remember the answer :)
To fix this, hermes has to perform some ID "fixup". It is true that even if the
ConnOpenTry
handler would reject subsequent messages the relayer would need to figure out which ID to switch to (probably by querying clientConnections).Note: the same is true for
ChanOpenTry
handler.Version
master
Steps to Reproduce
For Admin Use
The text was updated successfully, but these errors were encountered: