cosmos / ibc

Interchain Standards (ICS) for the Cosmos network & interchain ecosystem.
Other
919 stars 382 forks source link

ICS4: Implement PacketRecv and PacketAck Sequence (re)-initializing on ORDER change during Upgrade #1061

Closed AdityaSripal closed 8 months ago

AdityaSripal commented 8 months ago

If the upgrade changes the ordering, the recv sequence and ack sequences need to be appropriately set since there is different expected behavior from the previous channel logic and the new channel logic.

If moving from UNORDERED to ORDERED: The NextSequenceRecv needs to be set to the counterpartyNextSequenceSend on ChanUpgradeOpen since the packets on both sides have all flushed, we can be sure that the next packet we are set to receive will be the first packet the counterparty sends after reopening. Similarly, the NextSequenceAck should be our own NextSequenceSend since we can be sure that the counterparty processed all sent packets after flushing completes.

If moving from ORDERED to UNORDRED: We simply reset NextSequenceRecv and NextSequenceAck to 1 to maintain consistency with other UNORDERED channels