Closed AdityaSripal closed 6 months ago
@AdityaSripal, for async version negotiation in ibc-go
, will I have to patch core/keeper/msg_server.go
's ChannelOpenTry
with the following?
// Perform application logic callback
version, err := cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortId, channelID, cap, msg.Channel.Counterparty, msg.CounterpartyVersion)
if err != nil {
return nil, sdkerrors.Wrap(err, "channel open try callback failed")
}
// FIGME: If version is the empty string, expect the app to call WriteOpenTryChannel explicitly, possibly later...
if version != "" {
// Write channel into state
k.ChannelKeeper.WriteOpenTryChannel(ctx, msg.PortId, channelID, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.Channel.Counterparty, version)
}
return &channeltypes.MsgChannelOpenTryResponse{
Version: version,
}, nil
This may also justify adding something like a WriteOpenTryChannel
method to ICS4Wrapper
to extend the async version feature to Middleware.
@michaelfig yes. We are trying to improve the interface for middleware to avoid the complicated wiring as it exists. I think this will be much cleaner in future designs, and the ICS4 wrapper interface itself should be unnecessary
Writeup in the comments of how to compose the utility functions provided by IBC to implement async handshakes
closes: #732
cc: @michaelfig