Skip to content

Commit

Permalink
add explanation and optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaSripal committed Nov 29, 2023
1 parent a4b29b7 commit 55a34e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ function chanUpgradeTry(
// then either the counterparty chain is out-of-sync or the message
// is out-of-sync and we write an error receipt with our sequence - 1
// so that the counterparty can update their sequence as well.
// This will cause the outdated counterparty to upgrade the sequence
// and abort their out-of-sync upgrade without aborting our own since
// the error receipt sequence is lower than ours and higher than the counterparty.
if counterpartyUpgradeSequence < channel.upgradeSequence {
errorReceipt = ErrorReceipt{
channel.upgradeSequence - 1,
Expand Down Expand Up @@ -906,6 +909,10 @@ function cancelChannelUpgrade(
// If counterparty sequence is less than the current sequence,
// abort transaction since this error receipt is from a previous upgrade
abortTransactionUnless(errorReceipt.sequence >= channel.upgradeSequence)
// fastforward channel sequence to higher sequence so that we can start
// new handshake on a fresh sequence
channel.upgradeSequence = errorReceipt.sequence
provableStore.set(channelPath(portIdentifier, channelIdentifier), channel)

// get underlying connection for proof verification
connection = provableStore.get(connectionPath(channel.connectionHops[0]))
Expand Down

0 comments on commit 55a34e9

Please sign in to comment.