-
Notifications
You must be signed in to change notification settings - Fork 326
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
Channel closing handshake #141
Conversation
@@ -140,7 +140,64 @@ HandleChanOpenConfirm(chainID, chain, datagrams) == | |||
\* otherwise, do not update the chain | |||
ELSE chain | |||
|
|||
\* Handle "ChanCloseInit" datagrams |
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.
The relayer algorithm for handling channel closing does not have an English specification in ICS 018 (at least in the master branch). Any idea where is the English high-level spec for this algorithm? I wanted to cross-check it with your TLA+ code.
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.
You're right, it's missing in the ICS018, which is why channel closing wasn't added to the relayer spec until now. I've reverse engineered the datagram creation from the channel closure handlers.
\* if there are valid "ChanCloseInit" datagrams | ||
IF /\ chanCloseInitDgrs /= {} | ||
\* and the channel end is neither UNINIT nor CLOSED | ||
/\ chain.connectionEnd.channelEnd.state \notin {"UNINIT", "CLOSED"} |
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.
This is different from ICS04. I guess the reason is that they don't have UNINIT state?Is this the condition used in the Go implementation?
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.
Both the ICS004 and the Go implementation checks if the channel end can be found in the store, i.e. if it is non-null. In the TLA+ specification, each channel end is in UNINIT in the initial state of the system (c.f. Chain.tla and RelayerDefinitions.tla), hence a channel (also connection) end in state UNINIT denotes a null channel (connection) end.
Closes: #126
Description
A small PR that deals with creation and handling of channel closing datagrams in the relayer TLA+ specification.
Also, relayer-old is deleted.
Key points
closeChannelA
andcloseChannelB
.ChanCloseInit
to the appropirate chain once the flag is true.CLOSED
and that its counterparty channel end is not closed yet, and sendsChanCloseConfirm
to the its counterparty chainChanCloseInit
andChanCloseConfirm
by setting its channel end state toCLOSED
Properties
ChannelCloseSafety
ensures that once a channel is closed, it is never open again.ChanCloseInitDelivery
ensures that onceChanCloseInit
is sent, eventually both channel ends are closed.For contributor use:
docs/
) and code commentsFiles changed
in the Github PR explorer