Skip to content

feat: upgrade to cosmos-sdk v0.54.x and ibc-go v11 - #300

Closed
mmsqe wants to merge 16 commits into
cosmos:mainfrom
mmsqe:bump_deps
Closed

mmsqe wants to merge 16 commits into
cosmos:mainfrom
mmsqe:bump_deps

Conversation

@mmsqe

@mmsqe mmsqe commented Jul 10, 2026

Copy link
Copy Markdown
  • upgrades rate-limiting, async-icq, packet-forward-middleware and ibc-hooks
  • updatecosmossdk.io/storeto store/v2, cosmossdk.io/log to log/v2
  • register light-client modules explicitly on the client keeper, key IBC routes by port ID, and implement SetICS4Wrapper / SetUnderlyingApplication on middleware
  • for more infos ibc-go, cosmos-sdk

@mmsqe
mmsqe requested a review from a team as a code owner July 10, 2026 03:31
@github-actions github-actions Bot added packet-forward-middleware Label for items related to the packet forward middleware ibc-hooks Label for items related to Osmosis' ibc-hooks implementation async-icq Label for items related to the async-icq module polytone labels Jul 10, 2026
@dianab-cl

Copy link
Copy Markdown
Contributor

@greptile review

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR upgrades rate-limiting, async-icq, packet-forward-middleware, and ibc-hooks to cosmos-sdk v0.54.x and ibc-go v11, removing the capability module, switching store and log imports to their v2 paths, and implementing the new SetICS4Wrapper / SetUnderlyingApplication middleware interface.

  • Capability removal: Port binding via BindPort/ClaimCapability is replaced throughout by routing IBC modules keyed on port ID; InitGenesis and AppModule.InitModule no longer claim port capabilities.
  • Middleware interface: All three IBC middlewares now return pointer types from their constructors and implement SetICS4Wrapper / SetUnderlyingApplication; the OnRecvPacket, OnAcknowledgementPacket, and OnTimeoutPacket callbacks add the new channelVersion string parameter required by ibc-go v11.
  • Import migrations: cosmossdk.io/log → cosmossdk.io/log/v2, cosmossdk.io/store → github.com/cosmos/cosmos-sdk/store/v2, and light-client modules are now explicitly registered on the client keeper router.

Confidence Score: 4/5

The migration is mechanically thorough and follows the ibc-go v11 and cosmos-sdk v0.54 guides closely; the only rough edges are two inconsistencies in how SetUnderlyingApplication is guarded across middleware implementations.

The core migration work across all four modules looks correct. Two related issues stand out: SetUnderlyingApplication in rate-limiting has no nil guard and silently overwrites a previously-set underlying application, while the packet-forward middleware panics unconditionally even when app was already set via the constructor. Neither is likely to trigger in normal usage given the current simapp wiring, but they represent a fragile divergence from the intended interface contract.

modules/rate-limiting/ibc_middleware.go (SetUnderlyingApplication missing nil guard) and middleware/packet-forward-middleware/packetforward/ibc_middleware.go (SetUnderlyingApplication always panics when app is already set via constructor).

Important Files Changed

Filename Overview
middleware/packet-forward-middleware/packetforward/ibc_middleware.go Upgraded to ibc-go v11 imports; constructor now returns *IBCMiddleware; added SetICS4Wrapper and SetUnderlyingApplication to satisfy porttypes.Middleware — SetUnderlyingApplication has an overly strict guard that will always panic when called after the constructor.
modules/async-icq/ibc_module.go Removed capability-system code (ClaimCapability, chanCap parameters) and added new channelVersion string parameter to OnRecvPacket/OnAck/OnTimeout; constructor returns *IBCModule; SetICS4Wrapper added — all correct per ibc-go v11 migration.
modules/async-icq/keeper/keeper.go Dropped capability keeper and port keeper; added WithICS4Wrapper setter (naming differs from SetICS4Wrapper used elsewhere); switched to ibc-go v11 and log/v2 — functional but naming inconsistency may cause confusion.
modules/rate-limiting/ibc_middleware.go Updated to ibc-go v11; returns *IBCMiddleware; added SetICS4Wrapper/SetUnderlyingApplication — SetUnderlyingApplication lacks the nil guard that the packet-forward equivalent has, allowing silent overwrite of a previously-set underlying application.
modules/rate-limiting/keeper/keeper.go Added SetICS4Wrapper to implement the porttypes.Middleware interface; switched to log/v2 — straightforward and correct.
modules/async-icq/testing/simapp/app.go Removed capability keeper, group module, and mock IBC module; routes ICQ by port ID instead of module name; registers Tendermint light client module explicitly — correctly follows ibc-go v11 migration guide.
modules/rate-limiting/testing/simapp/app.go Removed capability keeper and group module; wires rate-limit keeper as transfer's ICS4Wrapper via WithICS4Wrapper after construction; light clients registered explicitly — migration looks correct.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant IBC as IBC Core (v11)
    participant RL as RateLimit Middleware
    participant Transfer as Transfer Module
    participant ICQ as ICQ Module (host)

    Note over IBC,ICQ: Stack wiring
    IBC->>RL: SetICS4Wrapper(channelKeeper)
    Note over Transfer: TransferKeeper.WithICS4Wrapper(ratelimitKeeper)

    Note over IBC,ICQ: Inbound packet
    IBC->>RL: OnRecvPacket(ctx, channelVersion, packet, relayer)
    RL->>RL: ReceiveRateLimitedPacket
    RL->>Transfer: OnRecvPacket(ctx, channelVersion, packet, relayer)
    Transfer-->>IBC: Acknowledgement

    Note over IBC,ICQ: Outbound packet
    Transfer->>RL: SendPacket(via RatelimitKeeper ICS4Wrapper)
    RL->>RL: SendRateLimitedPacket
    RL->>IBC: SendPacket(via channelKeeper)

    Note over IBC,ICQ: ICQ host
    IBC->>ICQ: OnRecvPacket(ctx, channelVersion, packet, relayer)
    ICQ->>ICQ: Process ABCI query
    ICQ-->>IBC: Acknowledgement with query result
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant IBC as IBC Core (v11)
    participant RL as RateLimit Middleware
    participant Transfer as Transfer Module
    participant ICQ as ICQ Module (host)

    Note over IBC,ICQ: Stack wiring
    IBC->>RL: SetICS4Wrapper(channelKeeper)
    Note over Transfer: TransferKeeper.WithICS4Wrapper(ratelimitKeeper)

    Note over IBC,ICQ: Inbound packet
    IBC->>RL: OnRecvPacket(ctx, channelVersion, packet, relayer)
    RL->>RL: ReceiveRateLimitedPacket
    RL->>Transfer: OnRecvPacket(ctx, channelVersion, packet, relayer)
    Transfer-->>IBC: Acknowledgement

    Note over IBC,ICQ: Outbound packet
    Transfer->>RL: SendPacket(via RatelimitKeeper ICS4Wrapper)
    RL->>RL: SendRateLimitedPacket
    RL->>IBC: SendPacket(via channelKeeper)

    Note over IBC,ICQ: ICQ host
    IBC->>ICQ: OnRecvPacket(ctx, channelVersion, packet, relayer)
    ICQ->>ICQ: Process ABCI query
    ICQ-->>IBC: Acknowledgement with query result
Loading

Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." | Re-trigger Greptile

Comment on lines +39 to +41
func (im *IBCMiddleware) SetUnderlyingApplication(app porttypes.IBCModule) {
im.app = app
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Missing nil guard in SetUnderlyingApplication

SetUnderlyingApplication silently overwrites im.app even when it was already set by the constructor — unlike the packet-forward middleware, which panics in the same situation. If the IBC framework (or a developer) calls SetUnderlyingApplication after NewIBCMiddleware, the explicitly wired underlying transfer module is replaced without any warning, leading to the middleware silently forwarding to the wrong application.

Comment on lines +63 to +71
// SetUnderlyingApplication sets the underlying IBC application. This function
// may be used after the middleware's initialization to set the IBC module which
// is below this middleware.
func (im *IBCMiddleware) SetUnderlyingApplication(app porttypes.IBCModule) {
if im.app != nil {
panic("underlying application already set")
}
im.app = app
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The SetUnderlyingApplication guard correctly panics when im.app is already set, but im.app is always set via the constructor — so this guard will always fire for any caller trying to use the ibc-go v11 programmatic wiring pattern. Consider allowing it to be set only when im.app is nil so the middleware can support both construction patterns.

Suggested change
// SetUnderlyingApplication sets the underlying IBC application. This function
// may be used after the middleware's initialization to set the IBC module which
// is below this middleware.
func (im *IBCMiddleware) SetUnderlyingApplication(app porttypes.IBCModule) {
if im.app != nil {
panic("underlying application already set")
}
im.app = app
}
// SetUnderlyingApplication sets the underlying IBC application. This function
// may be used after the middleware's initialization to set the IBC module which
// is below this middleware.
func (im *IBCMiddleware) SetUnderlyingApplication(app porttypes.IBCModule) {
if app == nil {
panic("underlying IBC application cannot be nil")
}
im.app = app
}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines 54 to +57

// BindPort stores the provided portID and binds to it, returning the associated capability
func (k Keeper) BindPort(ctx sdk.Context, portID string) error {
capability := k.portKeeper.BindPort(ctx, portID)
return k.ClaimCapability(ctx, capability, host.PortPath(portID))
}

// IsBound checks if the interchain query already bound to the desired port
func (k Keeper) IsBound(ctx sdk.Context, portID string) bool {
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
// WithICS4Wrapper sets the ICS4Wrapper. This function may be used after the
// keeper's creation to set the middleware which is above this module in the
// IBC application stack.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 WithICS4Wrapper naming differs from the rest of the codebase

All other middlewares in this PR name the equivalent setter SetICS4Wrapper (rate-limiting keeper.go, packet-forward keeper.go). Using WithICS4Wrapper here is inconsistent and forces IBCModule.SetICS4Wrapper to dispatch through a differently-named method, making the call graph harder to follow. Renaming to SetICS4Wrapper would align with the pattern across modules.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@srdtrk

srdtrk commented Jul 15, 2026

Copy link
Copy Markdown
Member

This PR is not needed since we are going to release rate-limiting for v11 in ibc-go. And have already released pfm for v11 in ibc-go. We updated ibc-hooks here already. And we have no plans for async-icq or polytone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async-icq Label for items related to the async-icq module ibc-hooks Label for items related to Osmosis' ibc-hooks implementation packet-forward-middleware Label for items related to the packet forward middleware polytone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants