Skip to content

Commit

Permalink
remove todos
Browse files Browse the repository at this point in the history
  • Loading branch information
tac0turtle committed Aug 28, 2024
1 parent 0f519b4 commit 70fd024
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 88 deletions.
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/cometbft/cometbft v0.38.11
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ics23/go v0.10.0
Expand Down Expand Up @@ -182,7 +182,7 @@ require (
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand All @@ -198,3 +198,5 @@ require (
)

replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

replace github.com/cosmos/ibc-go/modules/capability => ./modules/capability
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK
github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg=
github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE=
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk=
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
Expand All @@ -354,8 +354,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM=
github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=
Expand Down Expand Up @@ -1276,8 +1274,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,18 @@ func (k Keeper) setPort(ctx context.Context, portID string) {

// hasCapability checks if the interchain account controller module owns the port capability for the desired port
func (k Keeper) hasCapability(ctx context.Context, portID string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
_, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID))
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
}

// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name)
return k.scopedKeeper.AuthenticateCapability(ctx, cap, name)
}

// ClaimCapability wraps the scopedKeeper's ClaimCapability function
func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name)
return k.scopedKeeper.ClaimCapability(ctx, cap, name)
}

// GetAppVersion calls the ICS4Wrapper GetAppVersion function.
Expand Down
3 changes: 1 addition & 2 deletions modules/apps/27-interchain-accounts/host/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ func (k Keeper) OnChanOpenTry(

// On the host chain the capability may only be claimed during the OnChanOpenTry
// The capability being claimed in OpenInit is for a controller chain (the port is different)
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
if err = k.ClaimCapability(sdkCtx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
if err = k.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil {
return "", errorsmod.Wrapf(err, "failed to claim capability for channel %s on port %s", channelID, portID)
}

Expand Down
9 changes: 3 additions & 6 deletions modules/apps/27-interchain-accounts/host/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,18 @@ func (k Keeper) setPort(ctx context.Context, portID string) {

// hasCapability checks if the interchain account host module owns the port capability for the desired port
func (k Keeper) hasCapability(ctx context.Context, portID string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
_, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID))
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
}

// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name)
return k.scopedKeeper.AuthenticateCapability(ctx, cap, name)
}

// ClaimCapability wraps the scopedKeeper's ClaimCapability function
func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name)
return k.scopedKeeper.ClaimCapability(ctx, cap, name)
}

// GetAppVersion calls the ICS4Wrapper GetAppVersion function.
Expand Down
6 changes: 4 additions & 2 deletions modules/apps/callbacks/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ replace github.com/cosmos/ibc-go/v9 => ../../../

replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

replace github.com/cosmos/ibc-go/modules/capability => ../../capability

require (
cosmossdk.io/api v0.7.5
cosmossdk.io/client/v2 v2.0.0-beta.3
Expand All @@ -24,7 +26,7 @@ require (
cosmossdk.io/x/upgrade v0.1.4
github.com/cometbft/cometbft v0.38.11
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ibc-go/v9 v9.0.0
Expand Down Expand Up @@ -189,7 +191,7 @@ require (
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand Down
10 changes: 4 additions & 6 deletions modules/apps/callbacks/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK
github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA=
github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec=
github.com/cosmos/cosmos-sdk v0.50.9 h1:gt2usjz0H0qW6KwAxWw7ZJ3XU8uDwmhN+hYG3nTLeSg=
github.com/cosmos/cosmos-sdk v0.50.9/go.mod h1:TMH6wpoYBcg7Cp5BEg8fneLr+8XloNQkf2MRNF9V6JE=
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef h1:us0dw4egT2k00jnK4JgQ2Su6yJlBnwCfgWnKC7MIwqk=
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef/go.mod h1:9l85MGxnejiuiY4gum/RzdRKfkmLZDJh5uOD3m1zxy0=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
Expand All @@ -362,8 +362,6 @@ github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fr
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.2.0 h1:kVxTmjTh4k0Dh1VNL046v6BXqKziqMDzxo93oh3kOfM=
github.com/cosmos/iavl v1.2.0/go.mod h1:HidWWLVAtODJqFD6Hbne2Y0q3SdxByJepHUOeoH4LiI=
github.com/cosmos/ibc-go/modules/capability v1.0.1 h1:ibwhrpJ3SftEEZRxCRkH0fQZ9svjthrX2+oXdZvzgGI=
github.com/cosmos/ibc-go/modules/capability v1.0.1/go.mod h1:rquyOV262nGJplkumH+/LeYs04P3eV8oB7ZM4Ygqk4E=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=
Expand Down Expand Up @@ -1288,8 +1286,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
3 changes: 1 addition & 2 deletions modules/apps/transfer/keeper/forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ func (k Keeper) forwardPacket(ctx context.Context, data types.FungibleTokenPacke

// acknowledgeForwardedPacket writes the async acknowledgement for forwardedPacket
func (k Keeper) acknowledgeForwardedPacket(ctx context.Context, forwardedPacket, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
capability, ok := k.scopedKeeper.GetCapability(sdkCtx, host.ChannelCapabilityPath(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel))
capability, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(forwardedPacket.DestinationPort, forwardedPacket.DestinationChannel))
if !ok {
return errorsmod.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
}
Expand Down
9 changes: 3 additions & 6 deletions modules/apps/transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ func (Keeper) Logger(ctx context.Context) log.Logger {

// hasCapability checks if the transfer module owns the port capability for the desired port
func (k Keeper) hasCapability(ctx context.Context, portID string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
_, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID))
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
}

Expand Down Expand Up @@ -322,15 +321,13 @@ func (k Keeper) IterateTokensInEscrow(ctx context.Context, storeprefix []byte, c

// AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function
func (k Keeper) AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.AuthenticateCapability(sdkCtx, cap, name)
return k.scopedKeeper.AuthenticateCapability(ctx, cap, name)
}

// ClaimCapability allows the transfer module that can claim a capability that IBC module
// passes to it
func (k Keeper) ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.ClaimCapability(sdkCtx, cap, name)
return k.scopedKeeper.ClaimCapability(ctx, cap, name)
}

// setForwardedPacket sets the forwarded packet in the store.
Expand Down
3 changes: 1 addition & 2 deletions modules/core/03-connection/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ func (k *Keeper) CreateSentinelLocalhostConnection(ctx context.Context) {
// addConnectionToClient is used to add a connection identifier to the set of
// connections associated with a client.
func (k *Keeper) addConnectionToClient(ctx context.Context, clientID, connectionID string) error {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
_, found := k.clientKeeper.GetClientState(sdkCtx, clientID)
_, found := k.clientKeeper.GetClientState(ctx, clientID)
if !found {
return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID)
}
Expand Down
3 changes: 1 addition & 2 deletions modules/core/04-channel/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,7 @@ func (k *Keeper) GetChannelConnection(ctx context.Context, portID, channelID str

// LookupModuleByChannel will return the IBCModule along with the capability associated with a given channel defined by its portID and channelID
func (k *Keeper) LookupModuleByChannel(ctx context.Context, portID, channelID string) (string, *capabilitytypes.Capability, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
modules, capability, err := k.scopedKeeper.LookupModules(sdkCtx, host.ChannelCapabilityPath(portID, channelID))
modules, capability, err := k.scopedKeeper.LookupModules(ctx, host.ChannelCapabilityPath(portID, channelID))
if err != nil {
return "", nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/04-channel/keeper/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ func (k *Keeper) WriteAcknowledgement(

// Authenticate capability to ensure caller has authority to receive packet on this channel
capName := host.ChannelCapabilityPath(packet.GetDestPort(), packet.GetDestChannel())
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
if !k.scopedKeeper.AuthenticateCapability(sdkCtx, chanCap, capName) {
if !k.scopedKeeper.AuthenticateCapability(ctx, chanCap, capName) {
return errorsmod.Wrapf(
types.ErrInvalidChannelCapability,
"channel capability failed authentication for capability name %s", capName,
Expand Down Expand Up @@ -359,6 +358,7 @@ func (k *Keeper) WriteAcknowledgement(
"dst_channel", packet.GetDestChannel(),
)

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
emitWriteAcknowledgementEvent(sdkCtx, packet.(types.Packet), channel, bz)

return nil
Expand Down
13 changes: 4 additions & 9 deletions modules/core/05-port/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ func (Keeper) Logger(ctx context.Context) log.Logger {

// IsBound checks a given port ID is already bounded.
func (k *Keeper) IsBound(ctx context.Context, portID string) bool {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
_, ok := k.scopedKeeper.GetCapability(sdkCtx, host.PortPath(portID))
_, ok := k.scopedKeeper.GetCapability(ctx, host.PortPath(portID))
return ok
}

Expand All @@ -54,9 +53,7 @@ func (k *Keeper) BindPort(ctx context.Context, portID string) *capabilitytypes.C
panic(fmt.Errorf("port %s is already bound", portID))
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917

key, err := k.scopedKeeper.NewCapability(sdkCtx, host.PortPath(portID))
key, err := k.scopedKeeper.NewCapability(ctx, host.PortPath(portID))
if err != nil {
panic(err.Error())
}
Expand All @@ -74,14 +71,12 @@ func (k *Keeper) Authenticate(ctx context.Context, key *capabilitytypes.Capabili
panic(err.Error())
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return k.scopedKeeper.AuthenticateCapability(sdkCtx, key, host.PortPath(portID))
return k.scopedKeeper.AuthenticateCapability(ctx, key, host.PortPath(portID))
}

// LookupModuleByPort will return the IBCModule along with the capability associated with a given portID
func (k *Keeper) LookupModuleByPort(ctx context.Context, portID string) (string, *capabilitytypes.Capability, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
modules, capability, err := k.scopedKeeper.LookupModules(sdkCtx, host.PortPath(portID))
modules, capability, err := k.scopedKeeper.LookupModules(ctx, host.PortPath(portID))
if err != nil {
return "", nil, err
}
Expand Down
13 changes: 7 additions & 6 deletions modules/core/exported/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package exported

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"context"

capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
)

// ScopedKeeper defines the expected x/capability scoped keeper interface
type ScopedKeeper interface {
NewCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, error)
GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx sdk.Context, name string) ([]string, *capabilitytypes.Capability, error)
ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
NewCapability(ctx context.Context, name string) (*capabilitytypes.Capability, error)
GetCapability(ctx context.Context, name string) (*capabilitytypes.Capability, bool)
AuthenticateCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) bool
LookupModules(ctx context.Context, name string) ([]string, *capabilitytypes.Capability, error)
ClaimCapability(ctx context.Context, cap *capabilitytypes.Capability, name string) error
}
4 changes: 1 addition & 3 deletions modules/light-clients/07-tendermint/light_client_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors"
Expand Down Expand Up @@ -64,8 +63,7 @@ func (l LightClientModule) VerifyClientMessage(ctx context.Context, clientID str
return errorsmod.Wrap(clienttypes.ErrClientNotFound, clientID)
}

sdkCtx := sdk.UnwrapSDKContext(ctx) // TODO: https://github.com/cosmos/ibc-go/issues/5917
return clientState.VerifyClientMessage(sdkCtx, l.cdc, clientStore, clientMsg)
return clientState.VerifyClientMessage(ctx, l.cdc, clientStore, clientMsg)
}

// CheckForMisbehaviour obtains the client state associated with the client identifier and calls into the clientState.CheckForMisbehaviour method.
Expand Down
4 changes: 3 additions & 1 deletion modules/light-clients/08-wasm/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ replace github.com/cosmos/ibc-go/v9 => ../../../

replace github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7

replace github.com/cosmos/ibc-go/modules/capability => ../../capability

require (
cosmossdk.io/api v0.7.5
cosmossdk.io/client/v2 v2.0.0-beta.3
Expand All @@ -26,7 +28,7 @@ require (
github.com/CosmWasm/wasmvm/v2 v2.1.2
github.com/cometbft/cometbft v0.38.11
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-sdk v0.50.9
github.com/cosmos/cosmos-sdk v0.50.10-0.20240808075341-156231be8aef
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ibc-go/v9 v9.0.0
Expand Down
Loading

0 comments on commit 70fd024

Please sign in to comment.