Skip to content

Commit

Permalink
remove alias.go from 05-port (cosmos#6575)
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-axner authored Jul 2, 2020
1 parent 8f96ec0 commit 8ed09e5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 53 deletions.
4 changes: 2 additions & 2 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import (
ibctransfertypes "github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
ibcclient "github.com/cosmos/cosmos-sdk/x/ibc/02-client"
ibcclienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
ibchost "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/keeper"
"github.com/cosmos/cosmos-sdk/x/mint"
Expand Down Expand Up @@ -267,7 +267,7 @@ func NewSimApp(
transferModule := transfer.NewAppModule(app.TransferKeeper)

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := port.NewRouter()
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule)
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down
3 changes: 1 addition & 2 deletions x/ibc-transfer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ import (
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/simulation"
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
host "github.com/cosmos/cosmos-sdk/x/ibc/24-host"
)

var (
_ module.AppModule = AppModule{}
_ port.IBCModule = AppModule{}
_ porttypes.IBCModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
)

Expand Down
34 changes: 0 additions & 34 deletions x/ibc/05-port/alias.go

This file was deleted.

20 changes: 10 additions & 10 deletions x/ibc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
connectiontypes "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
channel "github.com/cosmos/cosmos-sdk/x/ibc/04-channel"
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
"github.com/cosmos/cosmos-sdk/x/ibc/keeper"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}
err = cbs.OnChanOpenInit(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID, cap, msg.Channel.Counterparty, msg.Channel.Version)
if err != nil {
Expand All @@ -76,7 +76,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}
err = cbs.OnChanOpenTry(ctx, msg.Channel.Ordering, msg.Channel.ConnectionHops, msg.PortID, msg.ChannelID, cap, msg.Channel.Counterparty, msg.Channel.Version, msg.CounterpartyVersion)
if err != nil {
Expand All @@ -94,7 +94,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

err = cbs.OnChanOpenAck(ctx, msg.PortID, msg.ChannelID, msg.CounterpartyVersion)
Expand All @@ -112,7 +112,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

err = cbs.OnChanOpenConfirm(ctx, msg.PortID, msg.ChannelID)
Expand All @@ -130,7 +130,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

err = cbs.OnChanCloseInit(ctx, msg.PortID, msg.ChannelID)
Expand All @@ -148,7 +148,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

err = cbs.OnChanCloseConfirm(ctx, msg.PortID, msg.ChannelID)
Expand All @@ -168,7 +168,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

// Perform application logic callback
Expand All @@ -194,7 +194,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

// Perform application logic callback
Expand All @@ -220,7 +220,7 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
// Retrieve callbacks from router
cbs, ok := k.Router.GetRoute(module)
if !ok {
return nil, sdkerrors.Wrapf(port.ErrInvalidRoute, "route not found to module: %s", module)
return nil, sdkerrors.Wrapf(porttypes.ErrInvalidRoute, "route not found to module: %s", module)
}

// Perform application logic callback
Expand Down
11 changes: 6 additions & 5 deletions x/ibc/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
connectionkeeper "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/keeper"
channelkeeper "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/keeper"
port "github.com/cosmos/cosmos-sdk/x/ibc/05-port"
portkeeper "github.com/cosmos/cosmos-sdk/x/ibc/05-port/keeper"
porttypes "github.com/cosmos/cosmos-sdk/x/ibc/05-port/types"
)

// Keeper defines each ICS keeper for IBC
Expand All @@ -19,8 +20,8 @@ type Keeper struct {
ClientKeeper clientkeeper.Keeper
ConnectionKeeper connectionkeeper.Keeper
ChannelKeeper channelkeeper.Keeper
PortKeeper port.Keeper
Router *port.Router
PortKeeper portkeeper.Keeper
Router *porttypes.Router
}

// NewKeeper creates a new ibc Keeper
Expand All @@ -29,7 +30,7 @@ func NewKeeper(
) *Keeper {
clientKeeper := clientkeeper.NewKeeper(aminoCdc, key, stakingKeeper)
connectionKeeper := connectionkeeper.NewKeeper(aminoCdc, cdc, key, clientKeeper)
portKeeper := port.NewKeeper(scopedKeeper)
portKeeper := portkeeper.NewKeeper(scopedKeeper)
channelKeeper := channelkeeper.NewKeeper(cdc, key, clientKeeper, connectionKeeper, portKeeper, scopedKeeper)

return &Keeper{
Expand All @@ -49,7 +50,7 @@ func (k Keeper) Codecs() (codec.Marshaler, *codec.Codec) {

// SetRouter sets the Router in IBC Keeper and seals it. The method panics if
// there is an existing router that's already sealed.
func (k *Keeper) SetRouter(rtr *port.Router) {
func (k *Keeper) SetRouter(rtr *porttypes.Router) {
if k.Router != nil && k.Router.Sealed() {
panic("cannot reset a sealed router")
}
Expand Down

0 comments on commit 8ed09e5

Please sign in to comment.