Skip to content

Commit

Permalink
Use counterparty portid, channelid when verifying channel upgrade error.
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim committed Jul 11, 2023
1 parent ef239b4 commit e19dbec
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/core/04-channel/keeper/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,15 @@ func (k Keeper) ChanUpgradeCancel(ctx sdk.Context, portID, channelID string, err
)
}

if err := k.connectionKeeper.VerifyChannelUpgradeError(ctx, portID, channelID, connection, errorReceipt, errorReceiptProof, proofHeight); err != nil {
if err := k.connectionKeeper.VerifyChannelUpgradeError(
ctx,
channel.Counterparty.PortId,
channel.Counterparty.ChannelId,
connection,
errorReceipt,
errorReceiptProof,
proofHeight,
); err != nil {
return errorsmod.Wrap(err, "failed to verify counterparty error receipt")
}

Expand Down
8 changes: 8 additions & 0 deletions modules/core/04-channel/keeper/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,14 @@ func (suite *KeeperTestSuite) TestChanUpgradeCancel() {
},
}

// Create an initial path used only to invoke a ChanOpenInit handshake.
// This bumps the channel identifier generated for chain A on the
// next path used to run the upgrade handshake.
// See issue 4062.
path = ibctesting.NewPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
path.EndpointA.ChanOpenInit()

for _, tc := range tests {
tc := tc
suite.Run(tc.name, func() {
Expand Down

0 comments on commit e19dbec

Please sign in to comment.