@@ -161,7 +161,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
161161 channelId: channel0.channelId,
162162 counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel1.portId, channel1.channelId).fields,
163163 counterpartyUpgradeSequence: 2 ,
164- proposedConnectionHops: new string []( 0 ),
164+ proposedConnectionHops: IBCChannelLib. buildConnectionHops (channel0.connectionId ),
165165 proofs: upgradeLocalhostProofs ()
166166 });
167167 (bool ok , uint64 seq ) = ibcHandler.channelUpgradeTry (msg_);
@@ -217,6 +217,30 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
217217 );
218218
219219 // Try msg is reverted because the proposals are incompatible
220+ {
221+ IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
222+ portId: channel0.portId,
223+ channelId: channel0.channelId,
224+ counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel1.portId, channel1.channelId).fields,
225+ counterpartyUpgradeSequence: 1 ,
226+ proposedConnectionHops: IBCChannelLib.buildConnectionHops (channel0.connectionId),
227+ proofs: upgradeLocalhostProofs ()
228+ });
229+ vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeIncompatibleProposal.selector );
230+ ibcHandler.channelUpgradeTry (msg_);
231+ }
232+ {
233+ IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
234+ portId: channel0.portId,
235+ channelId: channel0.channelId,
236+ counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel1.portId, channel1.channelId).fields,
237+ counterpartyUpgradeSequence: 1 ,
238+ proposedConnectionHops: IBCChannelLib.buildConnectionHops (channel1.connectionId),
239+ proofs: upgradeLocalhostProofs ()
240+ });
241+ vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeTryProposedConnectionHopsMismatch.selector );
242+ ibcHandler.channelUpgradeTry (msg_);
243+ }
220244 {
221245 IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
222246 portId: channel0.portId,
@@ -226,9 +250,33 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
226250 proposedConnectionHops: new string [](0 ),
227251 proofs: upgradeLocalhostProofs ()
228252 });
253+ vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeTryProposedConnectionHopsEmpty.selector );
254+ ibcHandler.channelUpgradeTry (msg_);
255+ }
256+ {
257+ IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
258+ portId: channel1.portId,
259+ channelId: channel1.channelId,
260+ counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel0.portId, channel0.channelId).fields,
261+ counterpartyUpgradeSequence: 1 ,
262+ proposedConnectionHops: IBCChannelLib.buildConnectionHops (channel1.connectionId),
263+ proofs: upgradeLocalhostProofs ()
264+ });
229265 vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeIncompatibleProposal.selector );
230266 ibcHandler.channelUpgradeTry (msg_);
231267 }
268+ {
269+ IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
270+ portId: channel1.portId,
271+ channelId: channel1.channelId,
272+ counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel0.portId, channel0.channelId).fields,
273+ counterpartyUpgradeSequence: 1 ,
274+ proposedConnectionHops: IBCChannelLib.buildConnectionHops (channel0.connectionId),
275+ proofs: upgradeLocalhostProofs ()
276+ });
277+ vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeTryProposedConnectionHopsMismatch.selector );
278+ ibcHandler.channelUpgradeTry (msg_);
279+ }
232280 {
233281 IIBCChannelUpgradeBase.MsgChannelUpgradeTry memory msg_ = IIBCChannelUpgradeBase.MsgChannelUpgradeTry ({
234282 portId: channel1.portId,
@@ -238,7 +286,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
238286 proposedConnectionHops: new string [](0 ),
239287 proofs: upgradeLocalhostProofs ()
240288 });
241- vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeIncompatibleProposal .selector );
289+ vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeTryProposedConnectionHopsEmpty .selector );
242290 ibcHandler.channelUpgradeTry (msg_);
243291 }
244292
@@ -265,7 +313,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
265313 channelId: channel0.channelId,
266314 counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel1.portId, channel1.channelId).fields,
267315 counterpartyUpgradeSequence: 1 ,
268- proposedConnectionHops: new string []( 0 ),
316+ proposedConnectionHops: IBCChannelLib. buildConnectionHops (channel0.connectionId ),
269317 proofs: upgradeLocalhostProofs ()
270318 });
271319 vm.expectRevert (
@@ -283,7 +331,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
283331 channelId: channel1.channelId,
284332 counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel0.portId, channel0.channelId).fields,
285333 counterpartyUpgradeSequence: 2 ,
286- proposedConnectionHops: new string []( 0 ),
334+ proposedConnectionHops: IBCChannelLib. buildConnectionHops (channel1.connectionId ),
287335 proofs: upgradeLocalhostProofs ()
288336 });
289337 vm.expectRevert (IIBCChannelUpgradeErrors.IBCChannelUpgradeIncompatibleProposal.selector );
@@ -312,7 +360,7 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
312360 channelId: channel0.channelId,
313361 counterpartyUpgradeFields: mockApp.getUpgradeProposal (channel1.portId, channel1.channelId).fields,
314362 counterpartyUpgradeSequence: 2 ,
315- proposedConnectionHops: new string []( 0 ),
363+ proposedConnectionHops: IBCChannelLib. buildConnectionHops (channel0.connectionId ),
316364 proofs: upgradeLocalhostProofs ()
317365 })
318366 );
@@ -1210,12 +1258,6 @@ contract TestICS04Upgrade is ICS04UpgradeTestHelper, ICS04PacketEventTestHelper
12101258 proposedConnectionHops: IBCChannelLib.buildConnectionHops (proposals.p1.connectionId),
12111259 proofs: upgradeLocalhostProofs ()
12121260 });
1213- if (flow.crossingHello) {
1214- // If the upgrade already exists (i.e. crossing hello), `proposedConnectionHops` must be empty
1215- vm.expectRevert ();
1216- ibcHandler.channelUpgradeTry (msg_);
1217- msg_.proposedConnectionHops = new string [](0 );
1218- }
12191261 (bool ok , uint64 seq ) = ibcHandler.channelUpgradeTry (msg_);
12201262 assertTrue (ok);
12211263 assertEq (seq, upgradeSequence);
0 commit comments