diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c21957809f..0b2866e6764 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking +* (modules) [\#162](https://github.com/cosmos/ibc-go/pull/162) Remove deprecated Handler types in core IBC and the ICS 20 transfer module. * (modules/core) [\#161](https://github.com/cosmos/ibc-go/pull/161) Remove Type(), Route(), GetSignBytes() from 02-client, 03-connection, and 04-channel messages. * (modules) [\#140](https://github.com/cosmos/ibc-go/pull/140) IsFrozen() client state interface changed to Status(). gRPC `ClientStatus` route added. * (modules/core) [\#109](https://github.com/cosmos/ibc-go/pull/109) Remove connection and channel handshake CLI commands. diff --git a/modules/apps/transfer/handler.go b/modules/apps/transfer/handler.go deleted file mode 100644 index f6a0ace3d66..00000000000 --- a/modules/apps/transfer/handler.go +++ /dev/null @@ -1,23 +0,0 @@ -package transfer - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/ibc-go/modules/apps/transfer/types" -) - -// NewHandler returns sdk.Handler for IBC token transfer module messages -func NewHandler(k types.MsgServer) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgTransfer: - res, err := k.Transfer(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ICS-20 transfer message type: %T", msg) - } - } -} diff --git a/modules/apps/transfer/module.go b/modules/apps/transfer/module.go index c19a740ba8b..b0addfafed3 100644 --- a/modules/apps/transfer/module.go +++ b/modules/apps/transfer/module.go @@ -109,7 +109,7 @@ func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { // Route implements the AppModule interface func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) + return sdk.Route{} } // QuerierRoute implements the AppModule interface diff --git a/modules/apps/transfer/handler_test.go b/modules/apps/transfer/transfer_test.go similarity index 100% rename from modules/apps/transfer/handler_test.go rename to modules/apps/transfer/transfer_test.go diff --git a/modules/core/handler.go b/modules/core/handler.go deleted file mode 100644 index 3384bbcfedc..00000000000 --- a/modules/core/handler.go +++ /dev/null @@ -1,98 +0,0 @@ -package ibc - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/modules/core/04-channel/types" - "github.com/cosmos/ibc-go/modules/core/keeper" -) - -// NewHandler defines the IBC handler -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - // IBC client msg interface types - case *clienttypes.MsgCreateClient: - res, err := k.CreateClient(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *clienttypes.MsgUpdateClient: - res, err := k.UpdateClient(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *clienttypes.MsgUpgradeClient: - res, err := k.UpgradeClient(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *clienttypes.MsgSubmitMisbehaviour: - res, err := k.SubmitMisbehaviour(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - // IBC connection msgs - case *connectiontypes.MsgConnectionOpenInit: - res, err := k.ConnectionOpenInit(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *connectiontypes.MsgConnectionOpenTry: - res, err := k.ConnectionOpenTry(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *connectiontypes.MsgConnectionOpenAck: - res, err := k.ConnectionOpenAck(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *connectiontypes.MsgConnectionOpenConfirm: - res, err := k.ConnectionOpenConfirm(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - // IBC channel msgs - case *channeltypes.MsgChannelOpenInit: - res, err := k.ChannelOpenInit(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgChannelOpenTry: - res, err := k.ChannelOpenTry(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgChannelOpenAck: - res, err := k.ChannelOpenAck(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgChannelOpenConfirm: - res, err := k.ChannelOpenConfirm(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgChannelCloseInit: - res, err := k.ChannelCloseInit(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgChannelCloseConfirm: - res, err := k.ChannelCloseConfirm(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - // IBC packet msgs get routed to the appropriate module callback - case *channeltypes.MsgRecvPacket: - res, err := k.RecvPacket(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgAcknowledgement: - res, err := k.Acknowledgement(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgTimeout: - res, err := k.Timeout(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *channeltypes.MsgTimeoutOnClose: - res, err := k.TimeoutOnClose(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized IBC message type: %T", msg) - } - } -} diff --git a/modules/core/module.go b/modules/core/module.go index c00d644846f..1d338dcb69e 100644 --- a/modules/core/module.go +++ b/modules/core/module.go @@ -117,7 +117,7 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { // Route returns the message routing key for the ibc module. func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(host.RouterKey, NewHandler(*am.keeper)) + return sdk.Route{} } // QuerierRoute returns the ibc module's querier route name.