Add comments

This commit is contained in:
Ethan Frey
2022-05-04 10:42:38 +02:00
parent b6a796313c
commit 7704459ad8

View File

@@ -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{