diff --git a/x/gmp/module_ibc.go b/x/gmp/module_ibc.go index 90dd522..1dbb71c 100644 --- a/x/gmp/module_ibc.go +++ b/x/gmp/module_ibc.go @@ -11,7 +11,6 @@ import ( transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/sagaxyz/ssc/x/gmp/keeper" @@ -83,19 +82,19 @@ func (im IBCModule) OnChanOpenInit( ) (string, error) { // Require portID is the portID module is bound to - boundPort := im.keeper.GetPort(ctx) - if boundPort != portID { - return "", cosmossdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) - } + // boundPort := im.keeper.GetPort(ctx) + // if boundPort != portID { + // return "", cosmossdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + // } - if version != types.Version { - return "", cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.Version) - } + // if version != types.Version { + // return "", cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "got %s, expected %s", version, types.Version) + // } - // Claim channel capability passed back by IBC module - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } + // // Claim channel capability passed back by IBC module + // if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + // return "", err + // } return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) } @@ -113,25 +112,25 @@ func (im IBCModule) OnChanOpenTry( ) (string, error) { // Require portID is the portID module is bound to - boundPort := im.keeper.GetPort(ctx) - if boundPort != portID { - return "", cosmossdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) - } + // boundPort := im.keeper.GetPort(ctx) + // if boundPort != portID { + // return "", cosmossdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + // } - if counterpartyVersion != types.Version { - return "", cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) - } + // if counterpartyVersion != types.Version { + // return "", cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: got: %s, expected %s", counterpartyVersion, types.Version) + // } - // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos - // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) - // If module can already authenticate the capability then module already owns it so we don't need to claim - // Otherwise, module does not have channel capability and we must claim it from IBC - if !im.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { - // Only claim channel capability passed back by IBC module if we do not already own it - if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return "", err - } - } + // // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos + // // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) + // // If module can already authenticate the capability then module already owns it so we don't need to claim + // // Otherwise, module does not have channel capability and we must claim it from IBC + // if !im.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { + // // Only claim channel capability passed back by IBC module if we do not already own it + // if err := im.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { + // return "", err + // } + // } return im.app.OnChanOpenTry(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, counterpartyVersion) } @@ -144,9 +143,9 @@ func (im IBCModule) OnChanOpenAck( counterpartyChannelID string, counterpartyVersion string, ) error { - if counterpartyVersion != types.Version { - return cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) - } + // if counterpartyVersion != types.Version { + // return cosmossdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) + // } return im.app.OnChanOpenAck(ctx, portID, channelID, counterpartyChannelID, counterpartyVersion) } diff --git a/x/gmp/types/keys.go b/x/gmp/types/keys.go index eaea915..dc7fd1f 100644 --- a/x/gmp/types/keys.go +++ b/x/gmp/types/keys.go @@ -13,11 +13,11 @@ const ( // MemStoreKey defines the in-memory store key MemStoreKey = "mem_gmp" - // Version defines the current version the IBC module supports -Version = "gmp-1" + // Version defines the current version the IBC module supports + Version = "gmp-1" -// PortID is the default port id that module binds to -PortID = "gmp" + // PortID is the default port id that module binds to + PortID = "gmp" ) var ( @@ -26,5 +26,5 @@ var ( ) func KeyPrefix(p string) []byte { - return []byte(p) + return []byte(p) }