From 0178c093a09265fa814491423cf3c9311e6ace1a Mon Sep 17 00:00:00 2001 From: Sean King Date: Tue, 26 Apr 2022 12:50:48 +0200 Subject: [PATCH] fix: ics29 OnChanOpenInit remake versionMetaData before returning --- modules/apps/29-fee/ibc_module.go | 14 ++++++++++++-- modules/apps/29-fee/transfer_test.go | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index ccaf9ecbf4a..36fe66948bc 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -50,11 +50,21 @@ func (im IBCModule) OnChanOpenInit( return "", sdkerrors.Wrapf(types.ErrInvalidVersion, "expected %s, got %s", types.Version, versionMetadata.FeeVersion) } + appVersion, err := im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, versionMetadata.AppVersion) + if err != nil { + return "", err + } + + versionMetadata.AppVersion = appVersion + versionBytes, err := types.ModuleCdc.MarshalJSON(&versionMetadata) + if err != nil { + return "", err + } + im.keeper.SetFeeEnabled(ctx, portID, channelID) // call underlying app's OnChanOpenInit callback with the appVersion - return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, - chanCap, counterparty, versionMetadata.AppVersion) + return string(versionBytes), nil } // OnChanOpenTry implements the IBCModule interface diff --git a/modules/apps/29-fee/transfer_test.go b/modules/apps/29-fee/transfer_test.go index 9d7557fd6c4..ba1f505d9c0 100644 --- a/modules/apps/29-fee/transfer_test.go +++ b/modules/apps/29-fee/transfer_test.go @@ -68,5 +68,4 @@ func (suite *FeeTestSuite) TestFeeTransfer() { fee.AckFee.Add(fee.TimeoutFee...), // ack fee paid, timeout fee refunded sdk.NewCoins(suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress(), ibctesting.TestCoin.Denom)).Sub(originalChainASenderAccountBalance), ) - }