cosmos/ibc

ICS 04: timeoutChannelUpgrade should write error receipt

colin-axner opened this issue · 1 comments

The timeoutChannelUpgrade should write an error receipt upon successfully timing out an upgrade. While not strictly necessary, it potentially reduces handshake steps by 1. In the case of crossing INIT's, 1 side might timeout before the other. If this occurs, without the error receipt, the counterparty would either need to force a error receipt by calling the TRY step or wait for it's own timeout to exceed its deadline.

By writing the error receipt upon timeout, you don't require a TRY to be executed just to obtain an error receipt to cancel the upgrade

In the non-crossing INIT case, such as a single chain calling INIT and then timeout, an error receipt isn't useful, but it should not cause any issues either. In fact, it could simply allow a chain to synchronize upgrade sequences:
chain A, sequence 1, INIT, moves to sequence 2
chain A, timeout, error receipt for sequence 2 written

chain B, INIT, moves to sequence 2
chain B, cancel on error receipt, write error receipt

(without the error receipt written on timeout, chain A would have needed to call TRY to force an error receipt for sequence 2, note chain A could not respond to sequence 2 since it already attempted that sequence for a different upgrade)

chain B, INIT, moves to sequence 3
chain A, TRY, success