From 8cadde50236870439fb8458fb029b00183d99a23 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Mon, 31 Jul 2023 13:25:25 +0200 Subject: [PATCH] ICS 04 (upgrades): fix counterparty connection hops in `chanUpgradeOpen` (#1008) * fix connection hops * add clarification to comment --- .../core/ics-004-channel-and-packet-semantics/UPGRADES.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md b/spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md index 1fa5567c5..9d1849f89 100644 --- a/spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md +++ b/spec/core/ics-004-channel-and-packet-semantics/UPGRADES.md @@ -825,12 +825,16 @@ function chanUpgradeOpen( // get upgrade since counterparty should have upgraded to these parameters upgrade = provableStore.get(channelUpgradePath(portIdentifier, channelIdentifier)) + // get the counterparty's connection hops for the proposed upgrade connection + proposedConnection = provableStore.get(connectionPath(upgrade.fields.connectionHops)) + counterpartyHops = [proposedConnection.counterpartyConnectionIdentifier] + counterpartyChannel = ChannelEnd{ state: OPEN, ordering: upgrade.fields.ordering, counterpartyPortIdentifier: portIdentifier, counterpartyChannelIdentifier: channelIdentifier, - connectionHops: upgrade.fields.connectionHops, + connectionHops: counterpartyHops, version: upgrade.fields.version, sequence: channel.upgradeSequence, } @@ -961,7 +965,7 @@ function timeoutChannelUpgrade( // counterparty channel must be proved to not have completed flushing after timeout has passed abortTransactionUnless(counterpartyChannel.state !== FLUSHCOMPLETE) - // if counterparty channel state is OPEN, we should abort + // if counterparty channel state is OPEN, we should abort the tx // only if the counterparty has successfully completed upgrade if counterpartyChannel.state === OPEN { // get upgrade since counterparty should have upgraded to these parameters