Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func NewIBCMiddlewareWithAuth(app porttypes.IBCModule, k *keeper.Keeper) *IBCMid
}
}

// ModuleName returns the name of the middleware for identification purposes.
func (im *IBCMiddleware) ModuleName() string {
return types.SubModuleName
}

// SetUnderlyingApplication sets the underlying application for the middleware.
func (im *IBCMiddleware) SetUnderlyingApplication(app porttypes.IBCModule) {
if app == nil {
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func NewIBCModule(k *keeper.Keeper) *IBCModule {
}
}

// ModuleName returns the name of the module for identification purposes.
func (im *IBCModule) ModuleName() string {
return types.SubModuleName
}

// OnChanOpenInit implements the IBCModule interface
func (*IBCModule) OnChanOpenInit(
_ sdk.Context,
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/callbacks/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func NewIBCMiddleware(
}
}

// ModuleName returns the name of the middleware for identification purposes.
func (im *IBCMiddleware) ModuleName() string {
return types.ModuleName
}

// SetICS4Wrapper sets the ICS4Wrapper. This function may be used after the
// middleware's creation to set the middleware which is above this module in
// the IBC application stack.
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/packet-forward-middleware/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func NewIBCMiddleware(k *keeper.Keeper, retriesOnTimeout uint8, forwardTimeout t
}
}

// ModuleName returns the name of the middleware for identification purposes.
func (im *IBCMiddleware) ModuleName() string {
return types.ModuleName
}

// OnChanOpenInit implements the IBCModule interface.
func (im *IBCMiddleware) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, counterparty channeltypes.Counterparty, version string) (string, error) {
return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version)
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/rate-limiting/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func NewIBCMiddleware(k *keeper.Keeper) *IBCMiddleware {
}
}

// ModuleName returns the name of the middleware for identification purposes.
func (im *IBCMiddleware) ModuleName() string {
return "ratelimiting" // types.ModuleName from this package
}

// OnChanOpenInit implements the IBCMiddleware interface. Call underlying app's OnChanOpenInit.
func (im *IBCMiddleware) OnChanOpenInit(ctx sdk.Context, order channeltypes.Order, connectionHops []string, portID string, channelID string, counterparty channeltypes.Counterparty, version string) (string, error) {
return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, counterparty, version)
Expand Down
5 changes: 5 additions & 0 deletions modules/apps/transfer/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func NewIBCModule(k *keeper.Keeper) *IBCModule {
}
}

// ModuleName returns the name of the module for identification purposes.
func (im *IBCModule) ModuleName() string {
return types.ModuleName
}

// ValidateTransferChannelParams does validation of a newly created transfer channel. A transfer
// channel must be UNORDERED, use the correct port (by default 'transfer'), and use the current
// supported version. Only 2^32 channels are allowed to be created.
Expand Down
22 changes: 22 additions & 0 deletions modules/core/04-channel/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,25 @@ func (q *queryServer) NextSequenceSend(goCtx context.Context, req *types.QueryNe
selfHeight := clienttypes.GetSelfHeight(ctx)
return types.NewQueryNextSequenceSendResponse(sequence, nil, selfHeight), nil
}

// MiddlewareStack implements the Query/MiddlewareStack gRPC method
func (q *queryServer) MiddlewareStack(goCtx context.Context, req *types.QueryMiddlewareStackRequest) (*types.QueryMiddlewareStackResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}

if err := validate.GRPCRequest(req.PortId, ""); err != nil {
return nil, err
}

// Get middleware stack from port keeper
middlewareStack := q.portKeeper.GetMiddlewareStack(req.PortId)
if middlewareStack == nil {
return nil, status.Error(codes.NotFound, "port not found or no middleware stack")
}

return &types.QueryMiddlewareStackResponse{
PortId: req.PortId,
MiddlewareStack: middlewareStack,
}, nil
}
3 changes: 3 additions & 0 deletions modules/core/04-channel/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type Keeper struct {
cdc codec.BinaryCodec
clientKeeper types.ClientKeeper
connectionKeeper types.ConnectionKeeper
portKeeper types.PortKeeper

// V2 Keepers are only used for channel aliasing
clientKeeperV2 types.ClientKeeperV2
Expand All @@ -49,6 +50,7 @@ func NewKeeper(
storeService corestore.KVStoreService,
clientKeeper types.ClientKeeper,
connectionKeeper types.ConnectionKeeper,
portKeeper types.PortKeeper,
clientKeeperV2 types.ClientKeeperV2,
channelKeeperV2 types.ChannelKeeperV2,
) *Keeper {
Expand All @@ -57,6 +59,7 @@ func NewKeeper(
cdc: cdc,
clientKeeper: clientKeeper,
connectionKeeper: connectionKeeper,
portKeeper: portKeeper,
clientKeeperV2: clientKeeperV2,
channelKeeperV2: channelKeeperV2,
}
Expand Down
5 changes: 5 additions & 0 deletions modules/core/04-channel/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ type ClientKeeperV2 interface {
type ChannelKeeperV2 interface {
SetClientForAlias(ctx sdk.Context, channelID, clientID string)
}

// PortKeeper expected port keeper interface
type PortKeeper interface {
GetMiddlewareStack(portID string) []string
}
Loading
Loading