-
Notifications
You must be signed in to change notification settings - Fork 404
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
Delay period on a per-connection basis #507
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, same approach taken in PR
versionsIntersection = intersection(counterpartyVersions, previous !== null ? previous.version : getCompatibleVersions()) | ||
version = pickVersion(versionsIntersection) // throws if there is no intersection | ||
connection = ConnectionEnd{TRYOPEN, counterpartyConnectionIdentifier, counterpartyPrefix, | ||
clientIdentifier, counterpartyClientIdentifier, version} | ||
clientIdentifier, counterpartyClientIdentifier, version, delayPeriod} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that delayPeriod
is a parameter defined by the chain to provide security to its users. Shouldn't it be reasonable to give each side of the connection possibility to choose delayPeriod
? Also what happen in crossing hello case when different delayPeriod
is chosen by counter parties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think chains are defining the delay period in this implementation. As you say, each side of the conenction has the possibility to choose the delayPeriod
.
In the case of crossing hello's, the connection handshake will succeed with different delay periods. It can be viewed the same as if the crossing hellos selected different client identifiers (they cannot connect with each other because they have different parameters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of crossing hello's, the connection handshake will succeed with different delay periods.
I think you mean to say it will fail.
We want the initiator of the handshake to define the delayPeriod
on both ends. Consider that I want to create a connection with ChainA and chainB, and I want to use the delayPeriod
feature to protect packets going across this connection from misbehaviour on either side.
I submit a ConnOpenInit
to chainA with a delayPeriod=60
. Now, I intend to also set a delayPeriod
on chainB, however another relayer has submitted a ConnOpenTry
before me on chainB with delayPeriod=0
. This tx passes, and I now have a connection with delayPeriod
on chainA and no delayPeriod
on chainB.
This is clearly not what I wanted as the initiator. This is why we fix the delay period at the INIT
step to ensure that the final connection, regardless of which relayer completes it, has the delay period that was specified by the initiating relayer. In OpenTry
, we enforce that this connectionEnd also has a delay period specified by the initiating relayer.
As @colin-axner said, in case of crossing hello's that don't agree on delay period, we error just as we do in other cases where parameters do not match.
Now, it is possible that in the INIT
step, we could define different delay periods for each chain. So ConnOpenInit
might specify delayPeriod
AND counterpartyDelayPeriod
.
I could see this being potentially useful in cases where a highly secure chain is connecting to a more risky chain, the initiating relayer may specify no delay period for the cosmos-hub
client but a high delay period for the risky-chain
client.
However, this is a (slight) complication that doesn't seem all that useful imo, and unnecessary for IBC 1.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that giving possibility for each party to choose a delayPeriod would conflict with optimistic sends, so it seems like good tradeoff to have it the same on both ends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, we discussed this a bit internally, I guess it should be summarised somewhere public. Great summary @AdityaSripal!
I have few more high level questions:
|
I think I can take a shot at answering some of these questions.
I think the delay period is left out of the other verify functions since there is not really any risk involved until a packet is sent (at which point we verify the delay period)
correct.
|
However, the order of packet submission and misbehaviour submission really does matter. Which is why delay period gives a chance for misbehaviour to be submitted first.
|
Thanks a lot for the answers, it makes sense. Looks good to me. Just a note that we will put some effort in adding this change to the IBC tla+ spec and try to run it through model checker so there are no surprises :) |
Replaces #500 per discussion.