From 7704459ad8b59dbbebe2908891cf7e677a9a6989 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Wed, 4 May 2022 10:42:38 +0200 Subject: [PATCH] Add comments --- x/wasm/ibc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index ebf7b9d7c3..6c138e9ab8 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -118,6 +118,9 @@ func (i IBCHandler) OnChanOpenTry( return "", sdkerrors.Wrap(err, "claim capability") } } + + // In the future, we can negotiate (see design comment above), but for now, we only error if we disagee + // with the proposed version return counterpartyVersion, nil } @@ -137,6 +140,11 @@ func (i IBCHandler) OnChanOpenAck( return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } channelInfo.Counterparty.ChannelId = counterpartyChannelID + // This is a bit ugly, but it is set AFTER the callback is done, yet we want to provide the contract + // access to the channel in queries. We can revisit how to better integrate with ibc-go in the future, + // but this is the best/safest we can do now. (If you remove this, you error when sending a packet during the + // OnChanOpenAck entry point) + // https://github.com/cosmos/ibc-go/pull/647/files#diff-54b5be375a2333c56f2ae1b5b4dc13ac9c734561e30286505f39837ee75762c7R25 i.channelKeeper.SetChannel(ctx, portID, channelID, channelInfo) msg := wasmvmtypes.IBCChannelConnectMsg{ OpenAck: &wasmvmtypes.IBCOpenAck{